| 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 |
instr 1 |
| 12 |
|
| 13 |
iamp = p4 ;amplitude scaler |
| 14 |
ifreq = p5 ;frequency scaler |
| 15 |
iatsfile = p7 ;atsfile |
| 16 |
itab = p6 ;audio table |
| 17 |
ifreqscal = 1 ;frequency scaler |
| 18 |
ipars ATSinfo iatsfile, 3 ;how many partials |
| 19 |
idur ATSinfo iatsfile, 7 ;get duration |
| 20 |
ktime line 0, p3, idur ;time pointer |
| 21 |
|
| 22 |
ATSbufread ktime, ifreqscal, iatsfile, ipars ;reads an ATS buffer |
| 23 |
kamp ATSinterpread ifreq ;get the amp values according to freq |
| 24 |
aamp interp kamp ;interpolate amp values |
| 25 |
aout oscil3 aamp, ifreq, itab ;synthesize |
| 26 |
|
| 27 |
out aout*iamp |
| 28 |
endin |
| 29 |
|
| 30 |
</CsInstruments> |
| 31 |
<CsScore> |
| 32 |
; sine wave table |
| 33 |
f 1 0 16384 10 1 |
| 34 |
#define atsfile #"test.ats"# |
| 35 |
|
| 36 |
; start dur amp freq atab atsfile |
| 37 |
i1 0 3 1 440 1 $atsfile ;first partial |
| 38 |
i1 + 3 1 550 1 $atsfile ;closer to first partial |
| 39 |
i1 + 3 1 660 1 $atsfile ;half way between both |
| 40 |
i1 + 3 1 770 1 $atsfile ;closer to second partial |
| 41 |
i1 + 3 1 880 1 $atsfile ;second partial |
| 42 |
e |
| 43 |
</CsScore> |
| 44 |
</CsoundSynthesizer> |
| 45 |
;example by Oscar Pablo Di Liscia |