Module Msynth.Note

Notes.

type ('sample, 'event) t = event:'event Stream.Event.t -> on_die:(unit -> unit) -> unit -> Stream.sample -> float -> 'sample Stream.stream

A function for creating notes. It takes as arugment the events it can recieve, as well as an on_die function, which it should call when the note has finished playing (we cannot determine this externally in case there is some release), and returns a function which plays a note at given frequency and volume.

val frequency : ?detune:float -> float -> float

Convert note height into frequency.

val duration : float -> float -> float

Duration of a note at given tempo.

val simple : (unit -> Stream.sample -> float -> float) -> (float, [< `Release ]) t

Note from an oscillator.

val detune : ?cents:float Stream.t -> ?wet:float Stream.t -> (float, 'a) t -> (float, 'b) t

Add a detuned note on top of the note.

val add : (dt:float Stream.t -> event:'a Stream.Event.t -> on_die:(unit -> unit) -> Stream.sample -> float -> float) -> (dt:float Stream.t -> event:'a Stream.Event.t -> on_die:(unit -> unit) -> Stream.sample -> float -> float) -> (float, 'b) t

Add two notes.

module Drum : sig ... end

Basic (TR-808 type) drum notes.

val adsr : ?a:float Stream.t -> ?d:float Stream.t -> ?s:float Stream.t -> ?r:float Stream.t -> (unit -> Stream.sample -> float -> float) -> (float, [< `Release | `Reset ]) t

Simple note with adsr envelope and volume.