Debian Codegraph @

src/Examples/FLOSS Manual Examples/03 Csound Language/03E07_pvs_to_from_array.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -o dac
4 </CsOptions>
5 <CsInstruments>
6
7 sr = 44100
8 ksmps = 32
9 nchnls = 2
10 0dbfs = 1
11
12 gifil ftgen 0, 0, 0, 1, "fox.wav", 0, 0, 1
13
14 instr FFT_HighPass
15 ifftsize = 2048 ;fft size set to pvstanal default
16 fsrc pvstanal 1, 1, 1, gifil ;create fsig stream from function table
17 kArr[] init ifftsize+2 ;create array for bin data
18 kflag pvs2array kArr, fsrc ;export data to array
19
20 ;if kflag has reported a new write action ...
21 if changed(kflag) == 1 then
22 ; ... set amplitude of first 40 bins to zero:
23 kndx = 0
24 while kndx <= 80 do
25 kArr[kndx] = 0
26 kndx += 2 ;change only even array index = bin amplitude
27 od
28 endif
29
30 fres pvsfromarray kArr ;read modified data back to fres
31 aout pvsynth fres ;and resynth
32 out aout, aout
33
34 endin
35 </CsInstruments>
36 <CsScore>
37 i "FFT_HighPass" 0 2.7
38 </CsScore>
39 </CsoundSynthesizer>
40 ;example by joachim heintz