Debian Codegraph @

examples/pvcross.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac -m0 ;;;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 pvcross.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 ; by Menno Knevel 2021
17
18 gilen1 filelen "flutec3.wav" ; get length of soundfiles
19 gilen2 filelen "flute.aiff" ; these files are all
20 gilen3 filelen "wave.wav" ; around 2.7 seconds...
21
22 ; analyze sound files and output results to pvoc-ex files
23 ires1 system_i 1,{{ pvanal flutec3.wav flutec3.pvx }} ; use default settings
24 ires2 system_i 1,{{ pvanal flute.aiff flute.pvx }}
25 ires3 system_i 1,{{ pvanal wave.wav wave.pvx }}
26
27 instr 1 ; untreated signals
28 asig diskin2 p4 , 1
29 print gilen1
30 print gilen2
31 print gilen3
32 prints "\n---***YOU NOW HEAR THE UNTREATED SOUND SAMPLES***---\n"
33 outs asig, asig
34 endin
35
36 instr 2
37
38 prints "\n---***YOU NOW HEAR THE RESULT OF THE ANALYZED FILES:***---\n"
39 ktime1 line 0, p3, gilen1 ; timepointer in "flutec3.pvx" file
40 kcross expon 0.001, p3, 1
41 pvbufread ktime1, "flutec3.pvx" ;take only amplitude from "flute3c.pvx"
42
43 if p4 = 0 then
44 ktime2 line 0, p3, gilen2 ; timepointer in "flute.pvx"
45 kfreq line .5, p3, 2 ; frequency rise
46 asig pvcross ktime2, kfreq, "flute.pvx", 1-kcross, kcross, p5 ;p5 = preserve spectral envelope
47 prints "--** preserve spectral envelope = %d **--\n", p5
48 else
49 ktime2 line 0, p3, gilen3 ; timepointer in "wave.pvx"
50 kfreq line .5, p3, 2 ; frequency rise
51 asig pvcross ktime2, kfreq, "wave.pvx", 1-kcross, kcross, p5 ;p5 = preserve spectral envelope
52 prints "--** preserve spectral envelope = %d **--\n", p5
53 endif
54 outs asig, asig
55
56 endin
57 </CsInstruments>
58 <CsScore>
59 s
60 i1 0 2.76 "flutec3.wav" ; this is the file to cross with
61 i1 3 2.62 "flute.aiff" ; this one, or..
62 i1 6 2 "wave.wav" ; this one
63
64 s; sample formant ; all slowed down to have a good listen
65 i2 0 10 0 0 ; cross flutec3 with the flute, do not preserve formants
66 i2 10 10 1 0 ; cross flutec3 with wave, do not preserve formants
67 s; sample formant
68 i2 0 10 0 1 ; cross flutec3 with the flute & preserve formants
69 i2 10 10 1 1 ; cross flutec3 with wave & preserve formants
70 e
71 </CsScore>
72 </CsoundSynthesizer>