Would be nice to have a sequencer API available, so a few samples might be mixed at the same time.
val kickSample = 'K' to wav("dropbox://my-kick.wav")
val snareSample = 'S' to wav("dropbox://my-snare.wav")
val closedHiHatSample = 'h' to wav("dropbox://my-closed-hi-hat.wav")
val openedHiHatSample = 'H' to wav("dropbox://my-opened-hi-hat.wav")
val drumStream = """
K--- K--- K--- K---
--S- --S- --S- --S-
hhhh hhhh hhhh hhhH
""".sequencer(
bpm = 120,
kickSample, snareSample, closedHiHatSample, openedHiHatSample
)
val melodyStream = wav("dropbox://my-melody.wav")
drumStream * 0.8 + melodyStream // final mix
The sample is defined as a symbol (char) and then can be used in the sequence, it is triggered to play on defined bits per minute bpm rate. Different tracks are separated between each other by [\r\n], the predefined symbol - (dash) is used to mark the place where no samples is played, all white space symbols \s are ignored and whipped out before interpreting. Tracks are played in parallel, the same track samples are played sequentially.
The samples are mixed between each other and stacked if the same sample needs to start over, it is mixed with itself. The maximum value is defined by polyphony, by default 64. (To be defined better)
The sample is any stream, though only finite ones is recommended for use, in case of infinite stream on one track are got repeated they'll got stacked up to maximum polyphony preventing other samples to start.
The sequencer() call creates a sample stream which later can be used in another sequencer or to be mixed with audio tracks.
Would be nice to have a sequencer API available, so a few samples might be mixed at the same time.
The
sampleis defined as a symbol (char) and then can be used in the sequence, it is triggered to play on defined bits per minutebpmrate. Different tracks are separated between each other by[\r\n], the predefined symbol-(dash) is used to mark the place where no samples is played, all white space symbols\sare ignored and whipped out before interpreting. Tracks are played in parallel, the same track samples are played sequentially.The samples are mixed between each other and stacked if the same sample needs to start over, it is mixed with itself. The maximum value is defined by
polyphony, by default64. (To be defined better)The
sampleis any stream, though only finite ones is recommended for use, in case of infinite stream on one track are got repeated they'll got stacked up to maximumpolyphonypreventing other samples to start.The
sequencer()call creates a sample stream which later can be used in another sequencer or to be mixed with audio tracks.