examples/counter.csd
raw| 1 | <CsoundSynthesizer> |
| 2 | <CsOptions> |
| 3 | -odac -Mhw:1,0,0 |
| 4 | </CsOptions> |
| 5 | |
| 6 | <CsInstruments> |
| 7 | gicnt cntCreate 1 ; a toggle |
| 8 | gicntNote cntCreate 1 ; ignore note-off message to turn MIDI notes into toggles |
| 9 | |
| 10 | |
| 11 | instr 1 |
| 12 | |
| 13 | kkey sensekey |
| 14 | |
| 15 | inote notnum |
| 16 | |
| 17 | if (kkey == 97) then |
| 18 | k1 count gicnt |
| 19 | if k1==0 then |
| 20 | event "i", 2, 0, -1 |
| 21 | else |
| 22 | event "d", 2, 0, -1 |
| 23 | endif |
| 24 | endif |
| 25 | |
| 26 | print inote |
| 27 | if (inote == 60) then |
| 28 | i2 count_i gicntNote |
| 29 | print i2 |
| 30 | if i2==0 then |
| 31 | event_i "i", 3, 0, -1 |
| 32 | else |
| 33 | event_i "d", 3, 0, -1 |
| 34 | endif |
| 35 | endif |
| 36 | endin |
| 37 | |
| 38 | instr 2 |
| 39 | asig oscil 10000, 440 |
| 40 | out asig |
| 41 | endin |
| 42 | |
| 43 | instr 3 |
| 44 | asig oscil 5000, 880 |
| 45 | out asig |
| 46 | endin |
| 47 | |
| 48 | </CsInstruments> |
| 49 | |
| 50 | |
| 51 | <CsScore> |
| 52 | i1 0 z |
| 53 | e |
| 54 | |
| 55 | </CsScore> |
| 56 | |
| 57 | </CsoundSynthesizer> |