Module

Audio.SoundFont

Package
purescript-soundfonts
Repository
newlandsvalley/purescript-soundfonts

#AUDIO Source

data AUDIO :: Effect

The SoundFont API which we will expose Audio Effect

#AudioBuffer Source

data AudioBuffer :: Type

the Audio Buffer for a single note

#Instrument Source

type Instrument = Tuple InstrumentName SoundFont

an instrument name attached to its SoundFont

#InstrumentChannels Source

type InstrumentChannels = Map InstrumentName Int

the mapping of instrument names to MIDI channels

#MidiNote Source

type MidiNote = { channel :: Int, duration :: Number, gain :: Number, id :: Int, timeOffset :: Number }

A Midi Note

#SoundFont Source

type SoundFont = Map Int AudioBuffer

the instrument soundfont a mapping between MIDI pitch and the note's AudioBuffer

#canPlayOgg Source

canPlayOgg :: forall eff. (Eff (au :: AUDIO | eff) Boolean)

can the browser play ogg format ?

#isWebAudioEnabled Source

isWebAudioEnabled :: forall eff. (Eff (au :: AUDIO | eff) Boolean)

is the browser web-audio enabled ?

#setNoteRing Source

setNoteRing :: forall eff. Number -> Eff (au :: AUDIO | eff) Unit

setting for how long the note 'rings' after it's alloted time in order to support features such as a more legato feel This should be a number between 0 (no ring) and 1 (double the original note duration)

#logLoadResource Source

logLoadResource :: forall e. InstrumentName -> Eff (ajax :: AJAX, console :: CONSOLE | e) (Fiber (ajax :: AJAX, console :: CONSOLE | e) Unit)

just for debug

#loadInstrument Source

loadInstrument :: forall e. Maybe String -> InstrumentName -> Aff (ajax :: AJAX, au :: AUDIO | e) Instrument

load a single instrument SoundFont The options are to load the soundfont from: Benjamin Gleitzman's server (default) A directory from the local server if this is supplied

#loadInstruments Source

loadInstruments :: forall e. Maybe String -> Array InstrumentName -> Aff (ajax :: AJAX, au :: AUDIO | e) (Array Instrument)

load a bunch of instrument SoundFonts (in parallel) again with options to load either locally or remotely from Benjamin Gleitzman's server

#loadRemoteSoundFonts Source

loadRemoteSoundFonts :: forall e. Array InstrumentName -> Aff (ajax :: AJAX, au :: AUDIO | e) (Array Instrument)

load a bunch of soundfonts from the Gleitzmann server

#loadPianoSoundFont Source

loadPianoSoundFont :: forall e. String -> Aff (ajax :: AJAX, au :: AUDIO | e) Instrument

load the piano soundfont from a relative directory on the local server

#playNote Source

playNote :: forall eff. Array Instrument -> MidiNote -> Eff (au :: AUDIO | eff) Number

play a single note through its soundfont buffer

#playNotes Source

playNotes :: forall eff. Array Instrument -> Array MidiNote -> Eff (au :: AUDIO | eff) Number

play a bunch of notes asynchronously return the duration of the phrase (i.e. the time offset plus duration of the last note in the phrase)

#instrumentChannels Source

instrumentChannels :: Array Instrument -> InstrumentChannels

create a map of instrument name to channel from an Instrument Array