Csound Csound-dev Csound-tekno Search About

[Csnd] problem with cent deviations

Date2010-01-23 19:41
FromStefan Thomas
Subject[Csnd] problem with cent deviations
Dear community,
I tried out what I've read in the article "tuning Your midi-keybord", in the last issue of the Csound-Journal. (http://www.csounds.com/journal/issue12/tuningmidikeyboard.html )
But unfortunately I'm not able to get any cent deviation.
I don't understand what I've done wrong.
And I don't understand clearly what the giScale variable does.
If someone could be so kind to explain my ( I guess very dull ) mistake, I would be very thankful.
Here is my example:
<CsoundSynthesizer>
<CsOptions>
-odac -Ma -b128 -B512 --midi-key=4 --midi-velocity-amp=5 -m0
;-odac  -Ma -b128 -B512 --midi-key=4 --midi-velocity-amp=5 -m0d
</CsOptions>
<CsInstruments>
giScale     ftgen         1, 0, -12, -2, 0, -34, -7, 10, -14, 3, -21, -3, -27, -10, 7, -17

                massign 0, 1
instr 1
ikey        =        p4
ivel        =        p5
indx        =        ikey % 12
icent        tab_i        indx, 1
ifreqeq    =        cpsmidinn(ikey)
ifreq        =        ifreqeq * cent(icent)
prints        "Key %d: equal-tempered frequency = %f; frequency with cent deviation %d = %f%n",ikey,ifreqeq,icent,ifreq
kenv            linsegr 0, .1, 1, 0.1, 1, .1, 0

anote           foscil kenv*ivel, ifreq, 1, 1,kenv*5, 1
                out             anote
endin
</CsInstruments>
<CsScore>
f1  0   8193  10   1
f 0 30
e
</CsScore>
</CsoundSynthesizer>


Date2010-01-23 20:51
Fromjoachim heintz
Subject[Csnd] Re: problem with cent deviations
Hi Stefan -

you are using the ftable number 1 twice: in the ftgen statement, and  
in the score statement.
It's better to use the ftgen with 0 as first parameter. Then Csound  
chooses automatically an unique ftable number, and you just have to  
type anywhere giScale as the variable of the function table. So this  
should work:



-odac -Ma -b128 -B512 --midi-key=4 --midi-velocity-amp=5 -m0


giScale ftgen 0, 0, -12, -2, 0, -34, -7, 10, -14, 3, -21, -3, -27,  
-10, 7, -17
massign 0, 1
instr 1
ikey = p4
ivel = p5
indx = ikey % 12
icent tab_i indx, giScale
ifreqeq = cpsmidinn(ikey)
ifreq = ifreqeq * cent(icent)
prints "Key %d: equal-tempered frequency = %f; frequency with cent  
deviation %d = %f%n",ikey,ifreqeq,icent,ifreq
kenv linsegr 0, .1, 1, 0.1, 1, .1, 0
anote foscil kenv*ivel, ifreq, 1, 1,kenv*5, 1
out anote
endin


f1 0 8193 10 1
e 3600



Ciao -

	joachim

Am 23.01.2010 um 20:41 schrieb Stefan Thomas:

> Dear community,
> I tried out what I've read in the article "tuning Your midi- 
> keybord", in the last issue of the Csound-Journal. (http://www.csounds.com/journal/issue12/tuningmidikeyboard.html 
>  )
> But unfortunately I'm not able to get any cent deviation.
> I don't understand what I've done wrong.
> And I don't understand clearly what the giScale variable does.
> If someone could be so kind to explain my ( I guess very dull )  
> mistake, I would be very thankful.
> Here is my example:
> 
> 
> -odac -Ma -b128 -B512 --midi-key=4 --midi-velocity-amp=5 -m0
> ;-odac  -Ma -b128 -B512 --midi-key=4 --midi-velocity-amp=5 -m0d
> 
> 
> giScale     ftgen         1, 0, -12, -2, 0, -34, -7, 10, -14, 3,  
> -21, -3, -27, -10, 7, -17
>
>                 massign 0, 1
> instr 1
> ikey        =        p4
> ivel        =        p5
> indx        =        ikey % 12
> icent        tab_i        indx, 1
> ifreqeq    =        cpsmidinn(ikey)
> ifreq        =        ifreqeq * cent(icent)
> prints        "Key %d: equal-tempered frequency = %f; frequency with  
> cent deviation %d = %f%n",ikey,ifreqeq,icent,ifreq
> kenv            linsegr 0, .1, 1, 0.1, 1, .1, 0
>
> anote           foscil kenv*ivel, ifreq, 1, 1,kenv*5, 1
>                 out             anote
> endin
> 
> 
> f1  0   8193  10   1
> f 0 30
> e
> 
> 
>



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-01-23 20:56
FromStefan Thomas
Subject[Csnd] Re: Re: problem with cent deviations
Dear Joachim,
thanks for Your fast reply.
I was really stupid, but I couldn't find the mistake.
Now it works well!

2010/1/23 joachim heintz <jh@joachimheintz.de>
Hi Stefan -

you are using the ftable number 1 twice: in the ftgen statement, and in the score statement.
It's better to use the ftgen with 0 as first parameter. Then Csound chooses automatically an unique ftable number, and you just have to type anywhere giScale as the variable of the function table. So this should work:


<CsoundSynthesizer>
<CsOptions>
-odac -Ma -b128 -B512 --midi-key=4 --midi-velocity-amp=5 -m0
</CsOptions>
<CsInstruments>
giScale ftgen 0, 0, -12, -2, 0, -34, -7, 10, -14, 3, -21, -3, -27, -10, 7, -17
massign 0, 1
instr 1
ikey = p4
ivel = p5
indx = ikey % 12
icent tab_i indx, giScale

ifreqeq = cpsmidinn(ikey)
ifreq = ifreqeq * cent(icent)
prints "Key %d: equal-tempered frequency = %f; frequency with cent deviation %d = %f%n",ikey,ifreqeq,icent,ifreq
kenv linsegr 0, .1, 1, 0.1, 1, .1, 0
anote foscil kenv*ivel, ifreq, 1, 1,kenv*5, 1
out anote
endin
</CsInstruments>
<CsScore>
f1 0 8193 10 1
e 3600
</CsScore>
</CsoundSynthesizer>

Ciao -

       joachim

Am 23.01.2010 um 20:41 schrieb Stefan Thomas:


Dear community,
I tried out what I've read in the article "tuning Your midi-keybord", in the last issue of the Csound-Journal. (http://www.csounds.com/journal/issue12/tuningmidikeyboard.html )
But unfortunately I'm not able to get any cent deviation.
I don't understand what I've done wrong.
And I don't understand clearly what the giScale variable does.
If someone could be so kind to explain my ( I guess very dull ) mistake, I would be very thankful.
Here is my example:
<CsoundSynthesizer>
<CsOptions>
-odac -Ma -b128 -B512 --midi-key=4 --midi-velocity-amp=5 -m0
;-odac  -Ma -b128 -B512 --midi-key=4 --midi-velocity-amp=5 -m0d
</CsOptions>
<CsInstruments>
giScale     ftgen         1, 0, -12, -2, 0, -34, -7, 10, -14, 3, -21, -3, -27, -10, 7, -17

               massign 0, 1
instr 1
ikey        =        p4
ivel        =        p5
indx        =        ikey % 12
icent        tab_i        indx, 1
ifreqeq    =        cpsmidinn(ikey)
ifreq        =        ifreqeq * cent(icent)
prints        "Key %d: equal-tempered frequency = %f; frequency with cent deviation %d = %f%n",ikey,ifreqeq,icent,ifreq
kenv            linsegr 0, .1, 1, 0.1, 1, .1, 0

anote           foscil kenv*ivel, ifreq, 1, 1,kenv*5, 1
               out             anote
endin
</CsInstruments>
<CsScore>
f1  0   8193  10   1
f 0 30
e
</CsScore>
</CsoundSynthesizer>




Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"