THIS FILE SHOULD BE READ IN UTF-8 IT CONTAINS A FEW NON_STANDARD ASCII CHARACTERS: THE FOLLOWING EXAMPLES BELOW CAN BE CUT AND PASTED INTO SEPARATE FILES WITH AN .mc EXTENTION SHOULD ONE WANT TO TEST THEM. IF YOU TRY TO PARSE THIS FILE WITH MICROCSOUND IN IT'S ENTIRETY, YOU WILL GET ERRORS!!! a microcsound example: a scale, covering 3 octaves: 1: div=53 t=120 i=11 gr=5 gv=0.1 mix=1.0 c,d,e,f,g,a,b,cdefgabc'd'e'f'g'a'b'c'' || Here above we see the basic syntax. 'div=53' means 'set it up so that all symbols are interpreted within the framework of 53-equal division pitches per octave' 't=120' means 'set tempo to 120 beats per quarter note' 'i=11' means 'use the 11th instrument in the Csound orchestra file' "c," is an octave below middle-C, while "c'" is an octave above. Simply add commas or apostrophes to go even higher or lower. The special variables 'gr' and 'gv' stand for 'Gaussian rhythm' and Gaussian volume'...they are randomizing functions which add a bit of randomness to time and volume to humanize things....making these too high can make everything sound chaotic and drunk, so be aware....there is also a third variable 'gs', which is not seen here, but deals with variance in staccato length. Finally, 'mix' is a floating point amount of general volume, a best practice would be NOT to set this, it's 1 by default, but then if you don't like your mix, you should set this to be a value between 0 and 1 (although super soft instruments might benefit from going above one---but be careful and watch your ears!!!) You can also design intruments that can be used to 'play' (using the special case 'div=0' directive, see below) which are in fact 'dummy instruments' that might set up a ZAK mixer or set a global volume variable, which is useful if you get clipping and would like to normalize your whole mix. Using ZAK Csound opcodes for such purposes is beyond the scope of this document, but you can study the attached 'microcsound.orc' file and Csound documentation on ZAK for more details.... Here's a scale with ties, and accidentals: 1: div=19 t=100 i=2 1/4 c,2-c,d, | _e,^f,g,_a, | 1: 1/8 b,a,- a,b,- b,g,=a,b, | 1/4 c4 || Above we see a couple of new symbols: '1/4' means 'set default rhythm to quarter notes' (eight notes are assumed when there is no indication) the dash after a note indicates a tie, e.g. c,2-c, means "c below middle c for 2 beats tied to c below middle c for one beat, for a total of 3 beats" we also see basic accidentals: "^" is sharp (so "^f" is f-sharp) "_" is flat, and "=" is natural....you can also do double sharps and double flats ("^^" and "__") We also see that notes can be extended in length by numerical factors, e.g. "^c,,4" would mean "c-sharp, two octaves below middle-C, held for 4 counts of the current default length" Here's "mary had a little lamb", with polyphony illustrated: 1: div=31 t=96 i=1 1/4 (e d c d) | .e .e e2 | 2: div=31 1/8 c,3 .c, g,,2 g,,2 | 1/4 c, g, 1/8 c,b,,c,2 | # 1: 1/4 d d d2 | e g g2 | 2: 1/8 g,2 zg, g,,2a,,b,, |1/4 c,g,c,g,,| # 1: 1/4 (e d c d) | .e .e e2 | 2: 1/8 c,3 .c, g,2 g,,2 | 1/4 c, g, 1/8 c,b,,c,a,, | # 1: 1/4 d d e d | c3 z &-4 z [f,a,] [e,g,] z || 2: 1/4 g,,g,, 1/8 g,,a,,b,,g,, | f,,a,,c,z || Note at the beginning of each line a voice number, eg '1:' or '2:' this indicates polyphony, or simultaneous voice strands. Vertical bars are barlines, and are optional for legibility, they are ignored. also, '#' is for comments or to keep things visually less cluttered, and are ignored. A dot before a note is a staccato example: ".c", and a '(' before a note (must come before any accidentals, too) means 'legato', and holds until the next ')', which comes immediately after a note (and must come after any note lengths and/or tie dashes. As shown above, one can use 'z2' (or 'r2' as we will see below) for a rest of 2 quarters. Note that one might wish to use 'z' instead of 'r' in this scenario, even thought both are legal, to be compatible with abcm2ps, you would use 'z', as it would require less hand massaging should one want to produce a printed score. Two special features are shown in the last measure of 'mary had a little lamb': timestamping and chords. If you look at the symbol '&-4', the '&' means 'also play this', and the '-4' means 'four beats earlier than the current beat timestamp, meaning 'go back four beats and add the following' in effect, this allows one to stuff extra counterpoint strands in w/o having to write another line of music, convenient for textures where the true number of simultaneous strands is changing a lot. Chords are indicated by brackets e.g. [ceg] would be a C major triad, [c2e2g2] would be the same but twice the length of the current default beat length, [c,2e2g'2] would be the same, but twice the length, and the c would be an octave lower than middle c, and the g would be an octave higher. We saw ties in the first two examples. Ties come after the note and any length alterations. In general, a note event is in the following order: [articulation][accidental(s)]lettername[octave][length][tie indicator] the only one in letter-style entry that is not optional is the lettername some examples to show the trend: c ^c,2 _e'3 __g- ^^d2- __ is a double flat ^^ is a double sharp microtonal alterations: / is up a syntonic (81/80) comma \ is down a syntonic (81/80) comma > is up a septimal (64/63) comma < is down a septimal (64/63) comma ! is up an undecimal (33/32) comma ¡ is down an undecimal (33/32) comma ### upside down exclamation point ? is up a tridecimal (1053/1024) comma ¿ is down a tridecimal (1053/1024) comma example: 1: div=53 i=11 c\eg\e | g<_bc'<_b | c'4 || this would be a passage illustrating a pure 7/4 within 53-equal b/c the 'b' is altered flat AND is lowered by 64/63 with a '<' also notice the pure 5/4 b/c of the use f '\' before the 'e' accidentals can be placed in any order before the letter they alter, but they must be BEFORE...... a final thing before showing the 2nd style of entering notes...one can use a "meantone" type tuning like 31-equal and request pure fifths by using a "*" symbol AFTER the letter for the note you want to make pure, e.g. 1: div=31 i=11 [_c_e_g*] ....would be a c-flat major chord, and the g-flat would be a pure fifth with the c-flat....in this way, one can do adaptive just intonation style music while staying in the comfort of fewer pitches, for example writing just intonation from within the structure of 31-equal. ########################## NOW, AN ENTIRELY DIFFERENT WAY OF DOING THINGS: ________________________________________________ "mary had a little lamb": 1: div=31 t=96 i=1 1/8 5.10 t 5 t 0 t 5 r | 10 t 10 t 10 t t r | 2: div=31 4.0 r r 0 -13 t -13 t | 0 t -13 t 0 -3 0 5 | 1: 5 t 5 t 5 t t t | 10 t .18 r 18 t t t | 2: 18 z z -13 18 13 10 5 | 0 t r 0 .-13 -8 .-13 .-3 | 1: (10 t 5 t 0) t .5 t | 10 t 10 t 10 t 10 t | 2: 0 r r 0 -13 t -13 t | 0 t -13 t 0 5 10 13 | 1: 5 t 5 t 10 t 5 t | 0 t t t 0 r r r &-8 r r [-18 t -8 t] [.-21 .-13] r r r || 2: 18 r -13 r .-13 .-8 .-3 .-13 | 0 t -18 t .0 r r r || This is the oldest style 'number syntax' I developed. It really is a low-level way of doing things, but it's useful for non-diatonic music in non-diatonic tunings. It's also laid out in a way to be a sort of 'grid'-like in it's representation of time, think of it as a text-based sequencer or tracker way of thinking about writing music. Basically, a note is defined by its index (from 0) in a division of the octave, from middle C being 5.0, C above Middle-C being 6.0, etc. So in 31 equal, a Major scale would be: 1: div=31 i=11 0 5 10 13 18 23 28 31 or 1: div=31 i=11 5.0 5 10 13 18 23 28 6.0 coming down from middle C, we could do: 1: div=31 i=11 5.0 -3 -8 -13 -18 -21 -26 -31 or 1: div=31 i=11 5.0 4.28 23 18 13 10 5 0 notice that octaves get 'held' by default until they are explicitly changed...also notice one can index degrees of an octave below the reference 'C' by using negative numbers. You can even use non-octave based scales (not tested extensively, however, please report any bugs to me) by using an non-integer 'div' like e.g. 'div=31.1' for instance. RATIONAL NOTATION ___________________ Since version 20090813, there is now the added feature of being able to do free-style rational pitch notation for things like just intonation, and exploring the overtone and undertone series. Everything is relative to middle_C = 261 HZ, and one indicates a pitch in rational form with colons, since the normal '/' is already taken by rhythmic length default indicators. So, for example: 1: t=60 i=11 1:1 2:1 4:1 1:1 1:2 1:4 this above example would be a series of 'c' octaves....to make them 'd' octaves, we could do: 1: t=60 i=11 key=9:8 1:1 2:1 4:1 1:1 1:2 1:4 or 1: t=60 i=11 key=1:1 9:8 18:8 36:8 9:8 9:16 9:32 which are exact sonic equivalents, but the use of 'key=' makes conceptualizing modulation much easier to handle. So now things are relative to a 9/8 ratio above middle-C...notice that when the denominator is greater than the numerator, we are going BELOW middle-C in pitch. We of course can do traids and chord, from simple to exotic: 1: 1:1 5:4 3:2 2:1 t t ...a major triad arpeggio, w/octave at top held for two extra beats 1: [1:1 5:4 3:2 2:1] ...the same, played as a block chord 1: [33:32 37:32 41:32 45:32] an isoharmonic sonority, built in reference to the 33rd harmonic (otonal) 1: [76:76 76:66 76:56 76:46] a similar structure, but using an subharmonic (utonal) sequence. ATTACK AND PANNING _________________________ Another feature to note: panning and attack volume: PANNING: 1: div=31 i=11 pan=0.3 0 pan=0.9 5 pan=0.3 10 pan=0.9 13 pan=0.5 18 t ATTACK VOLUME: # old way: 1: div=31 i=11 @0.2 0 @0.4 5 @0.6 10 @0.8 13 @0.9 18 t # or new way: 1: div=31 i=11 @2 0 @4 5 @55 10 @8 13 @9 18 t I'm using numbers for notes, but letters work equally well, i.e. attack and pan are available for either style; just make sure to surround the 'pan=nnn' and '@nnn' statements with whitespace! In the 'new way' above, '@2' is the same is '@20', so when your 2nd digit is '0' in the range 0-99, you can just write the first digit.... (NEW to note in version >= 20091218: pans and attack are floating point values between 0 and 1) (NEW to note in version >= 20141010: the new preferred way to do attacks is '@xx', where xx is in the range 00-99.) Since ramping is supported, one can use that in attacks to create crescendos (or decrescendos), as long as the ramp has a start and ending value: 1: div=19 i=11 @2 0 @< 3 6 8 11 14 17 @87 19 t t t r r r In this example above, we start at volume 20 (out of 99), initiate a ramp symbol indicating a crescendo, and end at volume 87 (out of 99). When using ramping with 'pan', due to the nature of the way microcsound parses, one has to surround the ramp symbol with double quotes, like so: pan="<" In all other respects, it works in the same way that attack ramping works. PEDALLING (new in version 20141010) __________ If you want to sustain every tone until some known lift end point, N beats away, you can use the marker 'PDxxx' where 'xxx' is equal to the number of default/set beats, followed by a 'PU' as a reminder that the beats are lifted. For example: 1: div=17 i=11 PD3 c e g PU c' g e c3 This will have the effect of sustaining the arpeggio c e g until it hits the top octave (c'), and afterwards, will come down in a normal 'dry' legato. CSOUND SPECIFIC DOCUMENTATION--HOW IT WORKS ____________________________________________ Assuming you know Csound, what's happening is that the score fields p4 and above are being manipulated by microcsound depending on the microcsound-score you type in. Remember, in Csound, p1,p2 & p3 are reserved for instrument number, on time, and duration. So p4 and above are user-defined and open to the instrument designer. However, in order to make you instruments compatible with microcsound, you need to make p4 correspond to attack/volume, p5 is pitch expressed in octaves (your instruments should interpret the output of microcsound with the 'cpsoct' opcode), p6 with pan position, p7 is mix volume (a floating-point number between 0 & 1) and any other p-field can be freely accessed by the syntax explained below.... So, if you have a Csound instrument with extra parameters beyond note, volume, and spatial panning, (i.e. you want to access p8 and above) you can access them within quotes, separated the individual p-fields by '%' characters: 1: div=19 i=6 ".01%.01%3%.3" 0 3 ".8%.02%3%.5" 6 t t t r r r Here we have an instrument (number 6 because i=6) which has 4 extra p-fields; in this case, p8 is attack time, p9 is release time, p10 is waveform number, and p11 is pulse width. The "%" characters are necessary because of the way the parsing of the file is done by microcsound, you can see in the score-file which is output by microcsound that they are replaced by spaces. One could easily then modify things, depending on your instrument design, like filter frequency, resonance, the sky's the limit! Finally, one can disable the 'interpretation' of the note number as a pitch at all by using 'div=0'; this is useful for instruments which are percussive on a single note or pitch parameter, like a drum, or a Csound 'instrument' which is not a conventional instrument at all, but an effect such as reverb or delay, etc. In other words, one could design instruments in which p5 was not corresponding with pitch. Likewise, although p4 is accessed with '@' and p6 with 'pan=' there is no reason one couldn't use other numbers there for other purposes, should your instrument need it. But the best practice for the purposes of using non-pitch instruments like percussion and effects within orchestras with microcsound would be to make these fields 'dummy fields' and use p5 and above for sure. The way it is designed, in fact, p5 of some sort is necessary for an event to register at all and for time to progress in the time-counter of the score. So if your special instrument required only one parameter, make sure it's p5 using div=0 that is used at the very least--make p4 a 'dummy parameter' by having your instrument ignore p4 in that case.. So for example, we might use a drum instrument, like the one supplied, which allows bass-drum/snare/symbal patterns from one line: 1: div=0 t=120 i=120 0 1 0 1 | 0 1 0 1 &-8 1/8 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Well, that should cover it.... Enjoy microcsound! for bugs or questions contact Aaron Krister Johnson