Module Msynth.Instrument

Instruments.

type ('sample, 'event) note = {
  1. note : int;
    (*

    Note: A4 is 69.

    *)
  2. stream : 'sample Stream.stream;
  3. event : 'event Stream.Event.t;
  4. mutable released : bool;
  5. alive : bool Stdlib.ref;
    (*

    is the note still playing?

    *)
}

A note of an instrument.

val create_stereo : event:[> `Note_off of int | `Note_on of int * float ] Stream.Event.t -> ?portamento:float Stream.t -> (float * float, [> `Release ]) Note.t -> (float * float) Stream.t
val create : event:[> `Note_off of int | `Note_on of int * float ] Stream.Event.t -> ?portamento:float Stream.t -> (float, [> `Release ]) Note.t -> float Stream.t
val create_drum : event:[> `Note_off of 'a | `Note_on of int * 'b ] Stream.Event.t -> (on_die:(unit -> unit) -> float -> 'c -> float Stream.t) -> float Stream.t

Create a drum instrument.

val play : ?portamento:float Stream.t -> (float, [> `Release ]) Note.t -> [> `Note_off of int | `Note_on of int * float ] list Stream.t -> float Stream.t

Play a stream of lists events.

val play_stereo : ?portamento:float Stream.t -> (float * float, [> `Release ]) Note.t -> [> `Note_off of int | `Note_on of int * float ] list Stream.t -> (float * float) Stream.t
val play_drum : (on_die:(unit -> unit) -> float -> 'a -> float Stream.t) -> [> `Note_off of 'b | `Note_on of int * 'a ] list Stream.t -> float Stream.t
val play_drums : ?kick:(on_die:(unit -> unit) -> float -> float -> float Stream.t) -> ?snare:(on_die:(unit -> unit) -> float -> float -> float Stream.t) -> ?closed_hat:(on_die:(unit -> unit) -> float -> float -> float Stream.t) -> [< `Closed_hat of float | `Kick of float | `Nop | `Snare of float ] list Stream.t -> float Stream.t
val kick : float -> float Stream.t

Generate a recurrent kick at given tempo.