Csound Csound-dev Csound-tekno Search About

[Csnd] first attempt with ftmorf

Date2011-11-02 18:58
FromStefan Thomas
Subject[Csnd] first attempt with ftmorf
Dear community,
I've had my first trial with the ftmorf opcode.
I'm glad, that I was able to get it working, but there are some things, which I don't understand.
  1. In the below quoted code, I would expect that one would hear from midi-note 72 until 127 the sinewave. Unfortunately this isn't the case and I can't find the reason for it.
  2. When I play with the midi-keyboard, I can hear some clicks, when I play fast. I assume, this could be a matter of hard or software buffer. Is thre a way to avoid these clicks?
Here is my (musically senseless) code:

<CsoundSynthesizer>
; trying to choose different wave-tables for different midi-notes and trying to get the smoothest possible transitions between these wave-tables
<CsOptions>
</CsOptions>
<CsInstruments>

sr    =    48000
ksmps     =     100
nchnls    =    2
0dbfs    =    1
; the wavetables:
gibuzz ftgen 0, 0, 1024, 10, 1, 1,1,1,1,1,1,1,1
gisaw ftgen 0, 0, 1024, 10, 1, 0.5, 0.3, 0.25, 0.2, 0.16, .142857
gisine ftgen 0, 0, 1024, 10, 1, 0, 0.111, 0, .04, 0, .02040816327
giregistertable    ftgen    0,0,128,-27, 0,0, 48,0,60,1,72,2,127,2
gitabs4morf    ftgen    0,0,3,-2,gibuzz,gisaw,gisine
instr 1   
inote notnum
ilaut veloc
iamp ampmidi 0.3
icps cpsmidi
aenv linsegr 0, 0.02, 1, 1, 0.4,4,0,  0.1,0
    imorphtab    ftgentmp    1,0,1024,10,1
kftndx    tablei    inote, giregistertable
ftmorf        kftndx, gitabs4morf, imorphtab   
asig poscil aenv*iamp, icps, imorphtab
outs asig, asig

endin

</CsInstruments>
; ==============================================
<CsScore>
f0 3600


</CsScore>
</CsoundSynthesizer>



Date2011-11-02 19:24
FromIain McCurdy
SubjectRE: [Csnd] first attempt with ftmorf
Hi Stefan,

I spotted a couple of things:

The function table that holds the list of function table numbers, 'gitabs4morf', needs to be a power of two. Just fill the excess with dummy values and ignore these ones when using the ftmorf index. i.e. gitabs4morf    ftgen    0,0,4,-2,gibuzz,gisaw,gisine,gisine

When you specified a table for morphing in instr 1 you give it a fixed number which means it will be overwritten each time a new note is played - this is causing the clicks as the sustaining note has its table changed. Just give it a zero number to ensure that new tables will be written when polyphony is used.
imorphtab    ftgentmp    0,0,1024,10,1

You might also want to take a look a tabmorpha.

Hope this helps,
Iain



Date: Wed, 2 Nov 2011 19:58:39 +0100
From: kontrapunktstefan@googlemail.com
To: csound@lists.bath.ac.uk
Subject: [Csnd] first attempt with ftmorf

Dear community,
I've had my first trial with the ftmorf opcode.
I'm glad, that I was able to get it working, but there are some things, which I don't understand.
  1. In the below quoted code, I would expect that one would hear from midi-note 72 until 127 the sinewave. Unfortunately this isn't the case and I can't find the reason for it.
  2. When I play with the midi-keyboard, I can hear some clicks, when I play fast. I assume, this could be a matter of hard or software buffer. Is thre a way to avoid these clicks?
Here is my (musically senseless) code:

<CsoundSynthesizer>
; trying to choose different wave-tables for different midi-notes and trying to get the smoothest possible transitions between these wave-tables
<CsOptions>
</CsOptions>
<CsInstruments>

sr    =    48000
ksmps     =     100
nchnls    =    2
0dbfs    =    1
; the wavetables:
gibuzz ftgen 0, 0, 1024, 10, 1, 1,1,1,1,1,1,1,1
gisaw ftgen 0, 0, 1024, 10, 1, 0.5, 0.3, 0.25, 0.2, 0.16, .142857
gisine ftgen 0, 0, 1024, 10, 1, 0, 0.111, 0, .04, 0, .02040816327
giregistertable    ftgen    0,0,128,-27, 0,0, 48,0,60,1,72,2,127,2
gitabs4morf    ftgen    0,0,3,-2,gibuzz,gisaw,gisine
instr 1   
inote notnum
ilaut veloc
iamp ampmidi 0.3
icps cpsmidi
aenv linsegr 0, 0.02, 1, 1, 0.4,4,0,  0.1,0
    imorphtab    ftgentmp    1,0,1024,10,1
kftndx    tablei    inote, giregistertable
ftmorf        kftndx, gitabs4morf, imorphtab   
asig poscil aenv*iamp, icps, imorphtab
outs asig, asig

endin

</CsInstruments>
; ==============================================
<CsScore>
f0 3600


</CsScore>
</CsoundSynthesizer>



Date2011-11-02 19:49
FromStefan Thomas
SubjectRe: [Csnd] first attempt with ftmorf
Dear Iain,
thanks very much!
It works perfectly now. I hope that I can create now more musically senseful examples.


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

I spotted a couple of things:

The function table that holds the list of function table numbers, 'gitabs4morf', needs to be a power of two. Just fill the excess with dummy values and ignore these ones when using the ftmorf index. i.e. gitabs4morf    ftgen    0,0,4,-2,gibuzz,gisaw,gisine,gisine

When you specified a table for morphing in instr 1 you give it a fixed number which means it will be overwritten each time a new note is played - this is causing the clicks as the sustaining note has its table changed. Just give it a zero number to ensure that new tables will be written when polyphony is used.
imorphtab    ftgentmp    0,0,1024,10,1

You might also want to take a look a tabmorpha.

Hope this helps,
Iain



Date: Wed, 2 Nov 2011 19:58:39 +0100
From: kontrapunktstefan@googlemail.com
To: csound@lists.bath.ac.uk
Subject: [Csnd] first attempt with ftmorf


Dear community,
I've had my first trial with the ftmorf opcode.
I'm glad, that I was able to get it working, but there are some things, which I don't understand.
  1. In the below quoted code, I would expect that one would hear from midi-note 72 until 127 the sinewave. Unfortunately this isn't the case and I can't find the reason for it.
  2. When I play with the midi-keyboard, I can hear some clicks, when I play fast. I assume, this could be a matter of hard or software buffer. Is thre a way to avoid these clicks?
Here is my (musically senseless) code:

<CsoundSynthesizer>
; trying to choose different wave-tables for different midi-notes and trying to get the smoothest possible transitions between these wave-tables
<CsOptions>
</CsOptions>
<CsInstruments>

sr    =    48000
ksmps     =     100
nchnls    =    2
0dbfs    =    1
; the wavetables:
gibuzz ftgen 0, 0, 1024, 10, 1, 1,1,1,1,1,1,1,1
gisaw ftgen 0, 0, 1024, 10, 1, 0.5, 0.3, 0.25, 0.2, 0.16, .142857
gisine ftgen 0, 0, 1024, 10, 1, 0, 0.111, 0, .04, 0, .02040816327
giregistertable    ftgen    0,0,128,-27, 0,0, 48,0,60,1,72,2,127,2
gitabs4morf    ftgen    0,0,3,-2,gibuzz,gisaw,gisine
instr 1   
inote notnum
ilaut veloc
iamp ampmidi 0.3
icps cpsmidi
aenv linsegr 0, 0.02, 1, 1, 0.4,4,0,  0.1,0
    imorphtab    ftgentmp    1,0,1024,10,1
kftndx    tablei    inote, giregistertable
ftmorf        kftndx, gitabs4morf, imorphtab   
asig poscil aenv*iamp, icps, imorphtab
outs asig, asig

endin

</CsInstruments>
; ==============================================
<CsScore>
f0 3600


</CsScore>
</CsoundSynthesizer>