Debian Codegraph @

examples/pvscross.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 pvscross.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 ; by Menno Knevel 2021, after an example by joachim heintz 2009
17
18 instr 1
19 ipermut = p4 ; 1 = change order of soundfiles
20 ifftsize = 1024
21 ioverlap = ifftsize / 4
22 iwinsize = ifftsize
23 iwinshape = 1 ; von-Hann window
24 Sfile1 = "oboe.aiff"
25 Sfile2 = "finneganswake1.flac"
26 ain1 = diskin2:a(Sfile1, .5, 0, 1)
27 ain2 = diskin2:a(Sfile2, 1, 0, 1) ; the wave plays 4 x faster and higher
28 fftin1 = pvsanal(ain1, ifftsize, ioverlap, iwinsize, iwinshape) ; fft-analysis of file 1
29 fftin2 = pvsanal(ain2, ifftsize, ioverlap, iwinsize, iwinshape) ; fft-analysis of file 2
30 ktrans = linseg(0, p3*.2, 0, p3*.6, p5, p3*.2, p5) ; transitions
31 if ipermut == 1 then
32 fcross = pvscross(fftin2, fftin1, ktrans, 1 - ktrans)
33 else
34 fcross = pvscross(fftin1, fftin2, ktrans, 1 - ktrans)
35 endif
36 aout = pvsynth(fcross)
37 outs(aout, aout)
38 endin
39
40 </CsInstruments>
41 <CsScore>
42 ; use only first portion of sample (=p5)
43 i 1 0 12.7 0 0 ; frequencies from the oboe, no transition
44 i 1 14 12.7 1 0 ; frequencies from the voice, no transition
45 ; transition over total sample (=p5)
46 i 1 28 12.7 0 1 ; frequencies from the oboe, amplitude transition from voice to oboe
47 i 1 42 12.7 1 1 ; frequencies from the voice, amplitude transition from oboe to voice
48 e
49 </CsScore>
50 </CsoundSynthesizer>