Debian Codegraph @

examples/pvsmorph2.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 pvsmorph-2.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, additions by Menno Knevel 2021
17 ; this example uses the files "flute.aiff" and "saxophone-alto-C-octave0.wav"
18
19 instr 1
20
21 iampint1 = p4 ; value for interpolating the amplitudes at the beginning ...
22 iampint2 = p5 ; ... and at the end
23 ifrqint1 = p6 ; value for unterpolating the frequencies at the beginning ...
24 ifrqint2 = p7 ; ... and at the end
25 kampint linseg iampint1, p3, iampint2
26 kfrqint linseg ifrqint1, p3, ifrqint2
27 ifftsize = 1024
28 ioverlap = ifftsize / 4
29 iwinsize = ifftsize
30 iwinshape = 1 ; von-Hann window
31 Sfile1 = "flute.aiff"
32 Sfile2 = "saxophone-alto-C-octave0.wav"
33 ain1 soundin Sfile1
34 ain2 soundin Sfile2
35 fftin1 pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape
36 fftin2 pvsanal ain2, ifftsize, ioverlap, iwinsize, iwinshape
37 fmorph pvsmorph fftin1, fftin2, kampint, kfrqint
38 aout pvsynth fmorph
39 outs aout , aout
40 endin
41
42 instr 2 ; moving randomly in certain borders between two spectra
43
44 iampintmin = p4 ; minimum value for amplitudes
45 iampintmax = p5 ; maximum value for amplitudes
46 ifrqintmin = p6 ; minimum value for frequencies
47 ifrqintmax = p7 ; maximum value for frequencies
48 imovefreq = p8 ; frequency for generating new random values
49 kampint randomi iampintmin, iampintmax, imovefreq
50 kfrqint randomi ifrqintmin, ifrqintmax, imovefreq
51 ifftsize = 1024
52 ioverlap = ifftsize / 4
53 iwinsize = ifftsize
54 iwinshape = 1 ; von-Hann window
55 Sfile1 = "flute.aiff"
56 Sfile2 = "saxophone-alto-C-octave0.wav"
57 ain1 soundin Sfile1
58 ain2 soundin Sfile2
59 fftin1 pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape
60 fftin2 pvsanal ain2, ifftsize, ioverlap, iwinsize, iwinshape
61 fmorph pvsmorph fftin1, fftin2, kampint, kfrqint
62 aout pvsynth fmorph
63 outs aout, aout
64 endin
65
66 </CsInstruments>
67 <CsScore>
68 i 1 0 3 0 0 1 1 ; amplitudes from flute, frequencies from saxophone
69 i 1 3 3 1 1 0 0 ; amplitudes from saxophone, frequencies from flute
70 i 1 6 3 0 1 0 1 ; amplitudes and frequencies moving from flute to saxophone
71 i 1 9 3 1 0 1 0 ; amplitudes and frequencies moving from saxophone to flute
72
73 i 2 13 3 .2 .8 .2 .8 10 ; amps and freqs moving randomly between the two spectra
74 e
75 </CsScore>
76 </CsoundSynthesizer>