Module Mu.Performance

Performances.

Performances interpret music values as sequences of note events on an absolute timeline.

Volume, time and duration

type volume = int

The type for performance volume. Using the MIDI convention, from [0;127].

type time_s = Q.t

The type for absolute performance times in seconds. The origin is 0.

type dur_s = Q.t

The type for durations in seconds.

val wn_dur_s : bpm:int -> beat_dur:Music.dur -> dur_s

wn_dur_s ~bpm ~beat_dur is the duration, in seconds, of a whole note given bpm beats per minute and a beat duration of beat_dur whole notes. For example wn_dur_s ~bpm:120 ~beat_dur:M.qn is the duration, in seconds, of a whole note for 120 beats per minute and one quarter note per beat.

Note events

module Event : sig ... end

Note events.

Performances

type t = Event.t list

The type for performances. A list of note events ordered by time.

val empty : t

empty is the empty performance.

val merge : t -> t -> t

merge p0 p1 merges performance p0 and p0.

val by_instrument : t -> t Instrument.Map.t

by_instrument p maps each instrument of p to its own performance.

Music intepretation

module Ctx : sig ... end

Musical context.

val of_music : ?ctx:Pnote.t Ctx.t -> Pnote.t Music.t -> t

of_music ~cxt m is a performance given by intepreting music m starting in context ctx. The latter defaults to Ctx.default in particular this means:

  • A tempo of 120 beats per minute with one beat for a quarter note.
  • A volume set to 127.
  • An instrument set to `Acoustic_grand_piano