Debian Codegraph @

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

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -o dac
4 </CsOptions>
5 <CsInstruments>
6
7 sr = 44100
8 ksmps = 32
9 nchnls = 1
10 0dbfs = 1
11
12 ;Some macros
13 #define NB # 25 # ;number noise bands
14 #define ATS_DU # 7 # ;duration
15
16 instr 1
17 /*read some ATS data from the file header*/
18 iatsfile = p8
19 i_duration ATSinfo iatsfile, $ATS_DU
20
21 iamp = p4 ;amplitude scaler
22
23 /*here we deal with number of partials, offset and increment issues*/
24 inb = (p5 < 1 ? $NB : p5) ;inb can not be <=0
25 ibofst = (p6 < 0 ? 0 : p6) ;band offset cannot be < 0
26 ibincr = (p7 < 1 ? 1 : p7) ;band increment cannot be <= 0
27 imax = ibofst + inb*ibincr ;max. bands allowed
28
29 if imax <= $NB igoto OK
30 ;if we are here, something is wrong!
31 ;set nb to zero, so as the output will be zero and the user knows
32 print imax, $NB
33 inb = 0
34 ibofst = 0
35 ibincr = 1
36 OK: ;data is OK
37 /********************************************************************/
38 ktime linseg 0, p3, i_duration
39 asig ATSaddnz ktime, iatsfile, inb, ibofst, ibincr
40
41 out asig*iamp
42 endin
43
44 </CsInstruments>
45 <CsScore>
46
47 ;change to put any ATS file you like
48 #define ats_file #"female-speech.ats"#
49
50 ; start dur amp nbands bands_offset bands_incr atsfile
51 i1 0 7.32 1 25 0 1 $ats_file ;all bands
52 i1 + . . 15 10 1 $ats_file ;from 10 to 25 step 1
53 i1 + . . 8 1 3 $ats_file ;from 1 to 24 step 3
54 i1 + . . 5 15 1 $ats_file ;from 15 to 20 step 1
55
56 e
57 </CsScore>
58 </CsoundSynthesizer>
59 ;example by Oscar Pablo Di Liscia