| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in No messages |
| 5 |
-odac -iadc -d -m0 ;;;RT audio I/O |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o rms.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
; Initialize the global variables. |
| 12 |
sr = 44100 |
| 13 |
ksmps = 128 |
| 14 |
nchnls = 1 |
| 15 |
|
| 16 |
;Example by Andres Cabrera 2007 |
| 17 |
|
| 18 |
0dbfs = 1 |
| 19 |
|
| 20 |
FLpanel "rms", 400, 100, 50, 50 |
| 21 |
gkrmstext, gihrmstext FLtext "Rms", -100, 0, 0.1, 3, 110, 30, 60, 50 |
| 22 |
gkihp, gihandle FLtext "ihp", 0, 10, 0.05, 1, 100, 30, 220, 50 |
| 23 |
gkrmsslider, gihrmsslider FLslider "", -60, -0.5, -1, 5, -1, 380, 20, 10, 10 |
| 24 |
|
| 25 |
FLpanelEnd |
| 26 |
FLrun |
| 27 |
|
| 28 |
|
| 29 |
FLsetVal_i 5, gihandle |
| 30 |
; Instrument #1. |
| 31 |
instr 1 |
| 32 |
a1 inch 1 |
| 33 |
|
| 34 |
label: |
| 35 |
kval rms a1, i(gkihp) ;measures rms of input channel 1 |
| 36 |
rireturn |
| 37 |
|
| 38 |
kval = dbamp(kval) ; convert to db full scale |
| 39 |
printk 0.5, kval |
| 40 |
FLsetVal 1, kval, gihrmsslider ;update the slider and text values |
| 41 |
FLsetVal 1, kval, gihrmstext |
| 42 |
knewihp changed gkihp ; reinit when ihp text has changed |
| 43 |
if (knewihp == 1) then |
| 44 |
reinit label ;needed because ihp is an i-rate parameter |
| 45 |
endif |
| 46 |
endin |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
</CsInstruments> |
| 51 |
<CsScore> |
| 52 |
|
| 53 |
; Play Instrument #1 for one minute |
| 54 |
i 1 0 60 |
| 55 |
e |
| 56 |
|
| 57 |
|
| 58 |
</CsScore> |
| 59 |
</CsoundSynthesizer> |