Debian Codegraph @

src/Examples/FLOSS Manual Examples/05 Sound Modification/05K03_atsread2.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -o dac
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 32
8 nchnls = 1
9 0dbfs = 1
10
11 gS_ATS_file = "flute-A5.ats" ;ats file
12 giSine ftgen 0, 0, 16384, 10, 1 ; sine wave table
13
14
15 instr Master ;call instr "Play" for each partial
16 iNumParts = p4 ;how many partials to synthesize
17 idur ATSinfo gS_ATS_file, 7 ;get ats file duration
18
19 iAmps[] array 1, .1 ;array for even and odd partials
20 iParts[] genarray 1,iNumParts ;creates array [1, 2, ..., iNumParts]
21
22 indx = 0 ;initialize index
23 ;loop for number of elements in iParts array
24 until indx == iNumParts do
25 ;call an instance of instr "Play" for each partial
26 event_i "i", "Play", 0, p3, iAmps[indx%2], iParts[indx], idur
27 indx += 1 ;increment index
28 od ;end of do ... od block
29
30 turnoff ;turn this instrument off as job has been done
31 endin
32
33 instr Play
34 iamp = p4 ;amplitude scaler
35 ipar = p5 ;partial required
36 idur = p6 ;ats file duration
37
38 ktime line 0, p3, idur ;time pointer
39
40 kfreq, kamp ATSread ktime, gS_ATS_file, ipar
41 aamp interp kamp ;interpolate amplitude values
42 afreq interp kfreq ;interpolate frequency values
43 aout oscil3 aamp*iamp, afreq, giSine ;synthesize with amp scaling
44
45 out aout
46 endin
47 </CsInstruments>
48 <CsScore>
49 ; strt dur number of partials
50 i "Master" 0 3 1
51 i . + . 3
52 i . + . 10
53 </CsScore>
54 </CsoundSynthesizer>
55 ;example by Oscar Pablo Di Liscia and Joachim Heintz