Debian Codegraph @

examples/pvsbandwidth.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 ; Audio out Audio in
5 -odac ;;;RT audio I/O
6 ; For Non-realtime ouput leave only the line below:
7 ; -o pvsbandwidth.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 ksmps = 32
13 nchnls = 2
14 0dbfs = 1
15
16 ;; example written by joachim heintz 2009
17
18 giSine ftgen 0, 0, 4096, 10, 1
19
20 instr 1
21 irefrtm = p4; time for generating new values for the spectral centroid
22 ifftsize = 1024
23 ioverlap = ifftsize / 4
24 iwinsize = ifftsize
25 iwinshape = 1 ; von-Hann window
26 ;Sfile = "flute-C-octave0.wav"
27 Sfile = "fox.wav"
28 ain soundin Sfile
29 fftin pvsanal ain, ifftsize, ioverlap, iwinsize, iwinshape; fft-analysis of the audio-signal
30 ktrig metro 1 / irefrtm
31 if ktrig == 1 then
32 kcenter pvscent fftin; spectral center
33 kbw pvsbandwidth fftin; spectral center
34 printks2 "--**spectral center frequency = %f\n", kbw
35 endif
36 aout vco2 .2, 130
37 asig butterbp aout,kcenter,kbw
38 outs asig, asig
39 endin
40
41 </CsInstruments>
42 <CsScore>
43 i 1 0 2.757 .3
44 i 1 3 2.757 .05
45 i 1 6 2.757 .005
46 i 1 9 2.757 .001
47 e
48 </CsScore>
49 </CsoundSynthesizer>