This package is a collection of functions and a very primitive language
level that follows the lead of Sonic Pi. Specifically, (like Sonic Pi)
it uses scsynth as its sound generation engine, and creates the same
network of units that Sonic Pi does.
This is very much a work in progress. I’m releasing it as a project
so that others can try it out and steal parts of it.
1 An Imperative Interfaceπ i
One thing that I don’t like that much about Sonic Pi is its unabashedly
imperative interface.
However, underneath what I hope will be a nice clean language (lsonic),
I’m also going to publish the lower-level imperative interface. For one
thing, it’s pretty obvious what it’ll look like: it’ll look like Sonic
Pi. That means less design work. Here are some functions:
Starts an scsynth, returns a context that can be used to ... well, to
create a job context.
( start-jobctxt)→job-context?
ctxt:context?
Given a context, starts a job, and return a handle for that job. A job
corresponds to a “piece of music.”
Ends a job: fades out the job and cancels all scheduled notes associated
with the job.
( play-notejob-ctxtnotetime)→void?
job-ctxt:job-context?
note:note?
Play note using job-ctxt, at time time, specified
in inexact milliseconds since the epoch. If the time value is less than
the current number of milliseconds since the epoch, the note will be played
immediately. (Note that this means that you can always specify 0.0 to
play a note immediately.)
( notesynth-namenote-numparam-part...)→note?
Creates a note. In addition to the synth-name and note-num (represented as a MIDI
note number), users may specify non-default values for one of many other parameters using and
interleaved parameter-name / value style. For instance:
(note"saw"78"attack"0.5"amp"0.5)
Here’s the full list of parameters and their defaults:
'((note_slide0)
(note_slide_shape5)
(node_slide_curve0)
(amp1)
(amp_slide0)
(amp_slide_shape5)
(pan0)
(pan_slide0)
(pan_slide_shape5)
(pan_slide_curve0)
(attack0)
(decay0)
(sustain0)
(release1)
(attack_level1)
(sustain_level1)
(env_curve2)
(out_bus12.0))