Debian Codegraph @

examples/pvsbufread.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 pvsbufread.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 ; additions by Menno Knevel 2021
18
19 opcode FileToPvsBuf, iik, Siiiii
20 ;;writes an audio file at the first k-cycle to a fft-buffer (via pvsbuffer)
21 Sfile, ifftsize, ioverlap, iwinsize, iwinshape, ilength xin
22 ktimek timeinstk
23 if ktimek == 1 then
24 ilen filelen Sfile
25 kcycles = ilen * kr; number of k-cycles to write the fft-buffer
26 kcount init 0
27 loop:
28 ain soundin Sfile
29 fftin pvsanal ain, ifftsize, ioverlap, iwinsize, iwinshape
30 ibufln = ilen + (ifftsize / sr)
31 ibuf, ktim pvsbuffer fftin, ibufln
32 loop_lt kcount, 1, kcycles, loop
33 xout ibuf, ilen, ktim
34 endif
35 endop
36
37
38 instr 1
39 ifftsize = 1024
40 ioverlap = ifftsize / 4
41 iwinsize = ifftsize
42 iwinshape = 1; von-Hann window
43 ilength = p4
44 ibuffer, ilen, k0 FileToPvsBuf "drumsMlp.wav", ifftsize, ioverlap, iwinsize, iwinshape, ilength
45 ktmpnt linseg ilen, p3, 0 ; reads the buffer backwards in p3 seconds
46 fread pvsbufread ktmpnt, ibuffer, p4, p5 ; use the filter options
47 aout pvsynth fread
48 outs aout, aout
49 endin
50
51 </CsInstruments>
52 <CsScore>
53 ; low high
54 i 1 0 5 100 1000 ; filter to this range
55 i 1 5 5 1000 10000 ; ...and to this range
56 i 1 10 5 0 0 ; no filtering, equal to not using ilo and ihi at all!
57 e
58 </CsScore>
59 </CsoundSynthesizer>