Debian Codegraph @

examples/pvsfread-2.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac ;;;realtime audio out
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o pvsfread-2.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 ksmps = 32
13 0dbfs = 1
14 nchnls = 2
15
16 instr 1 ; play and analyze sound file, but one channel only
17
18 idur filelen "stereoJungle.wav" ; check duration of sample
19 prints "\nsound file duration = %f\n", idur
20 ichn filenchnls "stereoJungle.wav" ; check channels- a stereo sound!
21 prints "number of channels = %f\n\n", ichn
22
23 asigL, asigR diskin2 "stereoJungle.wav" ; stereo sound file
24 fss pvsanal asigR, 1024, 256, 1024, 0 ; choose which channel- here the Right channel
25 pvsfwrite fss, "stereoJungle.pvx" ; write that analyzed channel to pvocex file
26 ase pvsynth fss ; lets hear it
27 outs ase, ase
28
29 endin
30
31 instr 2 ; must be called after instr 1 finishes
32
33 prints "\n--**analyzed file is played back**--\n\n"
34 idur filelen "stereoJungle.pvx" ; find duration of (stereo) analysis file
35 kpos line 0,p3,idur ; to ensure we process whole file
36 fsigr pvsfread kpos,"stereoJungle.pvx", 0 ; read the fsig from this (= Right) channel
37 aout pvsynth fsigr ; resynthesise it
38 outs aout, aout
39
40 endin
41 </CsInstruments>
42 <CsScore>
43 s
44 i 1 0 7
45 s
46 i 2 0 7
47 i 2 8 4 ; faster
48 e
49 </CsScore>
50 </CsoundSynthesizer>