diff options
Diffstat (limited to 'examples/lessequal.csd')
-rw-r--r-- | examples/lessequal.csd | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/examples/lessequal.csd b/examples/lessequal.csd index bc16838..2cac313 100644 --- a/examples/lessequal.csd +++ b/examples/lessequal.csd @@ -1,43 +1,41 @@ <CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform -; Audio out Audio in --odac -iadc ;;;RT audio I/O +-odac ;;;realtime audio out +;-iadc ;;;uncomment -iadc if realtime audio input is needed too ; For Non-realtime ouput leave only the line below: -; -o lessequal.wav -W ;;; for file output any platform +; -o <=.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> -; Initialize the global variables. sr = 44100 -kr = 44100 -ksmps = 1 -nchnls = 1 +ksmps = 32 +nchnls = 2 +0dbfs = 1 -; Instrument #1. instr 1 - ; Get the 4th p-field from the score. - k1 = p4 - ; Is it less than or equal to 3? (1 = true, 0 = false) - k2 = (p4 <= 3 ? 1 : 0) +kval randomh 0, 1.2, 20 ;choose between 0 and 1.2 - ; Print the values of k1 and k2. - printks "k1 = %f, k2 = %f\\n", 1, k1, k2 -endin +if kval >0 && kval<=.5 then ;3 possible outcomes + kvl = 1 +elseif kval >.5 && kval<=1 then + kvl =2 +elseif kval >1 then + kvl =3 +endif +printks "random number = %f, result = %f\n", .1, kval, kvl +asig poscil .7, 440*kvl, 1 + outs asig, asig +endin </CsInstruments> <CsScore> +f1 0 16384 10 1 -; Call Instrument #1 with a p4 = 2. -i 1 0 0.5 2 -; Call Instrument #1 with a p4 = 3. -i 1 1 0.5 3 -; Call Instrument #1 with a p4 = 4. -i 1 2 0.5 4 +i 1 0 5 e - - </CsScore> </CsoundSynthesizer> + |