Csound Csound-dev Csound-tekno Search About

[Csnd] different amplitude values for additive synthesis

Date2009-04-08 22:17
FromStefan Thomas
Subject[Csnd] different amplitude values for additive synthesis
Attachmentskleinedezimedurch11.cps  
Dear community,
in the below quoted example, I would like to change the character of
the instrument, depending of the pitch and the
key velocity.
The louder I play, I would like to increase the "ilautfaktor", and the
also the lower the notes are, the "ilautfaktor" should increase too.
How could I do this?
Thanks for Your patience,
Stefan



 -odevaudio -M1 -b400 ; -+rtaudio=jack -i adc -o dac; fuer realtime-Midi



sr     = 44100
kr     = 2205
ksmps  = 20
nchnls = 2
 ipch = 8.02
  iequal = 12



massign    0, 1              ; assign all midi events to instr 1,
pgmassign  0, 1              ; also all program changes
instr 1
 gasend1 init 0
 gasend2 init 0
 ituningtable = 10         ; the number of the f-table

 imnn    notnum
 indx    =  imnn * 2 + 1   ; values in table alternate between
                           ; Midi note nums and frequencies
 icps    table  indx, ituningtable
  iamp    ampmidi    	1000
inach = 0.00001
iend = 0.0000000001 ; für alle die gleiche Endlautstärke

; die  Einschwingzeit für jeden Teilton
iein = 0.0030
;die unterschiedlichen ausschwingzeiten
iabkling1 = 4.5*2
iabkling2 = 7.22*2
iabkling3 = 9.26*2
;die anfangslautstaerke
ianfang = 0.001
;wie laut klingt der Ton am Ende, nach dem loslassen der Note
iweiterkling = 0.00000000000001

;die anfangslautstaerke
ianfang = 0.001
;wie laut klingt der Ton am Ende, nach dem loslassen der Note
iweiterkling = 0.00000000000001
;die unterschiedlichen Maxima der Hüllkurven
ilautfaktor = 0.85

imax1 = 1
imax2 = ilautfaktor
imax3=ilautfaktor^2
imax4 = ilautfaktor^3
;and so on
;die Individuellen Hüllkurven für jeden einzelnen Teilton
kenv1 expsegr ianfang, iein, imax1, 	iabkling1,  	iend,  inach, iweiterkling
kenv2 expsegr ianfang, iein, imax2, 	iabkling2,  	iend,  inach, iweiterkling
kenv3 expsegr ianfang, iein, imax3, 	iabkling3,  	iend,  inach, iweiterkling
;die Frequenzverhältnisse
iratio = 1.08284091791636825817 ; 11te Wurzel aus 12/5
ifundamental = icps
ipartialB =icps;Teilton 1
ipartialC = icps*iratio^11 ;Teilton 2
;die einzelnen Teiltöne mit ihrer dazu gehörigen Hüllkurve
a1    oscil   kenv1*iamp, ifundamental,	1
a2    oscil   kenv2*iamp, ipartialB, 	1
a3    oscil   kenv3*iamp, ipartialC, 	1
aton = a1+a2+a3

outs aton, aton
gasend1 = gasend1+aton
gasend2 = gasend2+aton
    endin
  instr 2 ;RECORDS ALL SOUND
;RECORD A Stereo 16 BIT SOUND FILE
fout    "dezimengong.wav", 4, gasend1, gasend2
;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
gasend1 = 0
gasend2 = 0
endin


; die Partiturereignisse werden definiert

f1  0   8193  10   1
f 10  0 256 -23 "kleinedezimedurch11.cps"

t 0 30 ; keine Ahnung, was das heißt

i1   0    3600
i2   0    3600




Date2009-04-09 00:19
FromIain McCurdy
Subject[Csnd] RE: different amplitude values for additive synthesis
Hi Stefan,

I think you are interested in changing the tone of your sound with key velocity and MIDI note number. Perhaps filters are the way to go? You could try some code like this:

;'oct' format is used to give a linear mapping between velocity (and note number) and pitch in octaves
;velocity controlled tone control
icutoff_oct  veloc  6, 14
;lowpass filter our audio signal
asig tone asig, cpsoct(icutoff_oct)

;pitch controlled tone control
ioct octmidi
;lowpass filter our audio signal
;cutoff frequency is 2 octaves above MIDI note frequency
asig tone asig, cpsoct(ioct+2)

I hope these suggestions are useful,
Iain


> Date: Wed, 8 Apr 2009 23:17:49 +0200
> From: kontrapunktstefan@googlemail.com
> To: csound@lists.bath.ac.uk
> Subject: [Csnd] different amplitude values for additive synthesis
>
> Dear community,
> in the below quoted example, I would like to change the character of
> the instrument, depending of the pitch and the
> key velocity.
> The louder I play, I would like to increase the "ilautfaktor", and the
> also the lower the notes are, the "ilautfaktor" should increase too.
> How could I do this?
> Thanks for Your patience,
> Stefan
>
> <CsoundSynthesizer>
> <CsOptions>
> -odevaudio -M1 -b400 ; -+rtaudio=jack -i adc -o dac; fuer realtime-Midi
> </CsOptions>
> <CsInstruments>
>
> sr = 44100
> kr = 2205
> ksmps = 20
> nchnls = 2
> ipch = 8.02
> iequal = 12
>
>
>
> massign 0, 1 ; assign all midi events to instr 1,
> pgmassign 0, 1 ; also all program changes
> instr 1
> gasend1 init 0
> gasend2 init 0
> ituningtable = 10 ; the number of the f-table
>
> imnn notnum
> indx = imnn * 2 + 1 ; values in table alternate between
> ; Midi note nums and frequencies
> icps table indx, ituningtable
> iamp ampmidi 1000
> inach = 0.00001
> iend = 0.0000000001 ; für alle die gleiche Endlautstärke
>
> ; die Einschwingzeit für jeden Teilton
> iein = 0.0030
> ;die unterschiedlichen ausschwingzeiten
> iabkling1 = 4.5*2
> iabkling2 = 7.22*2
> iabkling3 = 9.26*2
> ;die anfangslautstaerke
> ianfang = 0.001
> ;wie laut klingt der Ton am Ende, nach dem loslassen der Note
> iweiterkling = 0.00000000000001
>
> ;die anfangslautstaerke
> ianfang = 0.001
> ;wie laut klingt der Ton am Ende, nach dem loslassen der Note
> iweiterkling = 0.00000000000001
> ;die unterschiedlichen Maxima der Hüllkurven
> ilautfaktor = 0.85
>
> imax1 = 1
> imax2 = ilautfaktor
> imax3=ilautfaktor^2
> imax4 = ilautfaktor^3
> ;and so on
> ;die Individuellen Hüllkurven für jeden einzelnen Teilton
> kenv1 expsegr ianfang, iein, imax1, iabkling1, iend, inach, iweiterkling
> kenv2 expsegr ianfang, iein, imax2, iabkling2, iend, inach, iweiterkling
> kenv3 expsegr ianfang, iein, imax3, iabkling3, iend, inach, iweiterkling
> ;die Frequenzverhältnisse
> iratio = 1.08284091791636825817 ; 11te Wurzel aus 12/5
> ifundamental = icps
> ipartialB =icps;Teilton 1
> ipartialC = icps*iratio^11 ;Teilton 2
> ;die einzelnen Teiltöne mit ihrer dazu gehörigen Hüllkurve
> a1 oscil kenv1*iamp, ifundamental, 1
> a2 oscil kenv2*iamp, ipartialB, 1
> a3 oscil kenv3*iamp, ipartialC, 1
> aton = a1+a2+a3
>
> outs aton, aton
> gasend1 = gasend1+aton
> gasend2 = gasend2+aton
> endin
> instr 2 ;RECORDS ALL SOUND
> ;RECORD A Stereo 16 BIT SOUND FILE
> fout "dezimengong.wav", 4, gasend1, gasend2
> ;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
> gasend1 = 0
> gasend2 = 0
> endin
>
> </CsInstruments>
> ; die Partiturereignisse werden definiert
> <CsScore>
> f1 0 8193 10 1
> f 10 0 256 -23 "kleinedezimedurch11.cps"
>
> t 0 30 ; keine Ahnung, was das heißt
>
> i1 0 3600
> i2 0 3600
>
> </CsScore>
> </CsoundSynthesizer>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Windows Live™: Keep your life in sync. Check it out.

Date2009-04-09 17:20
FromStefan Thomas
Subject[Csnd] Re: RE: different amplitude values for additive synthesis
Dear Iain,
thanks for Your help, it sounds much more interesting now (in my
ears). Too better understand, what You did, I tried to find somethig
about  icutoff_oct in the Manual, but I couldn't find it. Can You
maybee give me a hint?

2009/4/9 Iain McCurdy :
> Hi Stefan,
>
> I think you are interested in changing the tone of your sound with key
> velocity and MIDI note number. Perhaps filters are the way to go? You could
> try some code like this:
>
> ;'oct' format is used to give a linear mapping between velocity (and note
> number) and pitch in octaves
> ;velocity controlled tone control
> icutoff_oct  veloc  6, 14
> ;lowpass filter our audio signal
> asig tone asig, cpsoct(icutoff_oct)
>
> ;pitch controlled tone control
> ioct octmidi
> ;lowpass filter our audio signal
> ;cutoff frequency is 2 octaves above MIDI note frequency
> asig tone asig, cpsoct(ioct+2)
>
> I hope these suggestions are useful,
> Iain
>
>
>> Date: Wed, 8 Apr 2009 23:17:49 +0200
>> From: kontrapunktstefan@googlemail.com
>> To: csound@lists.bath.ac.uk
>> Subject: [Csnd] different amplitude values for additive synthesis
>>
>> Dear community,
>> in the below quoted example, I would like to change the character of
>> the instrument, depending of the pitch and the
>> key velocity.
>> The louder I play, I would like to increase the "ilautfaktor", and the
>> also the lower the notes are, the "ilautfaktor" should increase too.
>> How could I do this?
>> Thanks for Your patience,
>> Stefan
>>
>> 
>> 
>> -odevaudio -M1 -b400 ; -+rtaudio=jack -i adc -o dac; fuer realtime-Midi
>> 
>> 
>>
>> sr = 44100
>> kr = 2205
>> ksmps = 20
>> nchnls = 2
>> ipch = 8.02
>> iequal = 12
>>
>>
>>
>> massign 0, 1 ; assign all midi events to instr 1,
>> pgmassign 0, 1 ; also all program changes
>> instr 1
>> gasend1 init 0
>> gasend2 init 0
>> ituningtable = 10 ; the number of the f-table
>>
>> imnn notnum
>> indx = imnn * 2 + 1 ; values in table alternate between
>> ; Midi note nums and frequencies
>> icps table indx, ituningtable
>> iamp ampmidi 1000
>> inach = 0.00001
>> iend = 0.0000000001 ; für alle die gleiche Endlautstärke
>>
>> ; die Einschwingzeit für jeden Teilton
>> iein = 0.0030
>> ;die unterschiedlichen ausschwingzeiten
>> iabkling1 = 4.5*2
>> iabkling2 = 7.22*2
>> iabkling3 = 9.26*2
>> ;die anfangslautstaerke
>> ianfang = 0.001
>> ;wie laut klingt der Ton am Ende, nach dem loslassen der Note
>> iweiterkling = 0.00000000000001
>>
>> ;die anfangslautstaerke
>> ianfang = 0.001
>> ;wie laut klingt der Ton am Ende, nach dem loslassen der Note
>> iweiterkling = 0.00000000000001
>> ;die unterschiedlichen Maxima der Hüllkurven
>> ilautfaktor = 0.85
>>
>> imax1 = 1
>> imax2 = ilautfaktor
>> imax3=ilautfaktor^2
>> imax4 = ilautfaktor^3
>> ;and so on
>> ;die Individuellen Hüllkurven für jeden einzelnen Teilton
>> kenv1 expsegr ianfang, iein, imax1, iabkling1, iend, inach, iweiterkling
>> kenv2 expsegr ianfang, iein, imax2, iabkling2, iend, inach, iweiterkling
>> kenv3 expsegr ianfang, iein, imax3, iabkling3, iend, inach, iweiterkling
>> ;die Frequenzverhältnisse
>> iratio = 1.08284091791636825817 ; 11te Wurzel aus 12/5
>> ifundamental = icps
>> ipartialB =icps;Teilton 1
>> ipartialC = icps*iratio^11 ;Teilton 2
>> ;die einzelnen Teiltöne mit ihrer dazu gehörigen Hüllkurve
>> a1 oscil kenv1*iamp, ifundamental, 1
>> a2 oscil kenv2*iamp, ipartialB, 1
>> a3 oscil kenv3*iamp, ipartialC, 1
>> aton = a1+a2+a3
>>
>> outs aton, aton
>> gasend1 = gasend1+aton
>> gasend2 = gasend2+aton
>> endin
>> instr 2 ;RECORDS ALL SOUND
>> ;RECORD A Stereo 16 BIT SOUND FILE
>> fout "dezimengong.wav", 4, gasend1, gasend2
>> ;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
>> gasend1 = 0
>> gasend2 = 0
>> endin
>>
>> 
>> ; die Partiturereignisse werden definiert
>> 
>> f1 0 8193 10 1
>> f 10 0 256 -23 "kleinedezimedurch11.cps"
>>
>> t 0 30 ; keine Ahnung, was das heißt
>>
>> i1 0 3600
>> i2 0 3600
>>
>> 
>> 
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
> ________________________________
> Windows Live™: Keep your life in sync. Check it out.


Date2009-04-09 23:17
FromAnthony Kozar
Subject[Csnd] Re: different amplitude values for additive synthesis
icutoff_oct is an arbitrary variable name.  Try looking up "veloc",
"octmidi", "cpsoct", and "tone" in the manual instead.  Those are the
relevant opcode names in Iain's example.

Anthony Kozar
mailing-lists-1001 AT anthonykozar DOT net
http://anthonykozar.net/

Stefan Thomas wrote on 4/9/09 12:20 PM:

> Dear Iain,
> thanks for Your help, it sounds much more interesting now (in my
> ears). Too better understand, what You did, I tried to find somethig
> about  icutoff_oct in the Manual, but I couldn't find it. Can You
> maybee give me a hint?
> 
> 2009/4/9 Iain McCurdy :
>> Hi Stefan,
>> 
>> I think you are interested in changing the tone of your sound with key
>> velocity and MIDI note number. Perhaps filters are the way to go? You could
>> try some code like this:
>> 
>> ;'oct' format is used to give a linear mapping between velocity (and note
>> number) and pitch in octaves
>> ;velocity controlled tone control
>> icutoff_oct  veloc  6, 14
>> ;lowpass filter our audio signal
>> asig tone asig, cpsoct(icutoff_oct)
>> 
>> ;pitch controlled tone control
>> ioct octmidi
>> ;lowpass filter our audio signal
>> ;cutoff frequency is 2 octaves above MIDI note frequency
>> asig tone asig, cpsoct(ioct+2)
>> 
>> I hope these suggestions are useful,
>> Iain