Quick Start Tutorial
Make an Instrument, patch it to the output, and send an event.
| Beep | |
|---|---|
patchsig line, then the schedule event.
You should hear go beep.
What just happened?
-
We used a named Instrument, instead of a number.
- cslc uses named instruments for patching audio.
-
We used the
sendUDO.- This sends audio to a global audio array.
- Note that we didn't need to worry about audio channels.
patchsigassumes all source channels will be sent to all destination inputs. For example, a mono source to a stereo destination copies the source to both inputs.
-
We used
patchsigto connect the instrument to the output.patchigretrieves the audio from the global audio array, and routes it to a destination.
gi_CurrentScale and pitch conversion
In the schedule event, we used a pitch conversion function, cpstuni, to convert '0' into a frequency value. The pitch lookup table was gi_Current_scale, which is a global table included in cslc.
By default this table is set to a 7 note diatonic major scale in 31edo beginning with 0 on middle C (261.625565 hz). This means the octave above is numbered 7, the octave below is -7.
Many of the event generation UDO's use cpstuni internally, so this pitch conversion is automatic.
See the reference documentation for scalemode
Loops
Setting up a repeating loop is a common process when live coding. Lets see what this could look like:
Using loopevent
loopevent takes three arrays and an on/off switch.
The first array looks a lot like the scheduled event we had earlier. We've filled the array with pfields we used for schedule.
See the reference documentation for loopevent
-
loopeventuses arrays, the first of which has all the pfields of a score event. -
Because these are numerical arrays, for p1 we wrap the string "myoscil" with n("myoscil").
nis just a wrapper for the Csound opcode nstrnum which returns the instrument number. -
For p5,
cpstuniis not required to convert the pitch. loopevent usescpstuniinternally.loopeventalso converts p2, and p3 for tempo changes. p4 assumes 0dbfs=1 -
fillarray_iis a version of fillarray that runs at init-time when used in inline code.
The second array specifies pitches in a scale called gi_CurrentScale.
The third array is an array of rhythmic intervals. In this case, a single repetitive note every 0.5 beats.
Finally, '1' at the end turns the loop on or off.
Practice Livecoding
Try changing the values in the loopevent arrays, then re-evaluate to see the effect.
What next?
Start going through the topics. You will find an example at the bottom of almost every page. Try copying the examples into your editor, evaluating them, and then modifying them to see what happens.
The topics are reference pages like a manual, but they also introduce concepts in cslc in a rough order, starting with time and tempo, scales and tuning, to more advanced examples in event generation and patching.