Csound Csound-dev Csound-tekno Search About

[Csnd] trying to assign different partamps with ftmorf

Date2011-11-22 20:53
FromStefan Thomas
Subject[Csnd] trying to assign different partamps with ftmorf
Dear community,
I'd been trying to build a additive synth, that has different partamps in different registers.
I want to use ftmorf for this purpose.
Unfortunately, in the below quoted snippet, the partamps are always the same, a buzz.
There is no interpolation.
I think, it has to do with the table created by ftgentmp.
I assume that the gen 10 is'nt the right gen routine.
Which one should I use instead?
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 100
nchnls = 2
0dbfs = 1

giSine            ftgen        0, 0, 2^10, 10, 1
; frequencies of the partials
giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
; amplitudes of the partials
giPartampsUp        ftgen        0, 0, -32, -2, 1, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
giPartampsDown     ftgen        0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5 ; buzz
gitabs4morf         ftgen 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
        massign     0, 100

instr 100 ;triggered by midi, calls inumparts instances of instr 100
inumparts    =        30
imidinot    notnum
icps         cpsmidi
iamp        ampmidi     0.05
idur        =     200*iamp
indx        =        1 ;we start with the first partial
isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
kftndx         tablei imidinot, gipartampregistertab
imorphtab     ftgentmp 0,0,-32,10,1
ftmorf        kftndx, gitabs4morf, imorphtab
loop:
ipartamp    tab_i        indx-1, imorphtab
ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
        event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
        loop_le    indx, 1, inumparts, loop
krelease    release   
 if krelease == 1 then ; note off event
         turnoff2    isubinstr, 4, 1
 endif
endin


instr 101 ; plays one partial
idur        =        p3 ;duration
ifreq        =        p4 ;frequency
iamp        =        p5 ;amplitude
ittnr        =        p6 ;partial number
ivel        =        p7 ; velocity
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
aout        =        asig * aenv

        outs         aout, aout
endin


</CsInstruments>
<CsScore>
f 0 36
i 100 0 36
</CsScore>
</CsoundSynthesizer>

Date2011-11-22 21:46
Fromjoachim heintz
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
hi stefan -
for the use of ftmorf, it's better to have one general function table
for the interpolated values. otherwise, the function table will be build
and destroyed with each note again, which is useless.
the code below works, but the function table works just
- in the octave between midi 48 and 60, and
- the interpolation value is set AFTER the key is pressed.
(this is because ftmorph works at k-rate, but you call the
subinstruments at i-rate.)
(if you want to change this, you can use event instead of event_i, or
simply do the interpolation in the loop section, which should be very
simple.)
hope this helps -
	joachim



-m128


sr = 44100
ksmps = 100
nchnls = 2
0dbfs = 1

giSine            ftgen        0, 0, 2^10, 10, 1
; frequencies of the partials
giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30
; amplitudes of the partials
giPartampsUp        ftgen        0, 0, 32, -2, 1, 0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
giPartampsDown     ftgen
0,0,32,2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
; buzz
gitabs4morf         ftgen 0,0,2,-2,giPartampsDown,giPartampsUp
gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for
midinote 48 Wert 1, etc.
gimorphtab     ftgen 0,0,32,2,0
        massign     0, 100

instr 100 ;triggered by midi, calls inumparts instances of instr 100
inumparts    =        30
imidinot    notnum
icps         cpsmidi
iamp        ampmidi     0.05
idur        =     200*iamp
indx        =        1 ;we start with the first partial
isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
kftndx         tablei imidinot, gipartampregistertab
printk 1, kftndx
ftmorf        kftndx, gitabs4morf, gimorphtab
loop:
ipartamp    tab_i        indx-1, gimorphtab
ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
        event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
        loop_le    indx, 1, inumparts, loop
krelease    release
 if krelease == 1 then ; note off event
         turnoff2    isubinstr, 4, 1
 endif
endin


instr 101 ; plays one partial
idur        =        p3 ;duration
ifreq        =        p4 ;frequency
iamp        =        p5 ;amplitude
ittnr        =        p6 ;partial number
ivel        =        p7 ; velocity
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
aout        =        asig * aenv

        outs         aout, aout
endin




f 0 3600
;i 100 0 36





Am 22.11.2011 21:53, schrieb Stefan Thomas:
> Dear community,
> I'd been trying to build a additive synth, that has different partamps
> in different registers.
> I want to use ftmorf for this purpose.
> Unfortunately, in the below quoted snippet, the partamps are always the
> same, a buzz.
> There is no interpolation.
> I think, it has to do with the table created by ftgentmp.
> I assume that the gen 10 is'nt the right gen routine.
> Which one should I use instead?
> 
> 
> 
> 
> sr = 44100
> ksmps = 100
> nchnls = 2
> 0dbfs = 1
> 
> giSine            ftgen        0, 0, 2^10, 10, 1
> ; frequencies of the partials
> giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8,
> 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
> 27, 28, 29, 30
> ; amplitudes of the partials
> giPartampsUp        ftgen        0, 0, -32, -2, 1, 0,
> 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
> giPartampsDown     ftgen       
> 0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
> ; buzz
> gitabs4morf         ftgen
> 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
> gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for
> midinote 48 Wert 1, etc.
>         massign     0, 100
> 
> instr 100 ;triggered by midi, calls inumparts instances of instr 100
> inumparts    =        30
> imidinot    notnum
> icps         cpsmidi
> iamp        ampmidi     0.05
> idur        =     200*iamp
> indx        =        1 ;we start with the first partial
> isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
> kftndx         tablei imidinot, gipartampregistertab
> imorphtab     ftgentmp 0,0,-32,10,1
> ftmorf        kftndx, gitabs4morf, imorphtab
> loop:
> ipartamp    tab_i        indx-1, imorphtab
> ipartamp    =        ipartamp * iamp
> ipartfreq    tab_i        indx-1, giPartfreqs
> ipartfreq    =        ipartfreq * icps
>         event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
>         loop_le    indx, 1, inumparts, loop
> krelease    release   
>  if krelease == 1 then ; note off event
>          turnoff2    isubinstr, 4, 1
>  endif
> endin
> 
> 
> instr 101 ; plays one partial
> idur        =        p3 ;duration
> ifreq        =        p4 ;frequency
> iamp        =        p5 ;amplitude
> ittnr        =        p6 ;partial number
> ivel        =        p7 ; velocity
> asig        poscil        iamp, ifreq, giSine
> aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
> aout        =        asig * aenv
> 
>         outs         aout, aout
> endin
> 
> 
> 
> 
> f 0 36
> i 100 0 36
> 
> 


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-11-22 22:01
FromStefan Thomas
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
Dear Joachim,
thanks very much for Your reply.
Doing the interpolation could be maybee easy, but unfortunately it isn't for me.
Could You give me a hint?
I've also changed event_i to event but it doesn't sound like expected.
I think I should also change tab_i to table and the irate-variables (belonging to these tables) to krate, shouldn't I?

2011/11/22 joachim heintz <jh@joachimheintz.de>
hi stefan -
for the use of ftmorf, it's better to have one general function table
for the interpolated values. otherwise, the function table will be build
and destroyed with each note again, which is useless.
the code below works, but the function table works just
- in the octave between midi 48 and 60, and
- the interpolation value is set AFTER the key is pressed.
(this is because ftmorph works at k-rate, but you call the
subinstruments at i-rate.)
(if you want to change this, you can use event instead of event_i, or
simply do the interpolation in the loop section, which should be very
simple.)
hope this helps -
       joachim

<CsoundSynthesizer>
<CsOptions>
-m128
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 100
nchnls = 2
0dbfs = 1

giSine            ftgen        0, 0, 2^10, 10, 1
; frequencies of the partials
giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30
; amplitudes of the partials
giPartampsUp        ftgen        0, 0, 32, -2, 1, 0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
giPartampsDown     ftgen
0,0,32,2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
; buzz
gitabs4morf         ftgen 0,0,2,-2,giPartampsDown,giPartampsUp
gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for
midinote 48 Wert 1, etc.
gimorphtab     ftgen 0,0,32,2,0
       massign     0, 100

instr 100 ;triggered by midi, calls inumparts instances of instr 100
inumparts    =        30
imidinot    notnum
icps         cpsmidi
iamp        ampmidi     0.05
idur        =     200*iamp
indx        =        1 ;we start with the first partial
isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
kftndx         tablei imidinot, gipartampregistertab
printk 1, kftndx
ftmorf        kftndx, gitabs4morf, gimorphtab
loop:
ipartamp    tab_i        indx-1, gimorphtab
ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
       event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
       loop_le    indx, 1, inumparts, loop
krelease    release
 if krelease == 1 then ; note off event
        turnoff2    isubinstr, 4, 1
 endif
endin


instr 101 ; plays one partial
idur        =        p3 ;duration
ifreq        =        p4 ;frequency
iamp        =        p5 ;amplitude
ittnr        =        p6 ;partial number
ivel        =        p7 ; velocity
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
aout        =        asig * aenv

       outs         aout, aout
endin


</CsInstruments>
<CsScore>
f 0 3600
;i 100 0 36
</CsScore>
</CsoundSynthesizer>



Am 22.11.2011 21:53, schrieb Stefan Thomas:
> Dear community,
> I'd been trying to build a additive synth, that has different partamps
> in different registers.
> I want to use ftmorf for this purpose.
> Unfortunately, in the below quoted snippet, the partamps are always the
> same, a buzz.
> There is no interpolation.
> I think, it has to do with the table created by ftgentmp.
> I assume that the gen 10 is'nt the right gen routine.
> Which one should I use instead?
> <CsoundSynthesizer>
> <CsOptions>
> </CsOptions>
> <CsInstruments>
> sr = 44100
> ksmps = 100
> nchnls = 2
> 0dbfs = 1
>
> giSine            ftgen        0, 0, 2^10, 10, 1
> ; frequencies of the partials
> giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8,
> 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
> 27, 28, 29, 30
> ; amplitudes of the partials
> giPartampsUp        ftgen        0, 0, -32, -2, 1, 0,
> 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
> giPartampsDown     ftgen
> 0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
> ; buzz
> gitabs4morf         ftgen
> 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
> gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for
> midinote 48 Wert 1, etc.
>         massign     0, 100
>
> instr 100 ;triggered by midi, calls inumparts instances of instr 100
> inumparts    =        30
> imidinot    notnum
> icps         cpsmidi
> iamp        ampmidi     0.05
> idur        =     200*iamp
> indx        =        1 ;we start with the first partial
> isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
> kftndx         tablei imidinot, gipartampregistertab
> imorphtab     ftgentmp 0,0,-32,10,1
> ftmorf        kftndx, gitabs4morf, imorphtab
> loop:
> ipartamp    tab_i        indx-1, imorphtab
> ipartamp    =        ipartamp * iamp
> ipartfreq    tab_i        indx-1, giPartfreqs
> ipartfreq    =        ipartfreq * icps
>         event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
>         loop_le    indx, 1, inumparts, loop
> krelease    release
>  if krelease == 1 then ; note off event
>          turnoff2    isubinstr, 4, 1
>  endif
> endin
>
>
> instr 101 ; plays one partial
> idur        =        p3 ;duration
> ifreq        =        p4 ;frequency
> iamp        =        p5 ;amplitude
> ittnr        =        p6 ;partial number
> ivel        =        p7 ; velocity
> asig        poscil        iamp, ifreq, giSine
> aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
> aout        =        asig * aenv
>
>         outs         aout, aout
> endin
>
>
> </CsInstruments>
> <CsScore>
> f 0 36
> i 100 0 36
> </CsScore>
> </CsoundSynthesizer>


Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-11-22 22:30
Fromjoachim heintz
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
hi stefan -
this could probably be a solution for calculating the weighted mean (das
gewichtete mittel, den durchschnittswert je nachdem welche tabelle mehr
oder weniger anteil hat) of the tables. hope this works; it's actually
already too late ...
best -
	j



-m128


sr = 44100
ksmps = 100
nchnls = 2
0dbfs = 1

giSine            ftgen        0, 0, 2^10, 10, 1
; frequencies of the partials
giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30
; amplitudes of the partials
giPartampsUp        ftgen        0, 0, 32, -2, 1, 0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
giPartampsDown     ftgen
0,0,32,2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
; buzz
gipartampregistertab ftgen 0,0,128,-27, 0,0,
48,giPartampsDown,60,giPartampsUp,72,giPartampsUp,127,giPartampsUp ; for
midinote 48 Wert 1, etc.
gimorphtab     ftgen 0,0,32,2,0
        massign     0, 100

instr 100 ;triggered by midi, calls inumparts instances of instr 100
inumparts    =        30
imidinot    notnum
icps         cpsmidi
iamp        ampmidi     0.05
idur        =     200*iamp
indx        =        1 ;we start with the first partial
isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
iftndx         tablei imidinot, gipartampregistertab ;for instance 0.8
ift1 = floor(iftndx) ; for instance table 103
ift2 = ceil(iftndx) ;for instance table 104
iweight = frac(iftndx) ;for instance 0.8
print iftndx, ift1, ift2, iweight

loop:
ipartamp1    tab_i        indx-1, ift1
ipartamp2    tab_i        indx-1, ift2
ipartamp     =       (1-iweight)*ipartamp1 + iweight*ipartamp2 ;weighted
parts of both values
ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
        event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
        loop_le    indx, 1, inumparts, loop
krelease    release
 if krelease == 1 then ; note off event
         turnoff2    isubinstr, 4, 1
 endif
endin


instr 101 ; plays one partial
idur        =        p3 ;duration
ifreq        =        p4 ;frequency
iamp        =        p5 ;amplitude
ittnr        =        p6 ;partial number
ivel        =        p7 ; velocity
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
aout        =        asig * aenv

        outs         aout, aout
endin




f 0 3600
;i 100 0 36





Am 22.11.2011 23:01, schrieb Stefan Thomas:
> Dear Joachim,
> thanks very much for Your reply.
> Doing the interpolation could be maybee easy, but unfortunately it isn't
> for me.
> Could You give me a hint?
> I've also changed event_i to event but it doesn't sound like expected.
> I think I should also change tab_i to table and the irate-variables
> (belonging to these tables) to krate, shouldn't I?
> 
> 2011/11/22 joachim heintz >
> 
>     hi stefan -
>     for the use of ftmorf, it's better to have one general function table
>     for the interpolated values. otherwise, the function table will be build
>     and destroyed with each note again, which is useless.
>     the code below works, but the function table works just
>     - in the octave between midi 48 and 60, and
>     - the interpolation value is set AFTER the key is pressed.
>     (this is because ftmorph works at k-rate, but you call the
>     subinstruments at i-rate.)
>     (if you want to change this, you can use event instead of event_i, or
>     simply do the interpolation in the loop section, which should be very
>     simple.)
>     hope this helps -
>            joachim
> 
>     
>     
>     -m128
>     
>     
>     sr = 44100
>     ksmps = 100
>     nchnls = 2
>     0dbfs = 1
> 
>     giSine            ftgen        0, 0, 2^10, 10, 1
>     ; frequencies of the partials
>     giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8,
>     9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
>     27, 28, 29, 30
>     ; amplitudes of the partials
>     giPartampsUp        ftgen        0, 0, 32, -2, 1, 0,
>     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
>     giPartampsDown     ftgen
>     0,0,32,2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>     ; buzz
>     gitabs4morf         ftgen 0,0,2,-2,giPartampsDown,giPartampsUp
>     gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for
>     midinote 48 Wert 1, etc.
>     gimorphtab     ftgen 0,0,32,2,0
>            massign     0, 100
> 
>     instr 100 ;triggered by midi, calls inumparts instances of instr 100
>     inumparts    =        30
>     imidinot    notnum
>     icps         cpsmidi
>     iamp        ampmidi     0.05
>     idur        =     200*iamp
>     indx        =        1 ;we start with the first partial
>     isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
>     kftndx         tablei imidinot, gipartampregistertab
>     printk 1, kftndx
>     ftmorf        kftndx, gitabs4morf, gimorphtab
>     loop:
>     ipartamp    tab_i        indx-1, gimorphtab
>     ipartamp    =        ipartamp * iamp
>     ipartfreq    tab_i        indx-1, giPartfreqs
>     ipartfreq    =        ipartfreq * icps
>            event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp,
>     indx, iamp
>            loop_le    indx, 1, inumparts, loop
>     krelease    release
>      if krelease == 1 then ; note off event
>             turnoff2    isubinstr, 4, 1
>      endif
>     endin
> 
> 
>     instr 101 ; plays one partial
>     idur        =        p3 ;duration
>     ifreq        =        p4 ;frequency
>     iamp        =        p5 ;amplitude
>     ittnr        =        p6 ;partial number
>     ivel        =        p7 ; velocity
>     asig        poscil        iamp, ifreq, giSine
>     aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
>     aout        =        asig * aenv
> 
>            outs         aout, aout
>     endin
> 
> 
>     
>     
>     f 0 3600
>     ;i 100 0 36
>     
>     
> 
> 
> 
>     Am 22.11.2011 21:53, schrieb Stefan Thomas:
>     > Dear community,
>     > I'd been trying to build a additive synth, that has different partamps
>     > in different registers.
>     > I want to use ftmorf for this purpose.
>     > Unfortunately, in the below quoted snippet, the partamps are
>     always the
>     > same, a buzz.
>     > There is no interpolation.
>     > I think, it has to do with the table created by ftgentmp.
>     > I assume that the gen 10 is'nt the right gen routine.
>     > Which one should I use instead?
>     > 
>     > 
>     > 
>     > 
>     > sr = 44100
>     > ksmps = 100
>     > nchnls = 2
>     > 0dbfs = 1
>     >
>     > giSine            ftgen        0, 0, 2^10, 10, 1
>     > ; frequencies of the partials
>     > giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8,
>     > 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
>     > 27, 28, 29, 30
>     > ; amplitudes of the partials
>     > giPartampsUp        ftgen        0, 0, -32, -2, 1, 0,
>     > 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
>     > giPartampsDown     ftgen
>     >
>     0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>     > ; buzz
>     > gitabs4morf         ftgen
>     > 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>     > gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1
>     ; for
>     > midinote 48 Wert 1, etc.
>     >         massign     0, 100
>     >
>     > instr 100 ;triggered by midi, calls inumparts instances of instr 100
>     > inumparts    =        30
>     > imidinot    notnum
>     > icps         cpsmidi
>     > iamp        ampmidi     0.05
>     > idur        =     200*iamp
>     > indx        =        1 ;we start with the first partial
>     > isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
>     > kftndx         tablei imidinot, gipartampregistertab
>     > imorphtab     ftgentmp 0,0,-32,10,1
>     > ftmorf        kftndx, gitabs4morf, imorphtab
>     > loop:
>     > ipartamp    tab_i        indx-1, imorphtab
>     > ipartamp    =        ipartamp * iamp
>     > ipartfreq    tab_i        indx-1, giPartfreqs
>     > ipartfreq    =        ipartfreq * icps
>     >         event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp,
>     indx, iamp
>     >         loop_le    indx, 1, inumparts, loop
>     > krelease    release
>     >  if krelease == 1 then ; note off event
>     >          turnoff2    isubinstr, 4, 1
>     >  endif
>     > endin
>     >
>     >
>     > instr 101 ; plays one partial
>     > idur        =        p3 ;duration
>     > ifreq        =        p4 ;frequency
>     > iamp        =        p5 ;amplitude
>     > ittnr        =        p6 ;partial number
>     > ivel        =        p7 ; velocity
>     > asig        poscil        iamp, ifreq, giSine
>     > aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
>     > aout        =        asig * aenv
>     >
>     >         outs         aout, aout
>     > endin
>     >
>     >
>     > 
>     > 
>     > f 0 36
>     > i 100 0 36
>     > 
>     > 
> 
> 
>     Send bugs reports to the Sourceforge bug tracker
>              
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email sympa@lists.bath.ac.uk
>      with body "unsubscribe csound"
> 
> 


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-11-23 10:11
FromIain McCurdy
SubjectRE: [Csnd] trying to assign different partamps with ftmorf
Hi Stefan,

I think the problem in your example is that ftmorf is only updated for the first time on the first k-cycle, even if the index is i-rate. Your loop (and tab_i) operates only at i time so reads amp values from imorftab's initial state before any morphing has been carried out. Another approach is to just read values from both tables and interpolate between the two in some way, e.g.

ipartamp1    tab_i        indx-1, giPartampsUp
ipartamp2    tab_i        indx-1, giPartampsDown
ipartamp ntrpol ipartamp1,ipartamp2,iftndx

I changed kftndx to iftndx as it is only changed at i time.


Date: Tue, 22 Nov 2011 21:53:13 +0100
From: kontrapunktstefan@googlemail.com
To: csound@lists.bath.ac.uk
Subject: [Csnd] trying to assign different partamps with ftmorf

Dear community,
I'd been trying to build a additive synth, that has different partamps in different registers.
I want to use ftmorf for this purpose.
Unfortunately, in the below quoted snippet, the partamps are always the same, a buzz.
There is no interpolation.
I think, it has to do with the table created by ftgentmp.
I assume that the gen 10 is'nt the right gen routine.
Which one should I use instead?
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 100
nchnls = 2
0dbfs = 1

giSine            ftgen        0, 0, 2^10, 10, 1
; frequencies of the partials
giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
; amplitudes of the partials
giPartampsUp        ftgen        0, 0, -32, -2, 1, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
giPartampsDown     ftgen        0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5 ; buzz
gitabs4morf         ftgen 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
        massign     0, 100

instr 100 ;triggered by midi, calls inumparts instances of instr 100
inumparts    =        30
imidinot    notnum
icps         cpsmidi
iamp        ampmidi     0.05
idur        =     200*iamp
indx        =        1 ;we start with the first partial
isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
kftndx         tablei imidinot, gipartampregistertab
imorphtab     ftgentmp 0,0,-32,10,1
ftmorf        kftndx, gitabs4morf, imorphtab
loop:
ipartamp    tab_i        indx-1, imorphtab
ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
        event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
        loop_le    indx, 1, inumparts, loop
krelease    release   
 if krelease == 1 then ; note off event
         turnoff2    isubinstr, 4, 1
 endif
endin


instr 101 ; plays one partial
idur        =        p3 ;duration
ifreq        =        p4 ;frequency
iamp        =        p5 ;amplitude
ittnr        =        p6 ;partial number
ivel        =        p7 ; velocity
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
aout        =        asig * aenv

        outs         aout, aout
endin


</CsInstruments>
<CsScore>
f 0 36
i 100 0 36
</CsScore>
</CsoundSynthesizer>

Date2011-11-24 21:10
FromStefan Thomas
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
Thank You all for Your help.
I couldn't try Your code because my computer has to be repaired.
I will try Your suggestions as soon as poosible!

2011/11/23 Iain McCurdy <i_mccurdy@hotmail.com>
Hi Stefan,

I think the problem in your example is that ftmorf is only updated for the first time on the first k-cycle, even if the index is i-rate. Your loop (and tab_i) operates only at i time so reads amp values from imorftab's initial state before any morphing has been carried out. Another approach is to just read values from both tables and interpolate between the two in some way, e.g.

ipartamp1    tab_i        indx-1, giPartampsUp
ipartamp2    tab_i        indx-1, giPartampsDown
ipartamp ntrpol ipartamp1,ipartamp2,iftndx

I changed kftndx to iftndx as it is only changed at i time.


Date: Tue, 22 Nov 2011 21:53:13 +0100
From: kontrapunktstefan@googlemail.com
To: csound@lists.bath.ac.uk
Subject: [Csnd] trying to assign different partamps with ftmorf


Dear community,
I'd been trying to build a additive synth, that has different partamps in different registers.
I want to use ftmorf for this purpose.
Unfortunately, in the below quoted snippet, the partamps are always the same, a buzz.
There is no interpolation.
I think, it has to do with the table created by ftgentmp.
I assume that the gen 10 is'nt the right gen routine.
Which one should I use instead?
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 100
nchnls = 2
0dbfs = 1

giSine            ftgen        0, 0, 2^10, 10, 1
; frequencies of the partials
giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
; amplitudes of the partials
giPartampsUp        ftgen        0, 0, -32, -2, 1, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
giPartampsDown     ftgen        0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5 ; buzz
gitabs4morf         ftgen 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
        massign     0, 100

instr 100 ;triggered by midi, calls inumparts instances of instr 100
inumparts    =        30
imidinot    notnum
icps         cpsmidi
iamp        ampmidi     0.05
idur        =     200*iamp
indx        =        1 ;we start with the first partial
isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
kftndx         tablei imidinot, gipartampregistertab
imorphtab     ftgentmp 0,0,-32,10,1
ftmorf        kftndx, gitabs4morf, imorphtab
loop:
ipartamp    tab_i        indx-1, imorphtab
ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
        event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
        loop_le    indx, 1, inumparts, loop
krelease    release   
 if krelease == 1 then ; note off event
         turnoff2    isubinstr, 4, 1
 endif
endin


instr 101 ; plays one partial
idur        =        p3 ;duration
ifreq        =        p4 ;frequency
iamp        =        p5 ;amplitude
ittnr        =        p6 ;partial number
ivel        =        p7 ; velocity
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
aout        =        asig * aenv

        outs         aout, aout
endin


</CsInstruments>
<CsScore>
f 0 36
i 100 0 36
</CsScore>
</CsoundSynthesizer>


Date2011-11-26 19:52
FromStefan Thomas
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
Dear Ian,
thank You for Your suggestion.
I've tried Your code with my older machine (which comes very easily to it's limit) but it works.
What I would like to know is: what should I do if wanted to use not only 2 tables for the partamps but 3 or more?

2011/11/24 Stefan Thomas <kontrapunktstefan@googlemail.com>
Thank You all for Your help.
I couldn't try Your code because my computer has to be repaired.
I will try Your suggestions as soon as poosible!


2011/11/23 Iain McCurdy <i_mccurdy@hotmail.com>
Hi Stefan,

I think the problem in your example is that ftmorf is only updated for the first time on the first k-cycle, even if the index is i-rate. Your loop (and tab_i) operates only at i time so reads amp values from imorftab's initial state before any morphing has been carried out. Another approach is to just read values from both tables and interpolate between the two in some way, e.g.

ipartamp1    tab_i        indx-1, giPartampsUp
ipartamp2    tab_i        indx-1, giPartampsDown
ipartamp ntrpol ipartamp1,ipartamp2,iftndx

I changed kftndx to iftndx as it is only changed at i time.


Date: Tue, 22 Nov 2011 21:53:13 +0100
From: kontrapunktstefan@googlemail.com
To: csound@lists.bath.ac.uk
Subject: [Csnd] trying to assign different partamps with ftmorf


Dear community,
I'd been trying to build a additive synth, that has different partamps in different registers.
I want to use ftmorf for this purpose.
Unfortunately, in the below quoted snippet, the partamps are always the same, a buzz.
There is no interpolation.
I think, it has to do with the table created by ftgentmp.
I assume that the gen 10 is'nt the right gen routine.
Which one should I use instead?
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 100
nchnls = 2
0dbfs = 1

giSine            ftgen        0, 0, 2^10, 10, 1
; frequencies of the partials
giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
; amplitudes of the partials
giPartampsUp        ftgen        0, 0, -32, -2, 1, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
giPartampsDown     ftgen        0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5 ; buzz
gitabs4morf         ftgen 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
        massign     0, 100

instr 100 ;triggered by midi, calls inumparts instances of instr 100
inumparts    =        30
imidinot    notnum
icps         cpsmidi
iamp        ampmidi     0.05
idur        =     200*iamp
indx        =        1 ;we start with the first partial
isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
kftndx         tablei imidinot, gipartampregistertab
imorphtab     ftgentmp 0,0,-32,10,1
ftmorf        kftndx, gitabs4morf, imorphtab
loop:
ipartamp    tab_i        indx-1, imorphtab
ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
        event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
        loop_le    indx, 1, inumparts, loop
krelease    release   
 if krelease == 1 then ; note off event
         turnoff2    isubinstr, 4, 1
 endif
endin


instr 101 ; plays one partial
idur        =        p3 ;duration
ifreq        =        p4 ;frequency
iamp        =        p5 ;amplitude
ittnr        =        p6 ;partial number
ivel        =        p7 ; velocity
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
aout        =        asig * aenv

        outs         aout, aout
endin


</CsInstruments>
<CsScore>
f 0 36
i 100 0 36
</CsScore>
</CsoundSynthesizer>



Date2011-11-26 20:02
FromStefan Thomas
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
Dear Joachim,
I was able to try Your code now, but it doesn't seem to work like expected.
I can hear the sine wave, when I play midi-note number 60, below this value I can hear the buzz, but I would expect the opposite.
And I don't understand what You mean with Your annotations in the following lines:
ift1 = floor(iftndx) ; for instance table 103
ift2 = ceil(iftndx) ;for instance table 104
iweight = frac(iftndx) ;for instance 0.8



2011/11/26 Stefan Thomas <kontrapunktstefan@googlemail.com>
Dear Ian,
thank You for Your suggestion.
I've tried Your code with my older machine (which comes very easily to it's limit) but it works.
What I would like to know is: what should I do if wanted to use not only 2 tables for the partamps but 3 or more?


2011/11/24 Stefan Thomas <kontrapunktstefan@googlemail.com>
Thank You all for Your help.
I couldn't try Your code because my computer has to be repaired.
I will try Your suggestions as soon as poosible!


2011/11/23 Iain McCurdy <i_mccurdy@hotmail.com>
Hi Stefan,

I think the problem in your example is that ftmorf is only updated for the first time on the first k-cycle, even if the index is i-rate. Your loop (and tab_i) operates only at i time so reads amp values from imorftab's initial state before any morphing has been carried out. Another approach is to just read values from both tables and interpolate between the two in some way, e.g.

ipartamp1    tab_i        indx-1, giPartampsUp
ipartamp2    tab_i        indx-1, giPartampsDown
ipartamp ntrpol ipartamp1,ipartamp2,iftndx

I changed kftndx to iftndx as it is only changed at i time.


Date: Tue, 22 Nov 2011 21:53:13 +0100
From: kontrapunktstefan@googlemail.com
To: csound@lists.bath.ac.uk
Subject: [Csnd] trying to assign different partamps with ftmorf


Dear community,
I'd been trying to build a additive synth, that has different partamps in different registers.
I want to use ftmorf for this purpose.
Unfortunately, in the below quoted snippet, the partamps are always the same, a buzz.
There is no interpolation.
I think, it has to do with the table created by ftgentmp.
I assume that the gen 10 is'nt the right gen routine.
Which one should I use instead?
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 100
nchnls = 2
0dbfs = 1

giSine            ftgen        0, 0, 2^10, 10, 1
; frequencies of the partials
giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
; amplitudes of the partials
giPartampsUp        ftgen        0, 0, -32, -2, 1, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
giPartampsDown     ftgen        0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5 ; buzz
gitabs4morf         ftgen 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
        massign     0, 100

instr 100 ;triggered by midi, calls inumparts instances of instr 100
inumparts    =        30
imidinot    notnum
icps         cpsmidi
iamp        ampmidi     0.05
idur        =     200*iamp
indx        =        1 ;we start with the first partial
isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
kftndx         tablei imidinot, gipartampregistertab
imorphtab     ftgentmp 0,0,-32,10,1
ftmorf        kftndx, gitabs4morf, imorphtab
loop:
ipartamp    tab_i        indx-1, imorphtab
ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
        event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
        loop_le    indx, 1, inumparts, loop
krelease    release   
 if krelease == 1 then ; note off event
         turnoff2    isubinstr, 4, 1
 endif
endin


instr 101 ; plays one partial
idur        =        p3 ;duration
ifreq        =        p4 ;frequency
iamp        =        p5 ;amplitude
ittnr        =        p6 ;partial number
ivel        =        p7 ; velocity
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
aout        =        asig * aenv

        outs         aout, aout
endin


</CsInstruments>
<CsScore>
f 0 36
i 100 0 36
</CsScore>
</CsoundSynthesizer>




Date2011-11-26 21:30
Fromjoachim heintz
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
hi stefan -

in your code, you define the table "giPartampsDown" as buzz, and
"giPartampsUp" as sine. so i thought you wanted to play the lower notes
gradually more and more like a buzz, and the upper notes more and more
like a sine. was i wrong?

to your question: iftndx is for instance 103.750 (when you play e flat).
then floor(iftndx) is 103, and ceil(iftndx) is 104, and iweight is 0.75,
and means that the partials in the tables are weighted as 75% table 104
and 25% table 103.

it would be easy to swap the tables so that the lower notes are more
sine-like, and the upper more buzz-like. but if iain's suggestions works
for you, this is probably the best.

tschüss -

	joachim



Am 26.11.2011 21:02, schrieb Stefan Thomas:
> Dear Joachim,
> I was able to try Your code now, but it doesn't seem to work like expected.
> I can hear the sine wave, when I play midi-note number 60, below this
> value I can hear the buzz, but I would expect the opposite.
> And I don't understand what You mean with Your annotations in the
> following lines:
> ift1 = floor(iftndx) ; for instance table 103
> ift2 = ceil(iftndx) ;for instance table 104
> iweight = frac(iftndx) ;for instance 0.8
> 
> 
> 
> 2011/11/26 Stefan Thomas  >
> 
>     Dear Ian,
>     thank You for Your suggestion.
>     I've tried Your code with my older machine (which comes very easily
>     to it's limit) but it works.
>     What I would like to know is: what should I do if wanted to use not
>     only 2 tables for the partamps but 3 or more?
> 
> 
>     2011/11/24 Stefan Thomas      >
> 
>         Thank You all for Your help.
>         I couldn't try Your code because my computer has to be repaired.
>         I will try Your suggestions as soon as poosible!
> 
> 
>         2011/11/23 Iain McCurdy          >
> 
>             Hi Stefan,
> 
>             I think the problem in your example is that ftmorf is only
>             updated for the first time on the first k-cycle, even if the
>             index is i-rate. Your loop (and tab_i) operates only at i
>             time so reads amp values from imorftab's initial state
>             before any morphing has been carried out. Another approach
>             is to just read values from both tables and interpolate
>             between the two in some way, e.g.
> 
>             ipartamp1    tab_i        indx-1, giPartampsUp
>             ipartamp2    tab_i        indx-1, giPartampsDown
>             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
> 
>             I changed kftndx to iftndx as it is only changed at i time.
> 
>             ------------------------------------------------------------------------
>             Date: Tue, 22 Nov 2011 21:53:13 +0100
>             From: kontrapunktstefan@googlemail.com
>             
>             To: csound@lists.bath.ac.uk 
>             Subject: [Csnd] trying to assign different partamps with ftmorf
> 
> 
>             Dear community,
>             I'd been trying to build a additive synth, that has
>             different partamps in different registers.
>             I want to use ftmorf for this purpose.
>             Unfortunately, in the below quoted snippet, the partamps are
>             always the same, a buzz.
>             There is no interpolation.
>             I think, it has to do with the table created by ftgentmp.
>             I assume that the gen 10 is'nt the right gen routine.
>             Which one should I use instead?
>             
>             
>             
>             
>             sr = 44100
>             ksmps = 100
>             nchnls = 2
>             0dbfs = 1
> 
>             giSine            ftgen        0, 0, 2^10, 10, 1
>             ; frequencies of the partials
>             giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4,
>             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
>             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>             ; amplitudes of the partials
>             giPartampsUp        ftgen        0, 0, -32, -2, 1, 0,
>             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>             ; sine
>             giPartampsDown     ftgen       
>             0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>             ; buzz
>             gitabs4morf         ftgen
>             0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>             48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
>                     massign     0, 100
> 
>             instr 100 ;triggered by midi, calls inumparts instances of
>             instr 100
>             inumparts    =        30
>             imidinot    notnum
>             icps         cpsmidi
>             iamp        ampmidi     0.05
>             idur        =     200*iamp
>             indx        =        1 ;we start with the first partial
>             isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
>             kftndx         tablei imidinot, gipartampregistertab
>             imorphtab     ftgentmp 0,0,-32,10,1
>             ftmorf        kftndx, gitabs4morf, imorphtab
>             loop:
>             ipartamp    tab_i        indx-1, imorphtab
>             ipartamp    =        ipartamp * iamp
>             ipartfreq    tab_i        indx-1, giPartfreqs
>             ipartfreq    =        ipartfreq * icps
>                     event_i    "i", isubinstr, 0, idur, ipartfreq,
>             ipartamp, indx, iamp
>                     loop_le    indx, 1, inumparts, loop
>             krelease    release   
>              if krelease == 1 then ; note off event
>                      turnoff2    isubinstr, 4, 1
>              endif
>             endin
> 
> 
>             instr 101 ; plays one partial
>             idur        =        p3 ;duration
>             ifreq        =        p4 ;frequency
>             iamp        =        p5 ;amplitude
>             ittnr        =        p6 ;partial number
>             ivel        =        p7 ; velocity
>             asig        poscil        iamp, ifreq, giSine
>             aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
>             aout        =        asig * aenv
> 
>                     outs         aout, aout
>             endin
> 
> 
>             
>             
>             f 0 36
>             i 100 0 36
>             
>             
> 
> 
> 
> 


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-11-26 22:30
FromStefan Thomas
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
Dear Joachim,
Yes, You are right, it was a stupid mistake of me!
Of course, the higher notes should be sine-waves.
But what I still don't understand (maybee, it is very again very late at the moment) is:
why is e flat (below middle c) is iftndx 103.750? Afaik this note is midi number 51 and not 103.750.
Is there a relation to isubinstr?
Please give me a hint!
Thanks
Stefan
2011/11/26 joachim heintz <jh@joachimheintz.de>
hi stefan -

in your code, you define the table "giPartampsDown" as buzz, and
"giPartampsUp" as sine. so i thought you wanted to play the lower notes
gradually more and more like a buzz, and the upper notes more and more
like a sine. was i wrong?

to your question: iftndx is for instance 103.750 (when you play e flat).
then floor(iftndx) is 103, and ceil(iftndx) is 104, and iweight is 0.75,
and means that the partials in the tables are weighted as 75% table 104
and 25% table 103.

it would be easy to swap the tables so that the lower notes are more
sine-like, and the upper more buzz-like. but if iain's suggestions works
for you, this is probably the best.

tschüss -

       joachim



Am 26.11.2011 21:02, schrieb Stefan Thomas:
> Dear Joachim,
> I was able to try Your code now, but it doesn't seem to work like expected.
> I can hear the sine wave, when I play midi-note number 60, below this
> value I can hear the buzz, but I would expect the opposite.
> And I don't understand what You mean with Your annotations in the
> following lines:
> ift1 = floor(iftndx) ; for instance table 103
> ift2 = ceil(iftndx) ;for instance table 104
> iweight = frac(iftndx) ;for instance 0.8
>
>
>
> 2011/11/26 Stefan Thomas <kontrapunktstefan@googlemail.com
> <mailto:kontrapunktstefan@googlemail.com>>
>
>     Dear Ian,
>     thank You for Your suggestion.
>     I've tried Your code with my older machine (which comes very easily
>     to it's limit) but it works.
>     What I would like to know is: what should I do if wanted to use not
>     only 2 tables for the partamps but 3 or more?
>
>
>     2011/11/24 Stefan Thomas <kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>>
>
>         Thank You all for Your help.
>         I couldn't try Your code because my computer has to be repaired.
>         I will try Your suggestions as soon as poosible!
>
>
>         2011/11/23 Iain McCurdy <i_mccurdy@hotmail.com
>         <mailto:i_mccurdy@hotmail.com>>
>
>             Hi Stefan,
>
>             I think the problem in your example is that ftmorf is only
>             updated for the first time on the first k-cycle, even if the
>             index is i-rate. Your loop (and tab_i) operates only at i
>             time so reads amp values from imorftab's initial state
>             before any morphing has been carried out. Another approach
>             is to just read values from both tables and interpolate
>             between the two in some way, e.g.
>
>             ipartamp1    tab_i        indx-1, giPartampsUp
>             ipartamp2    tab_i        indx-1, giPartampsDown
>             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
>
>             I changed kftndx to iftndx as it is only changed at i time.
>
>             ------------------------------------------------------------------------
>             Date: Tue, 22 Nov 2011 21:53:13 +0100
>             From: kontrapunktstefan@googlemail.com
>             <mailto:kontrapunktstefan@googlemail.com>
>             To: csound@lists.bath.ac.uk <mailto:csound@lists.bath.ac.uk>
>             Subject: [Csnd] trying to assign different partamps with ftmorf
>
>
>             Dear community,
>             I'd been trying to build a additive synth, that has
>             different partamps in different registers.
>             I want to use ftmorf for this purpose.
>             Unfortunately, in the below quoted snippet, the partamps are
>             always the same, a buzz.
>             There is no interpolation.
>             I think, it has to do with the table created by ftgentmp.
>             I assume that the gen 10 is'nt the right gen routine.
>             Which one should I use instead?
>             <CsoundSynthesizer>
>             <CsOptions>
>             </CsOptions>
>             <CsInstruments>
>             sr = 44100
>             ksmps = 100
>             nchnls = 2
>             0dbfs = 1
>
>             giSine            ftgen        0, 0, 2^10, 10, 1
>             ; frequencies of the partials
>             giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4,
>             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
>             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>             ; amplitudes of the partials
>             giPartampsUp        ftgen        0, 0, -32, -2, 1, 0,
>             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>             ; sine
>             giPartampsDown     ftgen
>             0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>             ; buzz
>             gitabs4morf         ftgen
>             0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>             48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
>                     massign     0, 100
>
>             instr 100 ;triggered by midi, calls inumparts instances of
>             instr 100
>             inumparts    =        30
>             imidinot    notnum
>             icps         cpsmidi
>             iamp        ampmidi     0.05
>             idur        =     200*iamp
>             indx        =        1 ;we start with the first partial
>             isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
>             kftndx         tablei imidinot, gipartampregistertab
>             imorphtab     ftgentmp 0,0,-32,10,1
>             ftmorf        kftndx, gitabs4morf, imorphtab
>             loop:
>             ipartamp    tab_i        indx-1, imorphtab
>             ipartamp    =        ipartamp * iamp
>             ipartfreq    tab_i        indx-1, giPartfreqs
>             ipartfreq    =        ipartfreq * icps
>                     event_i    "i", isubinstr, 0, idur, ipartfreq,
>             ipartamp, indx, iamp
>                     loop_le    indx, 1, inumparts, loop
>             krelease    release
>              if krelease == 1 then ; note off event
>                      turnoff2    isubinstr, 4, 1
>              endif
>             endin
>
>
>             instr 101 ; plays one partial
>             idur        =        p3 ;duration
>             ifreq        =        p4 ;frequency
>             iamp        =        p5 ;amplitude
>             ittnr        =        p6 ;partial number
>             ivel        =        p7 ; velocity
>             asig        poscil        iamp, ifreq, giSine
>             aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
>             aout        =        asig * aenv
>
>                     outs         aout, aout
>             endin
>
>
>             </CsInstruments>
>             <CsScore>
>             f 0 36
>             i 100 0 36
>             </CsScore>
>             </CsoundSynthesizer>
>
>
>
>


Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-11-26 22:40
Fromjpff@cs.bath.ac.uk
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
MIDI note numbers are just codes
103.750 is a frequency in Hertz

>

 Dear Joachim,
> Yes, You are right, it was a stupid mistake of me!
> Of course, the higher notes should be sine-waves.
> But what I still don't understand (maybee, it is very again very late at
> the moment) is:
> why is e flat (below middle c) is iftndx 103.750? Afaik this note is midi
> number 51 and not 103.750.
> Is there a relation to isubinstr?
> Please give me a hint!
> Thanks
> Stefan
> 2011/11/26 joachim heintz 
>
>> hi stefan -
>>
>> in your code, you define the table "giPartampsDown" as buzz, and
>> "giPartampsUp" as sine. so i thought you wanted to play the lower notes
>> gradually more and more like a buzz, and the upper notes more and more
>> like a sine. was i wrong?
>>
>> to your question: iftndx is for instance 103.750 (when you play e flat).
>> then floor(iftndx) is 103, and ceil(iftndx) is 104, and iweight is 0.75,
>> and means that the partials in the tables are weighted as 75% table 104
>> and 25% table 103.
>>
>> it would be easy to swap the tables so that the lower notes are more
>> sine-like, and the upper more buzz-like. but if iain's suggestions works
>> for you, this is probably the best.
>>
>> tschüss -
>>
>>        joachim
>>
>>
>>
>> Am 26.11.2011 21:02, schrieb Stefan Thomas:
>> > Dear Joachim,
>> > I was able to try Your code now, but it doesn't seem to work like
>> expected.
>> > I can hear the sine wave, when I play midi-note number 60, below this
>> > value I can hear the buzz, but I would expect the opposite.
>> > And I don't understand what You mean with Your annotations in the
>> > following lines:
>> > ift1 = floor(iftndx) ; for instance table 103
>> > ift2 = ceil(iftndx) ;for instance table 104
>> > iweight = frac(iftndx) ;for instance 0.8
>> >
>> >
>> >
>> > 2011/11/26 Stefan Thomas > > >
>> >
>> >     Dear Ian,
>> >     thank You for Your suggestion.
>> >     I've tried Your code with my older machine (which comes very
>> easily
>> >     to it's limit) but it works.
>> >     What I would like to know is: what should I do if wanted to use
>> not
>> >     only 2 tables for the partamps but 3 or more?
>> >
>> >
>> >     2011/11/24 Stefan Thomas > >     >
>> >
>> >         Thank You all for Your help.
>> >         I couldn't try Your code because my computer has to be
>> repaired.
>> >         I will try Your suggestions as soon as poosible!
>> >
>> >
>> >         2011/11/23 Iain McCurdy > >         >
>> >
>> >             Hi Stefan,
>> >
>> >             I think the problem in your example is that ftmorf is only
>> >             updated for the first time on the first k-cycle, even if
>> the
>> >             index is i-rate. Your loop (and tab_i) operates only at i
>> >             time so reads amp values from imorftab's initial state
>> >             before any morphing has been carried out. Another approach
>> >             is to just read values from both tables and interpolate
>> >             between the two in some way, e.g.
>> >
>> >             ipartamp1    tab_i        indx-1, giPartampsUp
>> >             ipartamp2    tab_i        indx-1, giPartampsDown
>> >             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
>> >
>> >             I changed kftndx to iftndx as it is only changed at i
>> time.
>> >
>> >
>> ------------------------------------------------------------------------
>> >             Date: Tue, 22 Nov 2011 21:53:13 +0100
>> >             From: kontrapunktstefan@googlemail.com
>> >             
>> >             To: csound@lists.bath.ac.uk
>> 
>> >             Subject: [Csnd] trying to assign different partamps with
>> ftmorf
>> >
>> >
>> >             Dear community,
>> >             I'd been trying to build a additive synth, that has
>> >             different partamps in different registers.
>> >             I want to use ftmorf for this purpose.
>> >             Unfortunately, in the below quoted snippet, the partamps
>> are
>> >             always the same, a buzz.
>> >             There is no interpolation.
>> >             I think, it has to do with the table created by ftgentmp.
>> >             I assume that the gen 10 is'nt the right gen routine.
>> >             Which one should I use instead?
>> >             
>> >             
>> >             
>> >             
>> >             sr = 44100
>> >             ksmps = 100
>> >             nchnls = 2
>> >             0dbfs = 1
>> >
>> >             giSine            ftgen        0, 0, 2^10, 10, 1
>> >             ; frequencies of the partials
>> >             giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4,
>> >             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
>> >             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>> >             ; amplitudes of the partials
>> >             giPartampsUp        ftgen        0, 0, -32, -2, 1, 0,
>> >             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>> >             ; sine
>> >             giPartampsDown     ftgen
>> >
>> 0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>> >             ; buzz
>> >             gitabs4morf         ftgen
>> >
>> 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>> >             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>> >             48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
>> >                     massign     0, 100
>> >
>> >             instr 100 ;triggered by midi, calls inumparts instances of
>> >             instr 100
>> >             inumparts    =        30
>> >             imidinot    notnum
>> >             icps         cpsmidi
>> >             iamp        ampmidi     0.05
>> >             idur        =     200*iamp
>> >             indx        =        1 ;we start with the first partial
>> >             isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for
>> c'
>> >             kftndx         tablei imidinot, gipartampregistertab
>> >             imorphtab     ftgentmp 0,0,-32,10,1
>> >             ftmorf        kftndx, gitabs4morf, imorphtab
>> >             loop:
>> >             ipartamp    tab_i        indx-1, imorphtab
>> >             ipartamp    =        ipartamp * iamp
>> >             ipartfreq    tab_i        indx-1, giPartfreqs
>> >             ipartfreq    =        ipartfreq * icps
>> >                     event_i    "i", isubinstr, 0, idur, ipartfreq,
>> >             ipartamp, indx, iamp
>> >                     loop_le    indx, 1, inumparts, loop
>> >             krelease    release
>> >              if krelease == 1 then ; note off event
>> >                      turnoff2    isubinstr, 4, 1
>> >              endif
>> >             endin
>> >
>> >
>> >             instr 101 ; plays one partial
>> >             idur        =        p3 ;duration
>> >             ifreq        =        p4 ;frequency
>> >             iamp        =        p5 ;amplitude
>> >             ittnr        =        p6 ;partial number
>> >             ivel        =        p7 ; velocity
>> >             asig        poscil        iamp, ifreq, giSine
>> >             aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001,
>> .2,.00001
>> >             aout        =        asig * aenv
>> >
>> >                     outs         aout, aout
>> >             endin
>> >
>> >
>> >             
>> >             
>> >             f 0 36
>> >             i 100 0 36
>> >             
>> >             
>> >
>> >
>> >
>> >
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>




Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-11-27 10:16
FromStefan Thomas
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
But shouldn't be midinumber 51 around 155 Hz?
Afaik midi-note 60 is around 261 Hz, isn't it?

2011/11/26 <jpff@cs.bath.ac.uk>
MIDI note numbers are just codes
103.750 is a frequency in Hertz

>

 Dear Joachim,
> Yes, You are right, it was a stupid mistake of me!
> Of course, the higher notes should be sine-waves.
> But what I still don't understand (maybee, it is very again very late at
> the moment) is:
> why is e flat (below middle c) is iftndx 103.750? Afaik this note is midi
> number 51 and not 103.750.
> Is there a relation to isubinstr?
> Please give me a hint!
> Thanks
> Stefan
> 2011/11/26 joachim heintz <jh@joachimheintz.de>
>
>> hi stefan -
>>
>> in your code, you define the table "giPartampsDown" as buzz, and
>> "giPartampsUp" as sine. so i thought you wanted to play the lower notes
>> gradually more and more like a buzz, and the upper notes more and more
>> like a sine. was i wrong?
>>
>> to your question: iftndx is for instance 103.750 (when you play e flat).
>> then floor(iftndx) is 103, and ceil(iftndx) is 104, and iweight is 0.75,
>> and means that the partials in the tables are weighted as 75% table 104
>> and 25% table 103.
>>
>> it would be easy to swap the tables so that the lower notes are more
>> sine-like, and the upper more buzz-like. but if iain's suggestions works
>> for you, this is probably the best.
>>
>> tschüss -
>>
>>        joachim
>>
>>
>>
>> Am 26.11.2011 21:02, schrieb Stefan Thomas:
>> > Dear Joachim,
>> > I was able to try Your code now, but it doesn't seem to work like
>> expected.
>> > I can hear the sine wave, when I play midi-note number 60, below this
>> > value I can hear the buzz, but I would expect the opposite.
>> > And I don't understand what You mean with Your annotations in the
>> > following lines:
>> > ift1 = floor(iftndx) ; for instance table 103
>> > ift2 = ceil(iftndx) ;for instance table 104
>> > iweight = frac(iftndx) ;for instance 0.8
>> >
>> >
>> >
>> > 2011/11/26 Stefan Thomas <kontrapunktstefan@googlemail.com
>> > <mailto:kontrapunktstefan@googlemail.com>>
>> >
>> >     Dear Ian,
>> >     thank You for Your suggestion.
>> >     I've tried Your code with my older machine (which comes very
>> easily
>> >     to it's limit) but it works.
>> >     What I would like to know is: what should I do if wanted to use
>> not
>> >     only 2 tables for the partamps but 3 or more?
>> >
>> >
>> >     2011/11/24 Stefan Thomas <kontrapunktstefan@googlemail.com
>> >     <mailto:kontrapunktstefan@googlemail.com>>
>> >
>> >         Thank You all for Your help.
>> >         I couldn't try Your code because my computer has to be
>> repaired.
>> >         I will try Your suggestions as soon as poosible!
>> >
>> >
>> >         2011/11/23 Iain McCurdy <i_mccurdy@hotmail.com
>> >         <mailto:i_mccurdy@hotmail.com>>
>> >
>> >             Hi Stefan,
>> >
>> >             I think the problem in your example is that ftmorf is only
>> >             updated for the first time on the first k-cycle, even if
>> the
>> >             index is i-rate. Your loop (and tab_i) operates only at i
>> >             time so reads amp values from imorftab's initial state
>> >             before any morphing has been carried out. Another approach
>> >             is to just read values from both tables and interpolate
>> >             between the two in some way, e.g.
>> >
>> >             ipartamp1    tab_i        indx-1, giPartampsUp
>> >             ipartamp2    tab_i        indx-1, giPartampsDown
>> >             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
>> >
>> >             I changed kftndx to iftndx as it is only changed at i
>> time.
>> >
>> >
>> ------------------------------------------------------------------------
>> >             Date: Tue, 22 Nov 2011 21:53:13 +0100
>> >             From: kontrapunktstefan@googlemail.com
>> >             <mailto:kontrapunktstefan@googlemail.com>
>> >             To: csound@lists.bath.ac.uk
>> <mailto:csound@lists.bath.ac.uk>
>> >             Subject: [Csnd] trying to assign different partamps with
>> ftmorf
>> >
>> >
>> >             Dear community,
>> >             I'd been trying to build a additive synth, that has
>> >             different partamps in different registers.
>> >             I want to use ftmorf for this purpose.
>> >             Unfortunately, in the below quoted snippet, the partamps
>> are
>> >             always the same, a buzz.
>> >             There is no interpolation.
>> >             I think, it has to do with the table created by ftgentmp.
>> >             I assume that the gen 10 is'nt the right gen routine.
>> >             Which one should I use instead?
>> >             <CsoundSynthesizer>
>> >             <CsOptions>
>> >             </CsOptions>
>> >             <CsInstruments>
>> >             sr = 44100
>> >             ksmps = 100
>> >             nchnls = 2
>> >             0dbfs = 1
>> >
>> >             giSine            ftgen        0, 0, 2^10, 10, 1
>> >             ; frequencies of the partials
>> >             giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4,
>> >             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
>> >             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>> >             ; amplitudes of the partials
>> >             giPartampsUp        ftgen        0, 0, -32, -2, 1, 0,
>> >             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>> >             ; sine
>> >             giPartampsDown     ftgen
>> >
>> 0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>> >             ; buzz
>> >             gitabs4morf         ftgen
>> >
>> 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>> >             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>> >             48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
>> >                     massign     0, 100
>> >
>> >             instr 100 ;triggered by midi, calls inumparts instances of
>> >             instr 100
>> >             inumparts    =        30
>> >             imidinot    notnum
>> >             icps         cpsmidi
>> >             iamp        ampmidi     0.05
>> >             idur        =     200*iamp
>> >             indx        =        1 ;we start with the first partial
>> >             isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for
>> c'
>> >             kftndx         tablei imidinot, gipartampregistertab
>> >             imorphtab     ftgentmp 0,0,-32,10,1
>> >             ftmorf        kftndx, gitabs4morf, imorphtab
>> >             loop:
>> >             ipartamp    tab_i        indx-1, imorphtab
>> >             ipartamp    =        ipartamp * iamp
>> >             ipartfreq    tab_i        indx-1, giPartfreqs
>> >             ipartfreq    =        ipartfreq * icps
>> >                     event_i    "i", isubinstr, 0, idur, ipartfreq,
>> >             ipartamp, indx, iamp
>> >                     loop_le    indx, 1, inumparts, loop
>> >             krelease    release
>> >              if krelease == 1 then ; note off event
>> >                      turnoff2    isubinstr, 4, 1
>> >              endif
>> >             endin
>> >
>> >
>> >             instr 101 ; plays one partial
>> >             idur        =        p3 ;duration
>> >             ifreq        =        p4 ;frequency
>> >             iamp        =        p5 ;amplitude
>> >             ittnr        =        p6 ;partial number
>> >             ivel        =        p7 ; velocity
>> >             asig        poscil        iamp, ifreq, giSine
>> >             aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001,
>> .2,.00001
>> >             aout        =        asig * aenv
>> >
>> >                     outs         aout, aout
>> >             endin
>> >
>> >
>> >             </CsInstruments>
>> >             <CsScore>
>> >             f 0 36
>> >             i 100 0 36
>> >             </CsScore>
>> >             </CsoundSynthesizer>
>> >
>> >
>> >
>> >
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>




Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-11-27 10:29
Fromjoachim heintz
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
hi stefan -

this is because of your table called "gipartampregistertab". this table
returns at midi number 48 the number of your table "giPartampsDown" and
at midi number 60 the number of your table "giPartampsUp". as you
decided to assign the table numbers automatically, csound has counted
your table "giSine" as 101, "giPartfreqs" as 102, "giPartampsUp" as 103
and "giPartampsDown" as 104. so, if midi note number 48 is pressed, the line
iftndx         tablei imidinot, gipartampregistertab
will return 104. if 60 is pressed, it will return 103. if 51 is pressed,
it will return 103.75, because it is closer to key 48 than to key 60.
so what you get here, is the table number. if you decide to give a
number by yourself, e.g. 1 for giPartampsUp and 2 for giPartampsDown,
you will get 1.75 instead of 130.75.

all best -

	joachim



Am 26.11.2011 23:30, schrieb Stefan Thomas:
> Dear Joachim,
> Yes, You are right, it was a stupid mistake of me!
> Of course, the higher notes should be sine-waves.
> But what I still don't understand (maybee, it is very again very late at
> the moment) is:
> why is e flat (below middle c) is iftndx 103.750? Afaik this note is
> midi number 51 and not 103.750.
> Is there a relation to isubinstr?
> Please give me a hint!
> Thanks
> Stefan
> 2011/11/26 joachim heintz >
> 
>     hi stefan -
> 
>     in your code, you define the table "giPartampsDown" as buzz, and
>     "giPartampsUp" as sine. so i thought you wanted to play the lower notes
>     gradually more and more like a buzz, and the upper notes more and more
>     like a sine. was i wrong?
> 
>     to your question: iftndx is for instance 103.750 (when you play e flat).
>     then floor(iftndx) is 103, and ceil(iftndx) is 104, and iweight is 0.75,
>     and means that the partials in the tables are weighted as 75% table 104
>     and 25% table 103.
> 
>     it would be easy to swap the tables so that the lower notes are more
>     sine-like, and the upper more buzz-like. but if iain's suggestions works
>     for you, this is probably the best.
> 
>     tschüss -
> 
>            joachim
> 
> 
> 
>     Am 26.11.2011 21:02, schrieb Stefan Thomas:
>     > Dear Joachim,
>     > I was able to try Your code now, but it doesn't seem to work like
>     expected.
>     > I can hear the sine wave, when I play midi-note number 60, below this
>     > value I can hear the buzz, but I would expect the opposite.
>     > And I don't understand what You mean with Your annotations in the
>     > following lines:
>     > ift1 = floor(iftndx) ; for instance table 103
>     > ift2 = ceil(iftndx) ;for instance table 104
>     > iweight = frac(iftndx) ;for instance 0.8
>     >
>     >
>     >
>     > 2011/11/26 Stefan Thomas      
>     >      >>
>     >
>     >     Dear Ian,
>     >     thank You for Your suggestion.
>     >     I've tried Your code with my older machine (which comes very
>     easily
>     >     to it's limit) but it works.
>     >     What I would like to know is: what should I do if wanted to
>     use not
>     >     only 2 tables for the partamps but 3 or more?
>     >
>     >
>     >     2011/11/24 Stefan Thomas      
>     >          >>
>     >
>     >         Thank You all for Your help.
>     >         I couldn't try Your code because my computer has to be
>     repaired.
>     >         I will try Your suggestions as soon as poosible!
>     >
>     >
>     >         2011/11/23 Iain McCurdy      
>     >         >>
>     >
>     >             Hi Stefan,
>     >
>     >             I think the problem in your example is that ftmorf is only
>     >             updated for the first time on the first k-cycle, even
>     if the
>     >             index is i-rate. Your loop (and tab_i) operates only at i
>     >             time so reads amp values from imorftab's initial state
>     >             before any morphing has been carried out. Another approach
>     >             is to just read values from both tables and interpolate
>     >             between the two in some way, e.g.
>     >
>     >             ipartamp1    tab_i        indx-1, giPartampsUp
>     >             ipartamp2    tab_i        indx-1, giPartampsDown
>     >             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
>     >
>     >             I changed kftndx to iftndx as it is only changed at i
>     time.
>     >
>     >            
>     ------------------------------------------------------------------------
>     >             Date: Tue, 22 Nov 2011 21:53:13 +0100
>     >             From: kontrapunktstefan@googlemail.com
>     
>     >                  >
>     >             To: csound@lists.bath.ac.uk
>           >
>     >             Subject: [Csnd] trying to assign different partamps
>     with ftmorf
>     >
>     >
>     >             Dear community,
>     >             I'd been trying to build a additive synth, that has
>     >             different partamps in different registers.
>     >             I want to use ftmorf for this purpose.
>     >             Unfortunately, in the below quoted snippet, the
>     partamps are
>     >             always the same, a buzz.
>     >             There is no interpolation.
>     >             I think, it has to do with the table created by ftgentmp.
>     >             I assume that the gen 10 is'nt the right gen routine.
>     >             Which one should I use instead?
>     >             
>     >             
>     >             
>     >             
>     >             sr = 44100
>     >             ksmps = 100
>     >             nchnls = 2
>     >             0dbfs = 1
>     >
>     >             giSine            ftgen        0, 0, 2^10, 10, 1
>     >             ; frequencies of the partials
>     >             giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4,
>     >             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
>     >             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>     >             ; amplitudes of the partials
>     >             giPartampsUp        ftgen        0, 0, -32, -2, 1, 0,
>     >            
>     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>     >             ; sine
>     >             giPartampsDown     ftgen
>     >            
>     0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>     >             ; buzz
>     >             gitabs4morf         ftgen
>     >            
>     0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>     >             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>     >             48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
>     >                     massign     0, 100
>     >
>     >             instr 100 ;triggered by midi, calls inumparts instances of
>     >             instr 100
>     >             inumparts    =        30
>     >             imidinot    notnum
>     >             icps         cpsmidi
>     >             iamp        ampmidi     0.05
>     >             idur        =     200*iamp
>     >             indx        =        1 ;we start with the first partial
>     >             isubinstr    =        101+imidinot/1000 ;e.g. 101.060
>     for c'
>     >             kftndx         tablei imidinot, gipartampregistertab
>     >             imorphtab     ftgentmp 0,0,-32,10,1
>     >             ftmorf        kftndx, gitabs4morf, imorphtab
>     >             loop:
>     >             ipartamp    tab_i        indx-1, imorphtab
>     >             ipartamp    =        ipartamp * iamp
>     >             ipartfreq    tab_i        indx-1, giPartfreqs
>     >             ipartfreq    =        ipartfreq * icps
>     >                     event_i    "i", isubinstr, 0, idur, ipartfreq,
>     >             ipartamp, indx, iamp
>     >                     loop_le    indx, 1, inumparts, loop
>     >             krelease    release
>     >              if krelease == 1 then ; note off event
>     >                      turnoff2    isubinstr, 4, 1
>     >              endif
>     >             endin
>     >
>     >
>     >             instr 101 ; plays one partial
>     >             idur        =        p3 ;duration
>     >             ifreq        =        p4 ;frequency
>     >             iamp        =        p5 ;amplitude
>     >             ittnr        =        p6 ;partial number
>     >             ivel        =        p7 ; velocity
>     >             asig        poscil        iamp, ifreq, giSine
>     >             aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001,
>     .2,.00001
>     >             aout        =        asig * aenv
>     >
>     >                     outs         aout, aout
>     >             endin
>     >
>     >
>     >             
>     >             
>     >             f 0 36
>     >             i 100 0 36
>     >             
>     >             
>     >
>     >
>     >
>     >
> 
> 
>     Send bugs reports to the Sourceforge bug tracker
>              
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email sympa@lists.bath.ac.uk
>      with body "unsubscribe csound"
> 
> 


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-11-27 10:35
FromVictor Lazzarini
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
>>> def midi2cps(note): return (2**((note-69)/12.))*440
... 
>>> midi2cps(60)
261.62556530059862
>>> midi2cps(51)
155.56349186104046


On 27 Nov 2011, at 10:16, Stefan Thomas wrote:

But shouldn't be midinumber 51 around 155 Hz?
Afaik midi-note 60 is around 261 Hz, isn't it?

2011/11/26 <jpff@cs.bath.ac.uk>
MIDI note numbers are just codes
103.750 is a frequency in Hertz

>

 Dear Joachim,
> Yes, You are right, it was a stupid mistake of me!
> Of course, the higher notes should be sine-waves.
> But what I still don't understand (maybee, it is very again very late at
> the moment) is:
> why is e flat (below middle c) is iftndx 103.750? Afaik this note is midi
> number 51 and not 103.750.
> Is there a relation to isubinstr?
> Please give me a hint!
> Thanks
> Stefan
> 2011/11/26 joachim heintz <jh@joachimheintz.de>
>
>> hi stefan -
>>
>> in your code, you define the table "giPartampsDown" as buzz, and
>> "giPartampsUp" as sine. so i thought you wanted to play the lower notes
>> gradually more and more like a buzz, and the upper notes more and more
>> like a sine. was i wrong?
>>
>> to your question: iftndx is for instance 103.750 (when you play e flat).
>> then floor(iftndx) is 103, and ceil(iftndx) is 104, and iweight is 0.75,
>> and means that the partials in the tables are weighted as 75% table 104
>> and 25% table 103.
>>
>> it would be easy to swap the tables so that the lower notes are more
>> sine-like, and the upper more buzz-like. but if iain's suggestions works
>> for you, this is probably the best.
>>
>> tschüss -
>>
>>        joachim
>>
>>
>>
>> Am 26.11.2011 21:02, schrieb Stefan Thomas:
>> > Dear Joachim,
>> > I was able to try Your code now, but it doesn't seem to work like
>> expected.
>> > I can hear the sine wave, when I play midi-note number 60, below this
>> > value I can hear the buzz, but I would expect the opposite.
>> > And I don't understand what You mean with Your annotations in the
>> > following lines:
>> > ift1 = floor(iftndx) ; for instance table 103
>> > ift2 = ceil(iftndx) ;for instance table 104
>> > iweight = frac(iftndx) ;for instance 0.8
>> >
>> >
>> >
>> > 2011/11/26 Stefan Thomas <kontrapunktstefan@googlemail.com
>> > <mailto:kontrapunktstefan@googlemail.com>>
>> >
>> >     Dear Ian,
>> >     thank You for Your suggestion.
>> >     I've tried Your code with my older machine (which comes very
>> easily
>> >     to it's limit) but it works.
>> >     What I would like to know is: what should I do if wanted to use
>> not
>> >     only 2 tables for the partamps but 3 or more?
>> >
>> >
>> >     2011/11/24 Stefan Thomas <kontrapunktstefan@googlemail.com
>> >     <mailto:kontrapunktstefan@googlemail.com>>
>> >
>> >         Thank You all for Your help.
>> >         I couldn't try Your code because my computer has to be
>> repaired.
>> >         I will try Your suggestions as soon as poosible!
>> >
>> >
>> >         2011/11/23 Iain McCurdy <i_mccurdy@hotmail.com
>> >         <mailto:i_mccurdy@hotmail.com>>
>> >
>> >             Hi Stefan,
>> >
>> >             I think the problem in your example is that ftmorf is only
>> >             updated for the first time on the first k-cycle, even if
>> the
>> >             index is i-rate. Your loop (and tab_i) operates only at i
>> >             time so reads amp values from imorftab's initial state
>> >             before any morphing has been carried out. Another approach
>> >             is to just read values from both tables and interpolate
>> >             between the two in some way, e.g.
>> >
>> >             ipartamp1    tab_i        indx-1, giPartampsUp
>> >             ipartamp2    tab_i        indx-1, giPartampsDown
>> >             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
>> >
>> >             I changed kftndx to iftndx as it is only changed at i
>> time.
>> >
>> >
>> ------------------------------------------------------------------------
>> >             Date: Tue, 22 Nov 2011 21:53:13 +0100
>> >             From: kontrapunktstefan@googlemail.com
>> >             <mailto:kontrapunktstefan@googlemail.com>
>> >             To: csound@lists.bath.ac.uk
>> <mailto:csound@lists.bath.ac.uk>
>> >             Subject: [Csnd] trying to assign different partamps with
>> ftmorf
>> >
>> >
>> >             Dear community,
>> >             I'd been trying to build a additive synth, that has
>> >             different partamps in different registers.
>> >             I want to use ftmorf for this purpose.
>> >             Unfortunately, in the below quoted snippet, the partamps
>> are
>> >             always the same, a buzz.
>> >             There is no interpolation.
>> >             I think, it has to do with the table created by ftgentmp.
>> >             I assume that the gen 10 is'nt the right gen routine.
>> >             Which one should I use instead?
>> >             <CsoundSynthesizer>
>> >             <CsOptions>
>> >             </CsOptions>
>> >             <CsInstruments>
>> >             sr = 44100
>> >             ksmps = 100
>> >             nchnls = 2
>> >             0dbfs = 1
>> >
>> >             giSine            ftgen        0, 0, 2^10, 10, 1
>> >             ; frequencies of the partials
>> >             giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4,
>> >             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
>> >             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>> >             ; amplitudes of the partials
>> >             giPartampsUp        ftgen        0, 0, -32, -2, 1, 0,
>> >             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>> >             ; sine
>> >             giPartampsDown     ftgen
>> >
>> 0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>> >             ; buzz
>> >             gitabs4morf         ftgen
>> >
>> 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>> >             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>> >             48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
>> >                     massign     0, 100
>> >
>> >             instr 100 ;triggered by midi, calls inumparts instances of
>> >             instr 100
>> >             inumparts    =        30
>> >             imidinot    notnum
>> >             icps         cpsmidi
>> >             iamp        ampmidi     0.05
>> >             idur        =     200*iamp
>> >             indx        =        1 ;we start with the first partial
>> >             isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for
>> c'
>> >             kftndx         tablei imidinot, gipartampregistertab
>> >             imorphtab     ftgentmp 0,0,-32,10,1
>> >             ftmorf        kftndx, gitabs4morf, imorphtab
>> >             loop:
>> >             ipartamp    tab_i        indx-1, imorphtab
>> >             ipartamp    =        ipartamp * iamp
>> >             ipartfreq    tab_i        indx-1, giPartfreqs
>> >             ipartfreq    =        ipartfreq * icps
>> >                     event_i    "i", isubinstr, 0, idur, ipartfreq,
>> >             ipartamp, indx, iamp
>> >                     loop_le    indx, 1, inumparts, loop
>> >             krelease    release
>> >              if krelease == 1 then ; note off event
>> >                      turnoff2    isubinstr, 4, 1
>> >              endif
>> >             endin
>> >
>> >
>> >             instr 101 ; plays one partial
>> >             idur        =        p3 ;duration
>> >             ifreq        =        p4 ;frequency
>> >             iamp        =        p5 ;amplitude
>> >             ittnr        =        p6 ;partial number
>> >             ivel        =        p7 ; velocity
>> >             asig        poscil        iamp, ifreq, giSine
>> >             aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001,
>> .2,.00001
>> >             aout        =        asig * aenv
>> >
>> >                     outs         aout, aout
>> >             endin
>> >
>> >
>> >             </CsInstruments>
>> >             <CsScore>
>> >             f 0 36
>> >             i 100 0 36
>> >             </CsScore>
>> >             </CsoundSynthesizer>
>> >
>> >
>> >
>> >
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>




Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-11-27 10:38
FromStefan Thomas
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
Ok, thanks!
I've got it now.
I would like to ask one last questions concerning this subject.
Where does csound "tell" me, which number it has choosen for the ftables?

2011/11/27 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>> def midi2cps(note): return (2**((note-69)/12.))*440
... 
>>> midi2cps(60)
261.62556530059862
>>> midi2cps(51)
155.56349186104046


On 27 Nov 2011, at 10:16, Stefan Thomas wrote:

But shouldn't be midinumber 51 around 155 Hz?
Afaik midi-note 60 is around 261 Hz, isn't it?

2011/11/26 <jpff@cs.bath.ac.uk>
MIDI note numbers are just codes
103.750 is a frequency in Hertz

>

 Dear Joachim,
> Yes, You are right, it was a stupid mistake of me!
> Of course, the higher notes should be sine-waves.
> But what I still don't understand (maybee, it is very again very late at
> the moment) is:
> why is e flat (below middle c) is iftndx 103.750? Afaik this note is midi
> number 51 and not 103.750.
> Is there a relation to isubinstr?
> Please give me a hint!
> Thanks
> Stefan
> 2011/11/26 joachim heintz <jh@joachimheintz.de>
>
>> hi stefan -
>>
>> in your code, you define the table "giPartampsDown" as buzz, and
>> "giPartampsUp" as sine. so i thought you wanted to play the lower notes
>> gradually more and more like a buzz, and the upper notes more and more
>> like a sine. was i wrong?
>>
>> to your question: iftndx is for instance 103.750 (when you play e flat).
>> then floor(iftndx) is 103, and ceil(iftndx) is 104, and iweight is 0.75,
>> and means that the partials in the tables are weighted as 75% table 104
>> and 25% table 103.
>>
>> it would be easy to swap the tables so that the lower notes are more
>> sine-like, and the upper more buzz-like. but if iain's suggestions works
>> for you, this is probably the best.
>>
>> tschüss -
>>
>>        joachim
>>
>>
>>
>> Am 26.11.2011 21:02, schrieb Stefan Thomas:
>> > Dear Joachim,
>> > I was able to try Your code now, but it doesn't seem to work like
>> expected.
>> > I can hear the sine wave, when I play midi-note number 60, below this
>> > value I can hear the buzz, but I would expect the opposite.
>> > And I don't understand what You mean with Your annotations in the
>> > following lines:
>> > ift1 = floor(iftndx) ; for instance table 103
>> > ift2 = ceil(iftndx) ;for instance table 104
>> > iweight = frac(iftndx) ;for instance 0.8
>> >
>> >
>> >
>> > 2011/11/26 Stefan Thomas <kontrapunktstefan@googlemail.com
>> > <mailto:kontrapunktstefan@googlemail.com>>
>> >
>> >     Dear Ian,
>> >     thank You for Your suggestion.
>> >     I've tried Your code with my older machine (which comes very
>> easily
>> >     to it's limit) but it works.
>> >     What I would like to know is: what should I do if wanted to use
>> not
>> >     only 2 tables for the partamps but 3 or more?
>> >
>> >
>> >     2011/11/24 Stefan Thomas <kontrapunktstefan@googlemail.com
>> >     <mailto:kontrapunktstefan@googlemail.com>>
>> >
>> >         Thank You all for Your help.
>> >         I couldn't try Your code because my computer has to be
>> repaired.
>> >         I will try Your suggestions as soon as poosible!
>> >
>> >
>> >         2011/11/23 Iain McCurdy <i_mccurdy@hotmail.com
>> >         <mailto:i_mccurdy@hotmail.com>>
>> >
>> >             Hi Stefan,
>> >
>> >             I think the problem in your example is that ftmorf is only
>> >             updated for the first time on the first k-cycle, even if
>> the
>> >             index is i-rate. Your loop (and tab_i) operates only at i
>> >             time so reads amp values from imorftab's initial state
>> >             before any morphing has been carried out. Another approach
>> >             is to just read values from both tables and interpolate
>> >             between the two in some way, e.g.
>> >
>> >             ipartamp1    tab_i        indx-1, giPartampsUp
>> >             ipartamp2    tab_i        indx-1, giPartampsDown
>> >             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
>> >
>> >             I changed kftndx to iftndx as it is only changed at i
>> time.
>> >
>> >
>> ------------------------------------------------------------------------
>> >             Date: Tue, 22 Nov 2011 21:53:13 +0100
>> >             From: kontrapunktstefan@googlemail.com
>> >             <mailto:kontrapunktstefan@googlemail.com>
>> >             To: csound@lists.bath.ac.uk
>> <mailto:csound@lists.bath.ac.uk>
>> >             Subject: [Csnd] trying to assign different partamps with
>> ftmorf
>> >
>> >
>> >             Dear community,
>> >             I'd been trying to build a additive synth, that has
>> >             different partamps in different registers.
>> >             I want to use ftmorf for this purpose.
>> >             Unfortunately, in the below quoted snippet, the partamps
>> are
>> >             always the same, a buzz.
>> >             There is no interpolation.
>> >             I think, it has to do with the table created by ftgentmp.
>> >             I assume that the gen 10 is'nt the right gen routine.
>> >             Which one should I use instead?
>> >             <CsoundSynthesizer>
>> >             <CsOptions>
>> >             </CsOptions>
>> >             <CsInstruments>
>> >             sr = 44100
>> >             ksmps = 100
>> >             nchnls = 2
>> >             0dbfs = 1
>> >
>> >             giSine            ftgen        0, 0, 2^10, 10, 1
>> >             ; frequencies of the partials
>> >             giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4,
>> >             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
>> >             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>> >             ; amplitudes of the partials
>> >             giPartampsUp        ftgen        0, 0, -32, -2, 1, 0,
>> >             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>> >             ; sine
>> >             giPartampsDown     ftgen
>> >
>> 0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>> >             ; buzz
>> >             gitabs4morf         ftgen
>> >
>> 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>> >             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>> >             48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
>> >                     massign     0, 100
>> >
>> >             instr 100 ;triggered by midi, calls inumparts instances of
>> >             instr 100
>> >             inumparts    =        30
>> >             imidinot    notnum
>> >             icps         cpsmidi
>> >             iamp        ampmidi     0.05
>> >             idur        =     200*iamp
>> >             indx        =        1 ;we start with the first partial
>> >             isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for
>> c'
>> >             kftndx         tablei imidinot, gipartampregistertab
>> >             imorphtab     ftgentmp 0,0,-32,10,1
>> >             ftmorf        kftndx, gitabs4morf, imorphtab
>> >             loop:
>> >             ipartamp    tab_i        indx-1, imorphtab
>> >             ipartamp    =        ipartamp * iamp
>> >             ipartfreq    tab_i        indx-1, giPartfreqs
>> >             ipartfreq    =        ipartfreq * icps
>> >                     event_i    "i", isubinstr, 0, idur, ipartfreq,
>> >             ipartamp, indx, iamp
>> >                     loop_le    indx, 1, inumparts, loop
>> >             krelease    release
>> >              if krelease == 1 then ; note off event
>> >                      turnoff2    isubinstr, 4, 1
>> >              endif
>> >             endin
>> >
>> >
>> >             instr 101 ; plays one partial
>> >             idur        =        p3 ;duration
>> >             ifreq        =        p4 ;frequency
>> >             iamp        =        p5 ;amplitude
>> >             ittnr        =        p6 ;partial number
>> >             ivel        =        p7 ; velocity
>> >             asig        poscil        iamp, ifreq, giSine
>> >             aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001,
>> .2,.00001
>> >             aout        =        asig * aenv
>> >
>> >                     outs         aout, aout
>> >             endin
>> >
>> >
>> >             </CsInstruments>
>> >             <CsScore>
>> >             f 0 36
>> >             i 100 0 36
>> >             </CsScore>
>> >             </CsoundSynthesizer>
>> >
>> >
>> >
>> >
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>




Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie





Date2011-11-27 12:43
Fromjoachim heintz
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
csound simply starts at 101 for the first ftgen in your code, and then
counts up. as you have six ftables, they get the numbers 101 to 106. the
usual console output (don't use the option -m128) contains the lines:
...
0dBFS level = 1.0
ftable 101:
ftable 102:
ftable 103:
ftable 104:
ftable 105:
ftable 106:
chnl 1 using instr 100
...
in general, this number is stored in the variable which you set as
output argument. in your case, these are the variables giSine,
giPartfreqs, giPartampsUp, giPartampsDown, and so on. you can see the
number by simply printing:
print giSine, giPartfreqs, giPartampsUp, giPartampsDown
returns:
giSine = 101.000  giPartfreqs = 102.000  giPartampsUp = 103.000
giPartampsDown = 104.000

	joachim



Am 27.11.2011 11:38, schrieb Stefan Thomas:
> Ok, thanks!
> I've got it now.
> I would like to ask one last questions concerning this subject.
> Where does csound "tell" me, which number it has choosen for the ftables?
> 
> 2011/11/27 Victor Lazzarini  >
> 
>     >>> def midi2cps(note): return (2**((note-69)/12.))*440
>     ... 
>     >>> midi2cps(60)
>     261.62556530059862
>     >>> midi2cps(51)
>     155.56349186104046
> 
> 
>     On 27 Nov 2011, at 10:16, Stefan Thomas wrote:
> 
>>     But shouldn't be midinumber 51 around 155 Hz?
>>     Afaik midi-note 60 is around 261 Hz, isn't it?
>>
>>     2011/11/26 >
>>
>>         MIDI note numbers are just codes
>>         103.750 is a frequency in Hertz
>>
>>         >
>>
>>          Dear Joachim,
>>         > Yes, You are right, it was a stupid mistake of me!
>>         > Of course, the higher notes should be sine-waves.
>>         > But what I still don't understand (maybee, it is very again
>>         very late at
>>         > the moment) is:
>>         > why is e flat (below middle c) is iftndx 103.750? Afaik this
>>         note is midi
>>         > number 51 and not 103.750.
>>         > Is there a relation to isubinstr?
>>         > Please give me a hint!
>>         > Thanks
>>         > Stefan
>>         > 2011/11/26 joachim heintz >         >
>>         >
>>         >> hi stefan -
>>         >>
>>         >> in your code, you define the table "giPartampsDown" as
>>         buzz, and
>>         >> "giPartampsUp" as sine. so i thought you wanted to play the
>>         lower notes
>>         >> gradually more and more like a buzz, and the upper notes
>>         more and more
>>         >> like a sine. was i wrong?
>>         >>
>>         >> to your question: iftndx is for instance 103.750 (when you
>>         play e flat).
>>         >> then floor(iftndx) is 103, and ceil(iftndx) is 104, and
>>         iweight is 0.75,
>>         >> and means that the partials in the tables are weighted as
>>         75% table 104
>>         >> and 25% table 103.
>>         >>
>>         >> it would be easy to swap the tables so that the lower notes
>>         are more
>>         >> sine-like, and the upper more buzz-like. but if iain's
>>         suggestions works
>>         >> for you, this is probably the best.
>>         >>
>>         >> tschüss -
>>         >>
>>         >>        joachim
>>         >>
>>         >>
>>         >>
>>         >> Am 26.11.2011 21:02, schrieb Stefan Thomas:
>>         >> > Dear Joachim,
>>         >> > I was able to try Your code now, but it doesn't seem to
>>         work like
>>         >> expected.
>>         >> > I can hear the sine wave, when I play midi-note number
>>         60, below this
>>         >> > value I can hear the buzz, but I would expect the opposite.
>>         >> > And I don't understand what You mean with Your
>>         annotations in the
>>         >> > following lines:
>>         >> > ift1 = floor(iftndx) ; for instance table 103
>>         >> > ift2 = ceil(iftndx) ;for instance table 104
>>         >> > iweight = frac(iftndx) ;for instance 0.8
>>         >> >
>>         >> >
>>         >> >
>>         >> > 2011/11/26 Stefan Thomas
>>         >         
>>         >> > >         >>
>>         >> >
>>         >> >     Dear Ian,
>>         >> >     thank You for Your suggestion.
>>         >> >     I've tried Your code with my older machine (which
>>         comes very
>>         >> easily
>>         >> >     to it's limit) but it works.
>>         >> >     What I would like to know is: what should I do if
>>         wanted to use
>>         >> not
>>         >> >     only 2 tables for the partamps but 3 or more?
>>         >> >
>>         >> >
>>         >> >     2011/11/24 Stefan Thomas
>>         >         
>>         >> >     >         >>
>>         >> >
>>         >> >         Thank You all for Your help.
>>         >> >         I couldn't try Your code because my computer has
>>         to be
>>         >> repaired.
>>         >> >         I will try Your suggestions as soon as poosible!
>>         >> >
>>         >> >
>>         >> >         2011/11/23 Iain McCurdy >         
>>         >> >         >         >>
>>         >> >
>>         >> >             Hi Stefan,
>>         >> >
>>         >> >             I think the problem in your example is that
>>         ftmorf is only
>>         >> >             updated for the first time on the first
>>         k-cycle, even if
>>         >> the
>>         >> >             index is i-rate. Your loop (and tab_i)
>>         operates only at i
>>         >> >             time so reads amp values from imorftab's
>>         initial state
>>         >> >             before any morphing has been carried out.
>>         Another approach
>>         >> >             is to just read values from both tables and
>>         interpolate
>>         >> >             between the two in some way, e.g.
>>         >> >
>>         >> >             ipartamp1    tab_i        indx-1, giPartampsUp
>>         >> >             ipartamp2    tab_i        indx-1, giPartampsDown
>>         >> >             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
>>         >> >
>>         >> >             I changed kftndx to iftndx as it is only
>>         changed at i
>>         >> time.
>>         >> >
>>         >> >
>>         >>
>>         ------------------------------------------------------------------------
>>         >> >             Date: Tue, 22 Nov 2011 21:53:13 +0100
>>         >> >             From: kontrapunktstefan@googlemail.com
>>         
>>         >> >             >         >
>>         >> >             To: csound@lists.bath.ac.uk
>>         
>>         >> >         >
>>         >> >             Subject: [Csnd] trying to assign different
>>         partamps with
>>         >> ftmorf
>>         >> >
>>         >> >
>>         >> >             Dear community,
>>         >> >             I'd been trying to build a additive synth,
>>         that has
>>         >> >             different partamps in different registers.
>>         >> >             I want to use ftmorf for this purpose.
>>         >> >             Unfortunately, in the below quoted snippet,
>>         the partamps
>>         >> are
>>         >> >             always the same, a buzz.
>>         >> >             There is no interpolation.
>>         >> >             I think, it has to do with the table created
>>         by ftgentmp.
>>         >> >             I assume that the gen 10 is'nt the right gen
>>         routine.
>>         >> >             Which one should I use instead?
>>         >> >             
>>         >> >             
>>         >> >             
>>         >> >             
>>         >> >             sr = 44100
>>         >> >             ksmps = 100
>>         >> >             nchnls = 2
>>         >> >             0dbfs = 1
>>         >> >
>>         >> >             giSine            ftgen        0, 0, 2^10, 10, 1
>>         >> >             ; frequencies of the partials
>>         >> >             giPartfreqs        ftgen        0, 0, -30,
>>         -2, 1, 2, 3, 4,
>>         >> >             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>>         17, 18, 19, 20,
>>         >> >             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>>         >> >             ; amplitudes of the partials
>>         >> >             giPartampsUp        ftgen        0, 0, -32,
>>         -2, 1, 0,
>>         >> >            
>>         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>>         >> >             ; sine
>>         >> >             giPartampsDown     ftgen
>>         >> >
>>         >>
>>         0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>>         >> >             ; buzz
>>         >> >             gitabs4morf         ftgen
>>         >> >
>>         >> 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>>         >> >             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>>         >> >             48,0,60,1,72,1,127,1 ; for midinote 48 Wert
>>         1, etc.
>>         >> >                     massign     0, 100
>>         >> >
>>         >> >             instr 100 ;triggered by midi, calls inumparts
>>         instances of
>>         >> >             instr 100
>>         >> >             inumparts    =        30
>>         >> >             imidinot    notnum
>>         >> >             icps         cpsmidi
>>         >> >             iamp        ampmidi     0.05
>>         >> >             idur        =     200*iamp
>>         >> >             indx        =        1 ;we start with the
>>         first partial
>>         >> >             isubinstr    =        101+imidinot/1000 ;e.g.
>>         101.060 for
>>         >> c'
>>         >> >             kftndx         tablei imidinot,
>>         gipartampregistertab
>>         >> >             imorphtab     ftgentmp 0,0,-32,10,1
>>         >> >             ftmorf        kftndx, gitabs4morf, imorphtab
>>         >> >             loop:
>>         >> >             ipartamp    tab_i        indx-1, imorphtab
>>         >> >             ipartamp    =        ipartamp * iamp
>>         >> >             ipartfreq    tab_i        indx-1, giPartfreqs
>>         >> >             ipartfreq    =        ipartfreq * icps
>>         >> >                     event_i    "i", isubinstr, 0, idur,
>>         ipartfreq,
>>         >> >             ipartamp, indx, iamp
>>         >> >                     loop_le    indx, 1, inumparts, loop
>>         >> >             krelease    release
>>         >> >              if krelease == 1 then ; note off event
>>         >> >                      turnoff2    isubinstr, 4, 1
>>         >> >              endif
>>         >> >             endin
>>         >> >
>>         >> >
>>         >> >             instr 101 ; plays one partial
>>         >> >             idur        =        p3 ;duration
>>         >> >             ifreq        =        p4 ;frequency
>>         >> >             iamp        =        p5 ;amplitude
>>         >> >             ittnr        =        p6 ;partial number
>>         >> >             ivel        =        p7 ; velocity
>>         >> >             asig        poscil        iamp, ifreq, giSine
>>         >> >             aenv        expsegr    0.01, 0.01, 1,
>>         idur-0.1, .001,
>>         >> .2,.00001
>>         >> >             aout        =        asig * aenv
>>         >> >
>>         >> >                     outs         aout, aout
>>         >> >             endin
>>         >> >
>>         >> >
>>         >> >             
>>         >> >             
>>         >> >             f 0 36
>>         >> >             i 100 0 36
>>         >> >             
>>         >> >             
>>         >> >
>>         >> >
>>         >> >
>>         >> >
>>         >>
>>         >>
>>         >> Send bugs reports to the Sourceforge bug tracker
>>         >>          
>>          https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>         
>>         >> Discussions of bugs and features can be posted here
>>         >> To unsubscribe, send email sympa@lists.bath.ac.uk
>>          with body "unsubscribe
>>         >> csound"
>>         >>
>>         >>
>>         >
>>         > Send bugs reports to the Sourceforge bug tracker
>>         >            
>>         https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>         
>>         > Discussions of bugs and features can be posted here
>>         > To unsubscribe, send email sympa@lists.bath.ac.uk
>>          with body "unsubscribe
>>         > csound"
>>         >
>>         >
>>
>>
>>
>>
>>         Send bugs reports to the Sourceforge bug tracker
>>                  
>>          https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>         
>>         Discussions of bugs and features can be posted here
>>         To unsubscribe, send email sympa@lists.bath.ac.uk
>>          with body "unsubscribe csound"
>>
>>
> 
>     Dr Victor Lazzarini
>     Senior Lecturer
>     Dept. of Music
>     NUI Maynooth Ireland
>     tel.: +353 1 708 3545 
>     Victor dot Lazzarini AT nuim dot ie
> 
> 
> 
> 


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-11-27 14:52
FromStefan Thomas
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
Dear Joachim,
when I try Your code everything works fine, but when I play very low notes,
I get error messages like this:
INIT ERROR in instr 100: tab_i: incorrect table number
ipartamp2       tab_i   #i7     ift2    0
This happens when I play midi-note 36.
I have no idea what could be the reason for that.


2011/11/27 joachim heintz <jh@joachimheintz.de>
csound simply starts at 101 for the first ftgen in your code, and then
counts up. as you have six ftables, they get the numbers 101 to 106. the
usual console output (don't use the option -m128) contains the lines:
...
0dBFS level = 1.0
ftable 101:
ftable 102:
ftable 103:
ftable 104:
ftable 105:
ftable 106:
chnl 1 using instr 100
...
in general, this number is stored in the variable which you set as
output argument. in your case, these are the variables giSine,
giPartfreqs, giPartampsUp, giPartampsDown, and so on. you can see the
number by simply printing:
print giSine, giPartfreqs, giPartampsUp, giPartampsDown
returns:
giSine = 101.000  giPartfreqs = 102.000  giPartampsUp = 103.000
giPartampsDown = 104.000

       joachim



Am 27.11.2011 11:38, schrieb Stefan Thomas:
> Ok, thanks!
> I've got it now.
> I would like to ask one last questions concerning this subject.
> Where does csound "tell" me, which number it has choosen for the ftables?
>
> 2011/11/27 Victor Lazzarini <Victor.Lazzarini@nuim.ie
> <mailto:Victor.Lazzarini@nuim.ie>>
>
>     >>> def midi2cps(note): return (2**((note-69)/12.))*440
>     ...
>     >>> midi2cps(60)
>     261.62556530059862
>     >>> midi2cps(51)
>     155.56349186104046
>
>
>     On 27 Nov 2011, at 10:16, Stefan Thomas wrote:
>
>>     But shouldn't be midinumber 51 around 155 Hz?
>>     Afaik midi-note 60 is around 261 Hz, isn't it?
>>
>>     2011/11/26 <jpff@cs.bath.ac.uk <mailto:jpff@cs.bath.ac.uk>>
>>
>>         MIDI note numbers are just codes
>>         103.750 is a frequency in Hertz
>>
>>         >
>>
>>          Dear Joachim,
>>         > Yes, You are right, it was a stupid mistake of me!
>>         > Of course, the higher notes should be sine-waves.
>>         > But what I still don't understand (maybee, it is very again
>>         very late at
>>         > the moment) is:
>>         > why is e flat (below middle c) is iftndx 103.750? Afaik this
>>         note is midi
>>         > number 51 and not 103.750.
>>         > Is there a relation to isubinstr?
>>         > Please give me a hint!
>>         > Thanks
>>         > Stefan
>>         > 2011/11/26 joachim heintz <jh@joachimheintz.de
>>         <mailto:jh@joachimheintz.de>>
>>         >
>>         >> hi stefan -
>>         >>
>>         >> in your code, you define the table "giPartampsDown" as
>>         buzz, and
>>         >> "giPartampsUp" as sine. so i thought you wanted to play the
>>         lower notes
>>         >> gradually more and more like a buzz, and the upper notes
>>         more and more
>>         >> like a sine. was i wrong?
>>         >>
>>         >> to your question: iftndx is for instance 103.750 (when you
>>         play e flat).
>>         >> then floor(iftndx) is 103, and ceil(iftndx) is 104, and
>>         iweight is 0.75,
>>         >> and means that the partials in the tables are weighted as
>>         75% table 104
>>         >> and 25% table 103.
>>         >>
>>         >> it would be easy to swap the tables so that the lower notes
>>         are more
>>         >> sine-like, and the upper more buzz-like. but if iain's
>>         suggestions works
>>         >> for you, this is probably the best.
>>         >>
>>         >> tschüss -
>>         >>
>>         >>        joachim
>>         >>
>>         >>
>>         >>
>>         >> Am 26.11.2011 21:02, schrieb Stefan Thomas:
>>         >> > Dear Joachim,
>>         >> > I was able to try Your code now, but it doesn't seem to
>>         work like
>>         >> expected.
>>         >> > I can hear the sine wave, when I play midi-note number
>>         60, below this
>>         >> > value I can hear the buzz, but I would expect the opposite.
>>         >> > And I don't understand what You mean with Your
>>         annotations in the
>>         >> > following lines:
>>         >> > ift1 = floor(iftndx) ; for instance table 103
>>         >> > ift2 = ceil(iftndx) ;for instance table 104
>>         >> > iweight = frac(iftndx) ;for instance 0.8
>>         >> >
>>         >> >
>>         >> >
>>         >> > 2011/11/26 Stefan Thomas
>>         <kontrapunktstefan@googlemail.com
>>         <mailto:kontrapunktstefan@googlemail.com>
>>         >> > <mailto:kontrapunktstefan@googlemail.com
>>         <mailto:kontrapunktstefan@googlemail.com>>>
>>         >> >
>>         >> >     Dear Ian,
>>         >> >     thank You for Your suggestion.
>>         >> >     I've tried Your code with my older machine (which
>>         comes very
>>         >> easily
>>         >> >     to it's limit) but it works.
>>         >> >     What I would like to know is: what should I do if
>>         wanted to use
>>         >> not
>>         >> >     only 2 tables for the partamps but 3 or more?
>>         >> >
>>         >> >
>>         >> >     2011/11/24 Stefan Thomas
>>         <kontrapunktstefan@googlemail.com
>>         <mailto:kontrapunktstefan@googlemail.com>
>>         >> >     <mailto:kontrapunktstefan@googlemail.com
>>         <mailto:kontrapunktstefan@googlemail.com>>>
>>         >> >
>>         >> >         Thank You all for Your help.
>>         >> >         I couldn't try Your code because my computer has
>>         to be
>>         >> repaired.
>>         >> >         I will try Your suggestions as soon as poosible!
>>         >> >
>>         >> >
>>         >> >         2011/11/23 Iain McCurdy <i_mccurdy@hotmail.com
>>         <mailto:i_mccurdy@hotmail.com>
>>         >> >         <mailto:i_mccurdy@hotmail.com
>>         <mailto:i_mccurdy@hotmail.com>>>
>>         >> >
>>         >> >             Hi Stefan,
>>         >> >
>>         >> >             I think the problem in your example is that
>>         ftmorf is only
>>         >> >             updated for the first time on the first
>>         k-cycle, even if
>>         >> the
>>         >> >             index is i-rate. Your loop (and tab_i)
>>         operates only at i
>>         >> >             time so reads amp values from imorftab's
>>         initial state
>>         >> >             before any morphing has been carried out.
>>         Another approach
>>         >> >             is to just read values from both tables and
>>         interpolate
>>         >> >             between the two in some way, e.g.
>>         >> >
>>         >> >             ipartamp1    tab_i        indx-1, giPartampsUp
>>         >> >             ipartamp2    tab_i        indx-1, giPartampsDown
>>         >> >             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
>>         >> >
>>         >> >             I changed kftndx to iftndx as it is only
>>         changed at i
>>         >> time.
>>         >> >
>>         >> >
>>         >>
>>         ------------------------------------------------------------------------
>>         >> >             Date: Tue, 22 Nov 2011 21:53:13 +0100
>>         >> >             From: kontrapunktstefan@googlemail.com
>>         <mailto:kontrapunktstefan@googlemail.com>
>>         >> >             <mailto:kontrapunktstefan@googlemail.com
>>         <mailto:kontrapunktstefan@googlemail.com>>
>>         >> >             To: csound@lists.bath.ac.uk
>>         <mailto:csound@lists.bath.ac.uk>
>>         >> <mailto:csound@lists.bath.ac.uk
>>         <mailto:csound@lists.bath.ac.uk>>
>>         >> >             Subject: [Csnd] trying to assign different
>>         partamps with
>>         >> ftmorf
>>         >> >
>>         >> >
>>         >> >             Dear community,
>>         >> >             I'd been trying to build a additive synth,
>>         that has
>>         >> >             different partamps in different registers.
>>         >> >             I want to use ftmorf for this purpose.
>>         >> >             Unfortunately, in the below quoted snippet,
>>         the partamps
>>         >> are
>>         >> >             always the same, a buzz.
>>         >> >             There is no interpolation.
>>         >> >             I think, it has to do with the table created
>>         by ftgentmp.
>>         >> >             I assume that the gen 10 is'nt the right gen
>>         routine.
>>         >> >             Which one should I use instead?
>>         >> >             <CsoundSynthesizer>
>>         >> >             <CsOptions>
>>         >> >             </CsOptions>
>>         >> >             <CsInstruments>
>>         >> >             sr = 44100
>>         >> >             ksmps = 100
>>         >> >             nchnls = 2
>>         >> >             0dbfs = 1
>>         >> >
>>         >> >             giSine            ftgen        0, 0, 2^10, 10, 1
>>         >> >             ; frequencies of the partials
>>         >> >             giPartfreqs        ftgen        0, 0, -30,
>>         -2, 1, 2, 3, 4,
>>         >> >             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>>         17, 18, 19, 20,
>>         >> >             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>>         >> >             ; amplitudes of the partials
>>         >> >             giPartampsUp        ftgen        0, 0, -32,
>>         -2, 1, 0,
>>         >> >
>>         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>>         >> >             ; sine
>>         >> >             giPartampsDown     ftgen
>>         >> >
>>         >>
>>         0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>>         >> >             ; buzz
>>         >> >             gitabs4morf         ftgen
>>         >> >
>>         >> 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>>         >> >             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>>         >> >             48,0,60,1,72,1,127,1 ; for midinote 48 Wert
>>         1, etc.
>>         >> >                     massign     0, 100
>>         >> >
>>         >> >             instr 100 ;triggered by midi, calls inumparts
>>         instances of
>>         >> >             instr 100
>>         >> >             inumparts    =        30
>>         >> >             imidinot    notnum
>>         >> >             icps         cpsmidi
>>         >> >             iamp        ampmidi     0.05
>>         >> >             idur        =     200*iamp
>>         >> >             indx        =        1 ;we start with the
>>         first partial
>>         >> >             isubinstr    =        101+imidinot/1000 ;e.g.
>>         101.060 for
>>         >> c'
>>         >> >             kftndx         tablei imidinot,
>>         gipartampregistertab
>>         >> >             imorphtab     ftgentmp 0,0,-32,10,1
>>         >> >             ftmorf        kftndx, gitabs4morf, imorphtab
>>         >> >             loop:
>>         >> >             ipartamp    tab_i        indx-1, imorphtab
>>         >> >             ipartamp    =        ipartamp * iamp
>>         >> >             ipartfreq    tab_i        indx-1, giPartfreqs
>>         >> >             ipartfreq    =        ipartfreq * icps
>>         >> >                     event_i    "i", isubinstr, 0, idur,
>>         ipartfreq,
>>         >> >             ipartamp, indx, iamp
>>         >> >                     loop_le    indx, 1, inumparts, loop
>>         >> >             krelease    release
>>         >> >              if krelease == 1 then ; note off event
>>         >> >                      turnoff2    isubinstr, 4, 1
>>         >> >              endif
>>         >> >             endin
>>         >> >
>>         >> >
>>         >> >             instr 101 ; plays one partial
>>         >> >             idur        =        p3 ;duration
>>         >> >             ifreq        =        p4 ;frequency
>>         >> >             iamp        =        p5 ;amplitude
>>         >> >             ittnr        =        p6 ;partial number
>>         >> >             ivel        =        p7 ; velocity
>>         >> >             asig        poscil        iamp, ifreq, giSine
>>         >> >             aenv        expsegr    0.01, 0.01, 1,
>>         idur-0.1, .001,
>>         >> .2,.00001
>>         >> >             aout        =        asig * aenv
>>         >> >
>>         >> >                     outs         aout, aout
>>         >> >             endin
>>         >> >
>>         >> >
>>         >> >             </CsInstruments>
>>         >> >             <CsScore>
>>         >> >             f 0 36
>>         >> >             i 100 0 36
>>         >> >             </CsScore>
>>         >> >             </CsoundSynthesizer>
>>         >> >
>>         >> >
>>         >> >
>>         >> >
>>         >>
>>         >>
>>         >> Send bugs reports to the Sourceforge bug tracker
>>         >>
>>          https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>         <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>>         >> Discussions of bugs and features can be posted here
>>         >> To unsubscribe, send email sympa@lists.bath.ac.uk
>>         <mailto:sympa@lists.bath.ac.uk> with body "unsubscribe
>>         >> csound"
>>         >>
>>         >>
>>         >
>>         > Send bugs reports to the Sourceforge bug tracker
>>         >
>>         https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>         <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>>         > Discussions of bugs and features can be posted here
>>         > To unsubscribe, send email sympa@lists.bath.ac.uk
>>         <mailto:sympa@lists.bath.ac.uk> with body "unsubscribe
>>         > csound"
>>         >
>>         >
>>
>>
>>
>>
>>         Send bugs reports to the Sourceforge bug tracker
>>
>>          https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>         <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>>         Discussions of bugs and features can be posted here
>>         To unsubscribe, send email sympa@lists.bath.ac.uk
>>         <mailto:sympa@lists.bath.ac.uk> with body "unsubscribe csound"
>>
>>
>
>     Dr Victor Lazzarini
>     Senior Lecturer
>     Dept. of Music
>     NUI Maynooth Ireland
>     tel.: +353 1 708 3545 <tel:%2B353%201%20708%203545>
>     Victor dot Lazzarini AT nuim dot ie
>
>
>
>


Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-11-27 15:13
Fromjoachim heintz
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
this is because you started your "gipartampregistertab" table with midi
note 48. you must insert here the lowest possible (or used) midi note
number.

	joachim


Am 27.11.2011 15:52, schrieb Stefan Thomas:
> Dear Joachim,
> when I try Your code everything works fine, but when I play very low notes,
> I get error messages like this:
> INIT ERROR in instr 100: tab_i: incorrect table number
> ipartamp2       tab_i   #i7     ift2    0
> This happens when I play midi-note 36.
> I have no idea what could be the reason for that.
> 
> 
> 2011/11/27 joachim heintz >
> 
>     csound simply starts at 101 for the first ftgen in your code, and then
>     counts up. as you have six ftables, they get the numbers 101 to 106. the
>     usual console output (don't use the option -m128) contains the lines:
>     ...
>     0dBFS level = 1.0
>     ftable 101:
>     ftable 102:
>     ftable 103:
>     ftable 104:
>     ftable 105:
>     ftable 106:
>     chnl 1 using instr 100
>     ...
>     in general, this number is stored in the variable which you set as
>     output argument. in your case, these are the variables giSine,
>     giPartfreqs, giPartampsUp, giPartampsDown, and so on. you can see the
>     number by simply printing:
>     print giSine, giPartfreqs, giPartampsUp, giPartampsDown
>     returns:
>     giSine = 101.000  giPartfreqs = 102.000  giPartampsUp = 103.000
>     giPartampsDown = 104.000
> 
>            joachim
> 
> 
> 
>     Am 27.11.2011 11:38, schrieb Stefan Thomas:
>     > Ok, thanks!
>     > I've got it now.
>     > I would like to ask one last questions concerning this subject.
>     > Where does csound "tell" me, which number it has choosen for the
>     ftables?
>     >
>     > 2011/11/27 Victor Lazzarini      
>     > >>
>     >
>     >     >>> def midi2cps(note): return (2**((note-69)/12.))*440
>     >     ...
>     >     >>> midi2cps(60)
>     >     261.62556530059862
>     >     >>> midi2cps(51)
>     >     155.56349186104046
>     >
>     >
>     >     On 27 Nov 2011, at 10:16, Stefan Thomas wrote:
>     >
>     >>     But shouldn't be midinumber 51 around 155 Hz?
>     >>     Afaik midi-note 60 is around 261 Hz, isn't it?
>     >>
>     >>     2011/11/26 
>     >>
>     >>
>     >>         MIDI note numbers are just codes
>     >>         103.750 is a frequency in Hertz
>     >>
>     >>         >
>     >>
>     >>          Dear Joachim,
>     >>         > Yes, You are right, it was a stupid mistake of me!
>     >>         > Of course, the higher notes should be sine-waves.
>     >>         > But what I still don't understand (maybee, it is very again
>     >>         very late at
>     >>         > the moment) is:
>     >>         > why is e flat (below middle c) is iftndx 103.750? Afaik
>     this
>     >>         note is midi
>     >>         > number 51 and not 103.750.
>     >>         > Is there a relation to isubinstr?
>     >>         > Please give me a hint!
>     >>         > Thanks
>     >>         > Stefan
>     >>         > 2011/11/26 joachim heintz      
>     >>         >>
>     >>         >
>     >>         >> hi stefan -
>     >>         >>
>     >>         >> in your code, you define the table "giPartampsDown" as
>     >>         buzz, and
>     >>         >> "giPartampsUp" as sine. so i thought you wanted to
>     play the
>     >>         lower notes
>     >>         >> gradually more and more like a buzz, and the upper notes
>     >>         more and more
>     >>         >> like a sine. was i wrong?
>     >>         >>
>     >>         >> to your question: iftndx is for instance 103.750 (when you
>     >>         play e flat).
>     >>         >> then floor(iftndx) is 103, and ceil(iftndx) is 104, and
>     >>         iweight is 0.75,
>     >>         >> and means that the partials in the tables are weighted as
>     >>         75% table 104
>     >>         >> and 25% table 103.
>     >>         >>
>     >>         >> it would be easy to swap the tables so that the lower
>     notes
>     >>         are more
>     >>         >> sine-like, and the upper more buzz-like. but if iain's
>     >>         suggestions works
>     >>         >> for you, this is probably the best.
>     >>         >>
>     >>         >> tschüss -
>     >>         >>
>     >>         >>        joachim
>     >>         >>
>     >>         >>
>     >>         >>
>     >>         >> Am 26.11.2011 21:02, schrieb Stefan Thomas:
>     >>         >> > Dear Joachim,
>     >>         >> > I was able to try Your code now, but it doesn't seem to
>     >>         work like
>     >>         >> expected.
>     >>         >> > I can hear the sine wave, when I play midi-note number
>     >>         60, below this
>     >>         >> > value I can hear the buzz, but I would expect the
>     opposite.
>     >>         >> > And I don't understand what You mean with Your
>     >>         annotations in the
>     >>         >> > following lines:
>     >>         >> > ift1 = floor(iftndx) ; for instance table 103
>     >>         >> > ift2 = ceil(iftndx) ;for instance table 104
>     >>         >> > iweight = frac(iftndx) ;for instance 0.8
>     >>         >> >
>     >>         >> >
>     >>         >> >
>     >>         >> > 2011/11/26 Stefan Thomas
>     >>              
>     >>              >
>     >>         >> >      
>     >>              >>>
>     >>         >> >
>     >>         >> >     Dear Ian,
>     >>         >> >     thank You for Your suggestion.
>     >>         >> >     I've tried Your code with my older machine (which
>     >>         comes very
>     >>         >> easily
>     >>         >> >     to it's limit) but it works.
>     >>         >> >     What I would like to know is: what should I do if
>     >>         wanted to use
>     >>         >> not
>     >>         >> >     only 2 tables for the partamps but 3 or more?
>     >>         >> >
>     >>         >> >
>     >>         >> >     2011/11/24 Stefan Thomas
>     >>              
>     >>              >
>     >>         >> >          
>     >>              >>>
>     >>         >> >
>     >>         >> >         Thank You all for Your help.
>     >>         >> >         I couldn't try Your code because my computer has
>     >>         to be
>     >>         >> repaired.
>     >>         >> >         I will try Your suggestions as soon as poosible!
>     >>         >> >
>     >>         >> >
>     >>         >> >         2011/11/23 Iain McCurdy
>     
>     >>         >
>     >>         >> >              
>     >>              >>>
>     >>         >> >
>     >>         >> >             Hi Stefan,
>     >>         >> >
>     >>         >> >             I think the problem in your example is that
>     >>         ftmorf is only
>     >>         >> >             updated for the first time on the first
>     >>         k-cycle, even if
>     >>         >> the
>     >>         >> >             index is i-rate. Your loop (and tab_i)
>     >>         operates only at i
>     >>         >> >             time so reads amp values from imorftab's
>     >>         initial state
>     >>         >> >             before any morphing has been carried out.
>     >>         Another approach
>     >>         >> >             is to just read values from both tables and
>     >>         interpolate
>     >>         >> >             between the two in some way, e.g.
>     >>         >> >
>     >>         >> >             ipartamp1    tab_i        indx-1,
>     giPartampsUp
>     >>         >> >             ipartamp2    tab_i        indx-1,
>     giPartampsDown
>     >>         >> >             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
>     >>         >> >
>     >>         >> >             I changed kftndx to iftndx as it is only
>     >>         changed at i
>     >>         >> time.
>     >>         >> >
>     >>         >> >
>     >>         >>
>     >>        
>     ------------------------------------------------------------------------
>     >>         >> >             Date: Tue, 22 Nov 2011 21:53:13 +0100
>     >>         >> >             From: kontrapunktstefan@googlemail.com
>     
>     >>              >
>     >>         >> >                  
>     >>              >>
>     >>         >> >             To: csound@lists.bath.ac.uk
>     
>     >>              >
>     >>         >>      
>     >>              >>
>     >>         >> >             Subject: [Csnd] trying to assign different
>     >>         partamps with
>     >>         >> ftmorf
>     >>         >> >
>     >>         >> >
>     >>         >> >             Dear community,
>     >>         >> >             I'd been trying to build a additive synth,
>     >>         that has
>     >>         >> >             different partamps in different registers.
>     >>         >> >             I want to use ftmorf for this purpose.
>     >>         >> >             Unfortunately, in the below quoted snippet,
>     >>         the partamps
>     >>         >> are
>     >>         >> >             always the same, a buzz.
>     >>         >> >             There is no interpolation.
>     >>         >> >             I think, it has to do with the table created
>     >>         by ftgentmp.
>     >>         >> >             I assume that the gen 10 is'nt the right gen
>     >>         routine.
>     >>         >> >             Which one should I use instead?
>     >>         >> >             
>     >>         >> >             
>     >>         >> >             
>     >>         >> >             
>     >>         >> >             sr = 44100
>     >>         >> >             ksmps = 100
>     >>         >> >             nchnls = 2
>     >>         >> >             0dbfs = 1
>     >>         >> >
>     >>         >> >             giSine            ftgen        0, 0,
>     2^10, 10, 1
>     >>         >> >             ; frequencies of the partials
>     >>         >> >             giPartfreqs        ftgen        0, 0, -30,
>     >>         -2, 1, 2, 3, 4,
>     >>         >> >             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>     >>         17, 18, 19, 20,
>     >>         >> >             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>     >>         >> >             ; amplitudes of the partials
>     >>         >> >             giPartampsUp        ftgen        0, 0, -32,
>     >>         -2, 1, 0,
>     >>         >> >
>     >>         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>     >>         >> >             ; sine
>     >>         >> >             giPartampsDown     ftgen
>     >>         >> >
>     >>         >>
>     >>        
>     0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>     >>         >> >             ; buzz
>     >>         >> >             gitabs4morf         ftgen
>     >>         >> >
>     >>         >>
>     0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>     >>         >> >             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>     >>         >> >             48,0,60,1,72,1,127,1 ; for midinote 48 Wert
>     >>         1, etc.
>     >>         >> >                     massign     0, 100
>     >>         >> >
>     >>         >> >             instr 100 ;triggered by midi, calls
>     inumparts
>     >>         instances of
>     >>         >> >             instr 100
>     >>         >> >             inumparts    =        30
>     >>         >> >             imidinot    notnum
>     >>         >> >             icps         cpsmidi
>     >>         >> >             iamp        ampmidi     0.05
>     >>         >> >             idur        =     200*iamp
>     >>         >> >             indx        =        1 ;we start with the
>     >>         first partial
>     >>         >> >             isubinstr    =        101+imidinot/1000
>     ;e.g.
>     >>         101.060 for
>     >>         >> c'
>     >>         >> >             kftndx         tablei imidinot,
>     >>         gipartampregistertab
>     >>         >> >             imorphtab     ftgentmp 0,0,-32,10,1
>     >>         >> >             ftmorf        kftndx, gitabs4morf, imorphtab
>     >>         >> >             loop:
>     >>         >> >             ipartamp    tab_i        indx-1, imorphtab
>     >>         >> >             ipartamp    =        ipartamp * iamp
>     >>         >> >             ipartfreq    tab_i        indx-1,
>     giPartfreqs
>     >>         >> >             ipartfreq    =        ipartfreq * icps
>     >>         >> >                     event_i    "i", isubinstr, 0, idur,
>     >>         ipartfreq,
>     >>         >> >             ipartamp, indx, iamp
>     >>         >> >                     loop_le    indx, 1, inumparts, loop
>     >>         >> >             krelease    release
>     >>         >> >              if krelease == 1 then ; note off event
>     >>         >> >                      turnoff2    isubinstr, 4, 1
>     >>         >> >              endif
>     >>         >> >             endin
>     >>         >> >
>     >>         >> >
>     >>         >> >             instr 101 ; plays one partial
>     >>         >> >             idur        =        p3 ;duration
>     >>         >> >             ifreq        =        p4 ;frequency
>     >>         >> >             iamp        =        p5 ;amplitude
>     >>         >> >             ittnr        =        p6 ;partial number
>     >>         >> >             ivel        =        p7 ; velocity
>     >>         >> >             asig        poscil        iamp, ifreq,
>     giSine
>     >>         >> >             aenv        expsegr    0.01, 0.01, 1,
>     >>         idur-0.1, .001,
>     >>         >> .2,.00001
>     >>         >> >             aout        =        asig * aenv
>     >>         >> >
>     >>         >> >                     outs         aout, aout
>     >>         >> >             endin
>     >>         >> >
>     >>         >> >
>     >>         >> >             
>     >>         >> >             
>     >>         >> >             f 0 36
>     >>         >> >             i 100 0 36
>     >>         >> >             
>     >>         >> >             
>     >>         >> >
>     >>         >> >
>     >>         >> >
>     >>         >> >
>     >>         >>
>     >>         >>
>     >>         >> Send bugs reports to the Sourceforge bug tracker
>     >>         >>
>     >>        
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     
>     >>        
>          >
>     >>         >> Discussions of bugs and features can be posted here
>     >>         >> To unsubscribe, send email sympa@lists.bath.ac.uk
>     
>     >>              > with body "unsubscribe
>     >>         >> csound"
>     >>         >>
>     >>         >>
>     >>         >
>     >>         > Send bugs reports to the Sourceforge bug tracker
>     >>         >
>     >>        
>     https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     
>     >>        
>          >
>     >>         > Discussions of bugs and features can be posted here
>     >>         > To unsubscribe, send email sympa@lists.bath.ac.uk
>     
>     >>              > with body "unsubscribe
>     >>         > csound"
>     >>         >
>     >>         >
>     >>
>     >>
>     >>
>     >>
>     >>         Send bugs reports to the Sourceforge bug tracker
>     >>
>     >>        
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     
>     >>        
>          >
>     >>         Discussions of bugs and features can be posted here
>     >>         To unsubscribe, send email sympa@lists.bath.ac.uk
>     
>     >>              > with body "unsubscribe csound"
>     >>
>     >>
>     >
>     >     Dr Victor Lazzarini
>     >     Senior Lecturer
>     >     Dept. of Music
>     >     NUI Maynooth Ireland
>     >     tel.: +353 1 708 3545 
>     
>     >     Victor dot Lazzarini AT nuim dot ie
>     >
>     >
>     >
>     >
> 
> 
>     Send bugs reports to the Sourceforge bug tracker
>              
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email sympa@lists.bath.ac.uk
>      with body "unsubscribe csound"
> 
> 


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-11-28 12:55
FromIain McCurdy
SubjectRE: [Csnd] trying to assign different partamps with ftmorf
Attachmentsftmorphi.csd  
Dear Stefan,

Sorry for the delay in replying to your question. In response I thought that perhaps an i-rate version of ftmorf is the best solution for what you are trying to achieve so I wrote a simple UDO 'ftmorfi' which works identically to ftmorf (I think) but at i-time. The attached example morphs between three distinct GEN10 tables across the midi keyboard range. The UDO uses the opcode tablemix, it mixes two tables at i-time - it reality ftmorf only ever morphs between two tables at a time so using tablemix is fine as a replacement as long as it is using the correct two tables. as a suggestion, the attached example might benefit from using something other than a simple linear proportional relationship between the two gains of the tables - e.g. raising igain1 and igain2 to the power of two (^2) might provide a smoother morphing across the keyboard.

Hope this helps,
Iain 


Date: Sat, 26 Nov 2011 20:52:13 +0100
From: kontrapunktstefan@googlemail.com
To: csound@lists.bath.ac.uk
Subject: Re: [Csnd] trying to assign different partamps with ftmorf

Dear Ian,
thank You for Your suggestion.
I've tried Your code with my older machine (which comes very easily to it's limit) but it works. 
What I would like to know is: what should I do if wanted to use not only 2 tables for the partamps but 3 or more?


2011/11/24 Stefan Thomas 

Thank You all for Your help.
I couldn't try Your code because my computer has to be repaired.
I will try Your suggestions as soon as poosible!


2011/11/23 Iain McCurdy 






Hi Stefan,
I think the problem in your example is that ftmorf is only updated for the first time on the first k-cycle, even if the index is i-rate. Your loop (and tab_i) operates only at i time so reads amp values from imorftab's initial state before any morphing has been carried out. Another approach is to just read values from both tables and interpolate between the two in some way, e.g.


ipartamp1    tab_i        indx-1, giPartampsUpipartamp2    tab_i        indx-1, giPartampsDownipartamp ntrpol ipartamp1,ipartamp2,iftndx
I changed kftndx to iftndx as it is only changed at i time.


Date: Tue, 22 Nov 2011 21:53:13 +0100
From: kontrapunktstefan@googlemail.com
To: csound@lists.bath.ac.uk


Subject: [Csnd] trying to assign different partamps with ftmorf

Dear community,
I'd been trying to build a additive synth, that has different partamps in different registers.
I want to use ftmorf for this purpose. 


Unfortunately, in the below quoted snippet, the partamps are always the same, a buzz.

There is no interpolation.
I think, it has to do with the table created by ftgentmp.
I assume that the gen 10 is'nt the right gen routine.
Which one should I use instead?







sr = 44100
ksmps = 100
nchnls = 2
0dbfs = 1

giSine            ftgen        0, 0, 2^10, 10, 1
; frequencies of the partials
giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30



; amplitudes of the partials
giPartampsUp        ftgen        0, 0, -32, -2, 1, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
giPartampsDown     ftgen        0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5 ; buzz



gitabs4morf         ftgen 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
        massign     0, 100 




instr 100 ;triggered by midi, calls inumparts instances of instr 100 
inumparts    =        30 
imidinot    notnum
icps         cpsmidi 
iamp        ampmidi     0.05
idur        =     200*iamp 
indx        =        1 ;we start with the first partial



isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
kftndx         tablei imidinot, gipartampregistertab
imorphtab     ftgentmp 0,0,-32,10,1
ftmorf        kftndx, gitabs4morf, imorphtab
loop:


ipartamp    tab_i        indx-1, imorphtab

ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
        event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp


        loop_le    indx, 1, inumparts, loop 

krelease    release    
 if krelease == 1 then ; note off event
         turnoff2    isubinstr, 4, 1
 endif
endin


instr 101 ; plays one partial
idur        =        p3 ;duration
ifreq        =        p4 ;frequency



iamp        =        p5 ;amplitude
ittnr        =        p6 ;partial number
ivel        =        p7 ; velocity
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001



aout        =        asig * aenv 

        outs         aout, aout
endin




f 0 36
i 100 0 36 




 		 	   		  



 		 	   		  
Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-11-28 22:10
FromStefan Thomas
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
Dear Joachim,
Yes, I didn't see this!
Now it works fine. Thanks for Your help!
Stefan

2011/11/27 joachim heintz <jh@joachimheintz.de>
this is because you started your "gipartampregistertab" table with midi
note 48. you must insert here the lowest possible (or used) midi note
number.

       joachim


Am 27.11.2011 15:52, schrieb Stefan Thomas:
> Dear Joachim,
> when I try Your code everything works fine, but when I play very low notes,
> I get error messages like this:
> INIT ERROR in instr 100: tab_i: incorrect table number
> ipartamp2       tab_i   #i7     ift2    0
> This happens when I play midi-note 36.
> I have no idea what could be the reason for that.
>
>
> 2011/11/27 joachim heintz <jh@joachimheintz.de <mailto:jh@joachimheintz.de>>
>
>     csound simply starts at 101 for the first ftgen in your code, and then
>     counts up. as you have six ftables, they get the numbers 101 to 106. the
>     usual console output (don't use the option -m128) contains the lines:
>     ...
>     0dBFS level = 1.0
>     ftable 101:
>     ftable 102:
>     ftable 103:
>     ftable 104:
>     ftable 105:
>     ftable 106:
>     chnl 1 using instr 100
>     ...
>     in general, this number is stored in the variable which you set as
>     output argument. in your case, these are the variables giSine,
>     giPartfreqs, giPartampsUp, giPartampsDown, and so on. you can see the
>     number by simply printing:
>     print giSine, giPartfreqs, giPartampsUp, giPartampsDown
>     returns:
>     giSine = 101.000  giPartfreqs = 102.000  giPartampsUp = 103.000
>     giPartampsDown = 104.000
>
>            joachim
>
>
>
>     Am 27.11.2011 11:38, schrieb Stefan Thomas:
>     > Ok, thanks!
>     > I've got it now.
>     > I would like to ask one last questions concerning this subject.
>     > Where does csound "tell" me, which number it has choosen for the
>     ftables?
>     >
>     > 2011/11/27 Victor Lazzarini <Victor.Lazzarini@nuim.ie
>     <mailto:Victor.Lazzarini@nuim.ie>
>     > <mailto:Victor.Lazzarini@nuim.ie <mailto:Victor.Lazzarini@nuim.ie>>>
>     >
>     >     >>> def midi2cps(note): return (2**((note-69)/12.))*440
>     >     ...
>     >     >>> midi2cps(60)
>     >     261.62556530059862
>     >     >>> midi2cps(51)
>     >     155.56349186104046
>     >
>     >
>     >     On 27 Nov 2011, at 10:16, Stefan Thomas wrote:
>     >
>     >>     But shouldn't be midinumber 51 around 155 Hz?
>     >>     Afaik midi-note 60 is around 261 Hz, isn't it?
>     >>
>     >>     2011/11/26 <jpff@cs.bath.ac.uk <mailto:jpff@cs.bath.ac.uk>
>     <mailto:jpff@cs.bath.ac.uk <mailto:jpff@cs.bath.ac.uk>>>
>     >>
>     >>         MIDI note numbers are just codes
>     >>         103.750 is a frequency in Hertz
>     >>
>     >>         >
>     >>
>     >>          Dear Joachim,
>     >>         > Yes, You are right, it was a stupid mistake of me!
>     >>         > Of course, the higher notes should be sine-waves.
>     >>         > But what I still don't understand (maybee, it is very again
>     >>         very late at
>     >>         > the moment) is:
>     >>         > why is e flat (below middle c) is iftndx 103.750? Afaik
>     this
>     >>         note is midi
>     >>         > number 51 and not 103.750.
>     >>         > Is there a relation to isubinstr?
>     >>         > Please give me a hint!
>     >>         > Thanks
>     >>         > Stefan
>     >>         > 2011/11/26 joachim heintz <jh@joachimheintz.de
>     <mailto:jh@joachimheintz.de>
>     >>         <mailto:jh@joachimheintz.de <mailto:jh@joachimheintz.de>>>
>     >>         >
>     >>         >> hi stefan -
>     >>         >>
>     >>         >> in your code, you define the table "giPartampsDown" as
>     >>         buzz, and
>     >>         >> "giPartampsUp" as sine. so i thought you wanted to
>     play the
>     >>         lower notes
>     >>         >> gradually more and more like a buzz, and the upper notes
>     >>         more and more
>     >>         >> like a sine. was i wrong?
>     >>         >>
>     >>         >> to your question: iftndx is for instance 103.750 (when you
>     >>         play e flat).
>     >>         >> then floor(iftndx) is 103, and ceil(iftndx) is 104, and
>     >>         iweight is 0.75,
>     >>         >> and means that the partials in the tables are weighted as
>     >>         75% table 104
>     >>         >> and 25% table 103.
>     >>         >>
>     >>         >> it would be easy to swap the tables so that the lower
>     notes
>     >>         are more
>     >>         >> sine-like, and the upper more buzz-like. but if iain's
>     >>         suggestions works
>     >>         >> for you, this is probably the best.
>     >>         >>
>     >>         >> tschüss -
>     >>         >>
>     >>         >>        joachim
>     >>         >>
>     >>         >>
>     >>         >>
>     >>         >> Am 26.11.2011 21:02, schrieb Stefan Thomas:
>     >>         >> > Dear Joachim,
>     >>         >> > I was able to try Your code now, but it doesn't seem to
>     >>         work like
>     >>         >> expected.
>     >>         >> > I can hear the sine wave, when I play midi-note number
>     >>         60, below this
>     >>         >> > value I can hear the buzz, but I would expect the
>     opposite.
>     >>         >> > And I don't understand what You mean with Your
>     >>         annotations in the
>     >>         >> > following lines:
>     >>         >> > ift1 = floor(iftndx) ; for instance table 103
>     >>         >> > ift2 = ceil(iftndx) ;for instance table 104
>     >>         >> > iweight = frac(iftndx) ;for instance 0.8
>     >>         >> >
>     >>         >> >
>     >>         >> >
>     >>         >> > 2011/11/26 Stefan Thomas
>     >>         <kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>
>     >>         <mailto:kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>>
>     >>         >> > <mailto:kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>
>     >>         <mailto:kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>>>>
>     >>         >> >
>     >>         >> >     Dear Ian,
>     >>         >> >     thank You for Your suggestion.
>     >>         >> >     I've tried Your code with my older machine (which
>     >>         comes very
>     >>         >> easily
>     >>         >> >     to it's limit) but it works.
>     >>         >> >     What I would like to know is: what should I do if
>     >>         wanted to use
>     >>         >> not
>     >>         >> >     only 2 tables for the partamps but 3 or more?
>     >>         >> >
>     >>         >> >
>     >>         >> >     2011/11/24 Stefan Thomas
>     >>         <kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>
>     >>         <mailto:kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>>
>     >>         >> >     <mailto:kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>
>     >>         <mailto:kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>>>>
>     >>         >> >
>     >>         >> >         Thank You all for Your help.
>     >>         >> >         I couldn't try Your code because my computer has
>     >>         to be
>     >>         >> repaired.
>     >>         >> >         I will try Your suggestions as soon as poosible!
>     >>         >> >
>     >>         >> >
>     >>         >> >         2011/11/23 Iain McCurdy
>     <i_mccurdy@hotmail.com <mailto:i_mccurdy@hotmail.com>
>     >>         <mailto:i_mccurdy@hotmail.com <mailto:i_mccurdy@hotmail.com>>
>     >>         >> >         <mailto:i_mccurdy@hotmail.com
>     <mailto:i_mccurdy@hotmail.com>
>     >>         <mailto:i_mccurdy@hotmail.com
>     <mailto:i_mccurdy@hotmail.com>>>>
>     >>         >> >
>     >>         >> >             Hi Stefan,
>     >>         >> >
>     >>         >> >             I think the problem in your example is that
>     >>         ftmorf is only
>     >>         >> >             updated for the first time on the first
>     >>         k-cycle, even if
>     >>         >> the
>     >>         >> >             index is i-rate. Your loop (and tab_i)
>     >>         operates only at i
>     >>         >> >             time so reads amp values from imorftab's
>     >>         initial state
>     >>         >> >             before any morphing has been carried out.
>     >>         Another approach
>     >>         >> >             is to just read values from both tables and
>     >>         interpolate
>     >>         >> >             between the two in some way, e.g.
>     >>         >> >
>     >>         >> >             ipartamp1    tab_i        indx-1,
>     giPartampsUp
>     >>         >> >             ipartamp2    tab_i        indx-1,
>     giPartampsDown
>     >>         >> >             ipartamp ntrpol ipartamp1,ipartamp2,iftndx
>     >>         >> >
>     >>         >> >             I changed kftndx to iftndx as it is only
>     >>         changed at i
>     >>         >> time.
>     >>         >> >
>     >>         >> >
>     >>         >>
>     >>
>     ------------------------------------------------------------------------
>     >>         >> >             Date: Tue, 22 Nov 2011 21:53:13 +0100
>     >>         >> >             From: kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>
>     >>         <mailto:kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>>
>     >>         >> >             <mailto:kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>
>     >>         <mailto:kontrapunktstefan@googlemail.com
>     <mailto:kontrapunktstefan@googlemail.com>>>
>     >>         >> >             To: csound@lists.bath.ac.uk
>     <mailto:csound@lists.bath.ac.uk>
>     >>         <mailto:csound@lists.bath.ac.uk
>     <mailto:csound@lists.bath.ac.uk>>
>     >>         >> <mailto:csound@lists.bath.ac.uk
>     <mailto:csound@lists.bath.ac.uk>
>     >>         <mailto:csound@lists.bath.ac.uk
>     <mailto:csound@lists.bath.ac.uk>>>
>     >>         >> >             Subject: [Csnd] trying to assign different
>     >>         partamps with
>     >>         >> ftmorf
>     >>         >> >
>     >>         >> >
>     >>         >> >             Dear community,
>     >>         >> >             I'd been trying to build a additive synth,
>     >>         that has
>     >>         >> >             different partamps in different registers.
>     >>         >> >             I want to use ftmorf for this purpose.
>     >>         >> >             Unfortunately, in the below quoted snippet,
>     >>         the partamps
>     >>         >> are
>     >>         >> >             always the same, a buzz.
>     >>         >> >             There is no interpolation.
>     >>         >> >             I think, it has to do with the table created
>     >>         by ftgentmp.
>     >>         >> >             I assume that the gen 10 is'nt the right gen
>     >>         routine.
>     >>         >> >             Which one should I use instead?
>     >>         >> >             <CsoundSynthesizer>
>     >>         >> >             <CsOptions>
>     >>         >> >             </CsOptions>
>     >>         >> >             <CsInstruments>
>     >>         >> >             sr = 44100
>     >>         >> >             ksmps = 100
>     >>         >> >             nchnls = 2
>     >>         >> >             0dbfs = 1
>     >>         >> >
>     >>         >> >             giSine            ftgen        0, 0,
>     2^10, 10, 1
>     >>         >> >             ; frequencies of the partials
>     >>         >> >             giPartfreqs        ftgen        0, 0, -30,
>     >>         -2, 1, 2, 3, 4,
>     >>         >> >             5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>     >>         17, 18, 19, 20,
>     >>         >> >             21, 22, 23, 24, 25, 26, 27, 28, 29, 30
>     >>         >> >             ; amplitudes of the partials
>     >>         >> >             giPartampsUp        ftgen        0, 0, -32,
>     >>         -2, 1, 0,
>     >>         >> >
>     >>         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>     >>         >> >             ; sine
>     >>         >> >             giPartampsDown     ftgen
>     >>         >> >
>     >>         >>
>     >>
>     0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5
>     >>         >> >             ; buzz
>     >>         >> >             gitabs4morf         ftgen
>     >>         >> >
>     >>         >>
>     0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
>     >>         >> >             gipartampregistertab ftgen 0,0,128,-27, 0,0,
>     >>         >> >             48,0,60,1,72,1,127,1 ; for midinote 48 Wert
>     >>         1, etc.
>     >>         >> >                     massign     0, 100
>     >>         >> >
>     >>         >> >             instr 100 ;triggered by midi, calls
>     inumparts
>     >>         instances of
>     >>         >> >             instr 100
>     >>         >> >             inumparts    =        30
>     >>         >> >             imidinot    notnum
>     >>         >> >             icps         cpsmidi
>     >>         >> >             iamp        ampmidi     0.05
>     >>         >> >             idur        =     200*iamp
>     >>         >> >             indx        =        1 ;we start with the
>     >>         first partial
>     >>         >> >             isubinstr    =        101+imidinot/1000
>     ;e.g.
>     >>         101.060 for
>     >>         >> c'
>     >>         >> >             kftndx         tablei imidinot,
>     >>         gipartampregistertab
>     >>         >> >             imorphtab     ftgentmp 0,0,-32,10,1
>     >>         >> >             ftmorf        kftndx, gitabs4morf, imorphtab
>     >>         >> >             loop:
>     >>         >> >             ipartamp    tab_i        indx-1, imorphtab
>     >>         >> >             ipartamp    =        ipartamp * iamp
>     >>         >> >             ipartfreq    tab_i        indx-1,
>     giPartfreqs
>     >>         >> >             ipartfreq    =        ipartfreq * icps
>     >>         >> >                     event_i    "i", isubinstr, 0, idur,
>     >>         ipartfreq,
>     >>         >> >             ipartamp, indx, iamp
>     >>         >> >                     loop_le    indx, 1, inumparts, loop
>     >>         >> >             krelease    release
>     >>         >> >              if krelease == 1 then ; note off event
>     >>         >> >                      turnoff2    isubinstr, 4, 1
>     >>         >> >              endif
>     >>         >> >             endin
>     >>         >> >
>     >>         >> >
>     >>         >> >             instr 101 ; plays one partial
>     >>         >> >             idur        =        p3 ;duration
>     >>         >> >             ifreq        =        p4 ;frequency
>     >>         >> >             iamp        =        p5 ;amplitude
>     >>         >> >             ittnr        =        p6 ;partial number
>     >>         >> >             ivel        =        p7 ; velocity
>     >>         >> >             asig        poscil        iamp, ifreq,
>     giSine
>     >>         >> >             aenv        expsegr    0.01, 0.01, 1,
>     >>         idur-0.1, .001,
>     >>         >> .2,.00001
>     >>         >> >             aout        =        asig * aenv
>     >>         >> >
>     >>         >> >                     outs         aout, aout
>     >>         >> >             endin
>     >>         >> >
>     >>         >> >
>     >>         >> >             </CsInstruments>
>     >>         >> >             <CsScore>
>     >>         >> >             f 0 36
>     >>         >> >             i 100 0 36
>     >>         >> >             </CsScore>
>     >>         >> >             </CsoundSynthesizer>
>     >>         >> >
>     >>         >> >
>     >>         >> >
>     >>         >> >
>     >>         >>
>     >>         >>
>     >>         >> Send bugs reports to the Sourceforge bug tracker
>     >>         >>
>     >>
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>     >>
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599>>
>     >>         >> Discussions of bugs and features can be posted here
>     >>         >> To unsubscribe, send email sympa@lists.bath.ac.uk
>     <mailto:sympa@lists.bath.ac.uk>
>     >>         <mailto:sympa@lists.bath.ac.uk
>     <mailto:sympa@lists.bath.ac.uk>> with body "unsubscribe
>     >>         >> csound"
>     >>         >>
>     >>         >>
>     >>         >
>     >>         > Send bugs reports to the Sourceforge bug tracker
>     >>         >
>     >>
>     https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>     >>
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599>>
>     >>         > Discussions of bugs and features can be posted here
>     >>         > To unsubscribe, send email sympa@lists.bath.ac.uk
>     <mailto:sympa@lists.bath.ac.uk>
>     >>         <mailto:sympa@lists.bath.ac.uk
>     <mailto:sympa@lists.bath.ac.uk>> with body "unsubscribe
>     >>         > csound"
>     >>         >
>     >>         >
>     >>
>     >>
>     >>
>     >>
>     >>         Send bugs reports to the Sourceforge bug tracker
>     >>
>     >>
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>     >>
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599>>
>     >>         Discussions of bugs and features can be posted here
>     >>         To unsubscribe, send email sympa@lists.bath.ac.uk
>     <mailto:sympa@lists.bath.ac.uk>
>     >>         <mailto:sympa@lists.bath.ac.uk
>     <mailto:sympa@lists.bath.ac.uk>> with body "unsubscribe csound"
>     >>
>     >>
>     >
>     >     Dr Victor Lazzarini
>     >     Senior Lecturer
>     >     Dept. of Music
>     >     NUI Maynooth Ireland
>     >     tel.: +353 1 708 3545 <tel:%2B353%201%20708%203545>
>     <tel:%2B353%201%20708%203545>
>     >     Victor dot Lazzarini AT nuim dot ie
>     >
>     >
>     >
>     >
>
>
>     Send bugs reports to the Sourceforge bug tracker
>
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email sympa@lists.bath.ac.uk
>     <mailto:sympa@lists.bath.ac.uk> with body "unsubscribe csound"
>
>


Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-11-28 22:17
FromStefan Thomas
SubjectRe: [Csnd] trying to assign different partamps with ftmorf
Dear Iain,
thank You for Your great work too.
I tried Your code and it also works fine.
It will take some time to understand what You did but I hope I will understand it.
All the best
Stefan

2011/11/28 Iain McCurdy <i_mccurdy@hotmail.com>

Dear Stefan,

Sorry for the delay in replying to your question. In response I thought that perhaps an i-rate version of ftmorf is the best solution for what you are trying to achieve so I wrote a simple UDO 'ftmorfi' which works identically to ftmorf (I think) but at i-time. The attached example morphs between three distinct GEN10 tables across the midi keyboard range. The UDO uses the opcode tablemix, it mixes two tables at i-time - it reality ftmorf only ever morphs between two tables at a time so using tablemix is fine as a replacement as long as it is using the correct two tables. as a suggestion, the attached example might benefit from using something other than a simple linear proportional relationship between the two gains of the tables - e.g. raising igain1 and igain2 to the power of two (^2) might provide a smoother morphing across the keyboard.

Hope this helps,
Iain


Date: Sat, 26 Nov 2011 20:52:13 +0100
From: kontrapunktstefan@googlemail.com
To: csound@lists.bath.ac.uk
Subject: Re: [Csnd] trying to assign different partamps with ftmorf

Dear Ian,
thank You for Your suggestion.
I've tried Your code with my older machine (which comes very easily to it's limit) but it works.
What I would like to know is: what should I do if wanted to use not only 2 tables for the partamps but 3 or more?


2011/11/24 Stefan Thomas <kontrapunktstefan@googlemail.com>

Thank You all for Your help.
I couldn't try Your code because my computer has to be repaired.
I will try Your suggestions as soon as poosible!


2011/11/23 Iain McCurdy <i_mccurdy@hotmail.com>






Hi Stefan,
I think the problem in your example is that ftmorf is only updated for the first time on the first k-cycle, even if the index is i-rate. Your loop (and tab_i) operates only at i time so reads amp values from imorftab's initial state before any morphing has been carried out. Another approach is to just read values from both tables and interpolate between the two in some way, e.g.


ipartamp1    tab_i        indx-1, giPartampsUpipartamp2    tab_i        indx-1, giPartampsDownipartamp ntrpol ipartamp1,ipartamp2,iftndx
I changed kftndx to iftndx as it is only changed at i time.


Date: Tue, 22 Nov 2011 21:53:13 +0100
From: kontrapunktstefan@googlemail.com
To: csound@lists.bath.ac.uk


Subject: [Csnd] trying to assign different partamps with ftmorf

Dear community,
I'd been trying to build a additive synth, that has different partamps in different registers.
I want to use ftmorf for this purpose.


Unfortunately, in the below quoted snippet, the partamps are always the same, a buzz.

There is no interpolation.
I think, it has to do with the table created by ftgentmp.
I assume that the gen 10 is'nt the right gen routine.
Which one should I use instead?
<CsoundSynthesizer>
<CsOptions>



</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 100
nchnls = 2
0dbfs = 1

giSine            ftgen        0, 0, 2^10, 10, 1
; frequencies of the partials
giPartfreqs        ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30



; amplitudes of the partials
giPartampsUp        ftgen        0, 0, -32, -2, 1, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; sine
giPartampsDown     ftgen        0,0,-32,-2,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5 ; buzz



gitabs4morf         ftgen 0,0,4,-2,giPartampsDown,giPartampsUp,giPartampsUp,giPartampsUp
gipartampregistertab ftgen 0,0,128,-27, 0,0, 48,0,60,1,72,1,127,1 ; for midinote 48 Wert 1, etc.
        massign     0, 100




instr 100 ;triggered by midi, calls inumparts instances of instr 100
inumparts    =        30
imidinot    notnum
icps         cpsmidi
iamp        ampmidi     0.05
idur        =     200*iamp
indx        =        1 ;we start with the first partial



isubinstr    =        101+imidinot/1000 ;e.g. 101.060 for c'
kftndx         tablei imidinot, gipartampregistertab
imorphtab     ftgentmp 0,0,-32,10,1
ftmorf        kftndx, gitabs4morf, imorphtab
loop:


ipartamp    tab_i        indx-1, imorphtab

ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
        event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp


        loop_le    indx, 1, inumparts, loop

krelease    release   
 if krelease == 1 then ; note off event
         turnoff2    isubinstr, 4, 1
 endif
endin


instr 101 ; plays one partial
idur        =        p3 ;duration
ifreq        =        p4 ;frequency



iamp        =        p5 ;amplitude
ittnr        =        p6 ;partial number
ivel        =        p7 ; velocity
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001



aout        =        asig * aenv

        outs         aout, aout
endin


</CsInstruments>
<CsScore>
f 0 36
i 100 0 36
</CsScore>
</CsoundSynthesizer>







Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"