Csound Csound-dev Csound-tekno Search About

[Csnd] midi velocity to number of partials

Date2011-12-08 12:48
Fromzappfinger
Subject[Csnd] midi velocity to number of partials
Suppose I want to convert midi velocity (0-127) to the number of harmonics.
So vel = 10 would mean 10 harmonics, vel=100 would mean 100 harmonics.

Would I have to make 127 wavetables, each filled with one harmonic more and
then switch to a table depending on the velocity?

Of course I could do it with a filter and one table filled with 127
harmonics, but is there an other way?

Richard




--
View this message in context: http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5058653.html
Sent from the Csound - General mailing list archive at Nabble.com.


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-12-08 12:52
FromSteven Yi
SubjectRe: [Csnd] midi velocity to number of partials
Hi Richard,

You can use a recursive UDO.  You may want to check out my article in
the Csound Journal:

http://www.csounds.com/journal/2006summer/controlFlow_part2.html

that discusses recursion. You could create a UDO that plays a sine and
then recurses to call another instance if necessary, up to the number
given by velocity.

steven

On Thu, Dec 8, 2011 at 12:48 PM, zappfinger  wrote:
> Suppose I want to convert midi velocity (0-127) to the number of harmonics.
> So vel = 10 would mean 10 harmonics, vel=100 would mean 100 harmonics.
>
> Would I have to make 127 wavetables, each filled with one harmonic more and
> then switch to a table depending on the velocity?
>
> Of course I could do it with a filter and one table filled with 127
> harmonics, but is there an other way?
>
> Richard
>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5058653.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> 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-12-08 12:52
FromRory Walsh
SubjectRe: [Csnd] midi velocity to number of partials
buzz and gbuzz allow you to dynamically set the number of harmonic partials.


On 8 December 2011 12:48, zappfinger  wrote:
> Suppose I want to convert midi velocity (0-127) to the number of harmonics.
> So vel = 10 would mean 10 harmonics, vel=100 would mean 100 harmonics.
>
> Would I have to make 127 wavetables, each filled with one harmonic more and
> then switch to a table depending on the velocity?
>
> Of course I could do it with a filter and one table filled with 127
> harmonics, but is there an other way?
>
> Richard
>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5058653.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> 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-12-08 20:02
Fromjoachim heintz
SubjectRe: [Csnd] midi velocity to number of partials
i'd say it depends on what you want to do with the single partials. in
natural sounds, each partial 'goes its own way': it has its own envelope
in time. if you want to imitate this behaviour, and create your own
results based on this, you can use something like this:



-m128


sr = 44100
ksmps = 128
nchnls = 1
0dbfs = 1
massign 0, "midi_receive"
gisin ftgen 0, 0, 1025, 10, 1
gienv ftgen 0, 0, 4097, 16, 0, 10, 0, 1, 4087, -6, 0
instr midi_receive
idur = 3
ifreq cpsmidi
ivel veloc
print ivel
indx = 0
loop:
ipart = indx+1 ;number of partial
event_i "i", "play_partial", 0, idur, ifreq, ipart
loop_lt indx, 1, ivel/16, loop
endin
instr play_partial
ifreq = p4
ipart = p5
p3 = p3 * (1/ipart) ;higher partials decay faster
iadd rnd31 p3/3, 0
p3 = p3 + iadd
aenv poscil .1, 1/p3, gienv
apart poscil aenv, ifreq*ipart, gisin
out apart
endin


f 0 99999



this is something like an instrument which reacts as timbre to the
velocity, and adds some random deviations to the partials. you can tell
the play_partial instrument which behaviour you'd like to get.
this (or anything similar) can be put in the form of a recursive udo, as
steven mentioned.
ciao -

	joachim




Am 08.12.2011 13:48, schrieb zappfinger:
> Suppose I want to convert midi velocity (0-127) to the number of harmonics.
> So vel = 10 would mean 10 harmonics, vel=100 would mean 100 harmonics.
> 
> Would I have to make 127 wavetables, each filled with one harmonic more and
> then switch to a table depending on the velocity?
> 
> Of course I could do it with a filter and one table filled with 127
> harmonics, but is there an other way?
> 
> Richard
> 
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5058653.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> 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-12-08 20:13
FromRory Walsh
SubjectRe: [Csnd] midi velocity to number of partials
Nice example Joachim. I've never seen GEN16 used before. When I
checked the manual however it only has 4 p-fields after the GEN
number? Can you explain how you use it? Cheers,

Rory.


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-12-08 20:23
Fromjoachim heintz
SubjectRe: [Csnd] midi velocity to number of partials
thanks, rory. i use gen16 (which i got to know recently by an example
from iain) in the same way as transeg. this seems to work. but i think
you are right; the manual should be corrected to something like
f # time size 16 val1 dur1 type1 val2 [dur2 type2 val3 ... typeX valN]
ciao -
	j


Am 08.12.2011 21:13, schrieb Rory Walsh:
> Nice example Joachim. I've never seen GEN16 used before. When I
> checked the manual however it only has 4 p-fields after the GEN
> number? Can you explain how you use it? Cheers,
> 
> Rory.
> 
> 
> 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-12-08 20:39
Frommenno
Subject[Csnd] Re: midi velocity to number of partials
yes nice example Joachim, if no one objects i will change the manual
accordingly.

greetings
Menno

--
View this message in context: http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5060029.html
Sent from the Csound - General mailing list archive at Nabble.com.


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-12-08 21:15
Fromzappfinger
Subject[Csnd] Re: midi velocity to number of partials
Hmm, I went the buzz road, but it does not work as I expected.
Included is a simple CSD file (ignore the unneeded lines)
When I play louder, I get more harmonics, but the base tones do not stay, so
it looks if buzz does not simply add the harmonics ....

http://csound.1045644.n5.nabble.com/file/n5060122/ESMS.csd ESMS.csd 

--
View this message in context: http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5060122.html
Sent from the Csound - General mailing list archive at Nabble.com.


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-12-08 21:31
FromRory Walsh
SubjectRe: [Csnd] Re: midi velocity to number of partials
Buzz doesn't modify the strengths of the adjacent harmonics so the
more you have the less intense the lower ones become. Try ivel/3 and
you should hear better. If you want something more natural sounding,
i.e., adjacent harmonics getting less intense the higher they go try
using gbuzz.

Rory.


On 8 December 2011 21:15, zappfinger  wrote:
> Hmm, I went the buzz road, but it does not work as I expected.
> Included is a simple CSD file (ignore the unneeded lines)
> When I play louder, I get more harmonics, but the base tones do not stay, so
> it looks if buzz does not simply add the harmonics ....
>
> http://csound.1045644.n5.nabble.com/file/n5060122/ESMS.csd ESMS.csd
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5060122.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> 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-12-10 09:39
Fromcameron bobro
SubjectRe: [Csnd] Re: midi velocity to number of partials
One way to do this is to map veloc to the amplitude of a sine, then send the sine through a Chebyshev waveshaper ( using Gen04 referencing the ftable with the Chebyshev function to normalize, followed by amp envelope). The table for waveshaping can hold all sorts of shapes, causing partials to arise in different ways as the amplitude of the incoming sine increases. One method in Csound is to use this:

http://www.csounds.com/manualOLPC/chebyshevpoly.html


From: Rory Walsh <rorywalsh@ear.ie>
To: csound@lists.bath.ac.uk
Sent: Thursday, December 8, 2011 10:31 PM
Subject: Re: [Csnd] Re: midi velocity to number of partials

Buzz doesn't modify the strengths of the adjacent harmonics so the
more you have the less intense the lower ones become. Try ivel/3 and
you should hear better. If you want something more natural sounding,
i.e., adjacent harmonics getting less intense the higher they go try
using gbuzz.

Rory.


On 8 December 2011 21:15, zappfinger <zappfinger@gmail.com> wrote:
> Hmm, I went the buzz road, but it does not work as I expected.
> Included is a simple CSD file (ignore the unneeded lines)
> When I play louder, I get more harmonics, but the base tones do not stay, so
> it looks if buzz does not simply add the harmonics ....
>
> http://csound.1045644.n5.nabble.com/file/n5060122/ESMS.csd ESMS.csd
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5060122.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> 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-12-11 10:30
FromStefan Thomas
SubjectRe: [Csnd] midi velocity to number of partials
Dear Joachim,
I tried Your code and it works fine on my machine, but I would like to ask some questions.
Why do You use poscil for the envelope? Doesn't it mean You have a loop for the envelope?
And: I've seen that the envelope doensn't stop when You stop playing on the midi-keybord.
When I increase the duration of idur,e.g. idur = 7, then the note last 7 seconds in every case. How can I avoid this?

2011/12/8 joachim heintz <jh@joachimheintz.de>
i'd say it depends on what you want to do with the single partials. in
natural sounds, each partial 'goes its own way': it has its own envelope
in time. if you want to imitate this behaviour, and create your own
results based on this, you can use something like this:

<CsoundSynthesizer>
<CsOptions>
-m128
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 128
nchnls = 1
0dbfs = 1
massign 0, "midi_receive"
gisin ftgen 0, 0, 1025, 10, 1
gienv ftgen 0, 0, 4097, 16, 0, 10, 0, 1, 4087, -6, 0
instr midi_receive
idur = 3
ifreq cpsmidi
ivel veloc
print ivel
indx = 0
loop:
ipart = indx+1 ;number of partial
event_i "i", "play_partial", 0, idur, ifreq, ipart
loop_lt indx, 1, ivel/16, loop
endin
instr play_partial
ifreq = p4
ipart = p5
p3 = p3 * (1/ipart) ;higher partials decay faster
iadd rnd31 p3/3, 0
p3 = p3 + iadd
aenv poscil .1, 1/p3, gienv
apart poscil aenv, ifreq*ipart, gisin
out apart
endin
</CsInstruments>
<CsScore>
f 0 99999
</CsScore>
</CsoundSynthesizer>

this is something like an instrument which reacts as timbre to the
velocity, and adds some random deviations to the partials. you can tell
the play_partial instrument which behaviour you'd like to get.
this (or anything similar) can be put in the form of a recursive udo, as
steven mentioned.
ciao -

       joachim




Am 08.12.2011 13:48, schrieb zappfinger:
> Suppose I want to convert midi velocity (0-127) to the number of harmonics.
> So vel = 10 would mean 10 harmonics, vel=100 would mean 100 harmonics.
>
> Would I have to make 127 wavetables, each filled with one harmonic more and
> then switch to a table depending on the velocity?
>
> Of course I could do it with a filter and one table filled with 127
> harmonics, but is there an other way?
>
> Richard
>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5058653.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> 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-12-12 22:24
Fromjoachim heintz
SubjectRe: [Csnd] midi velocity to number of partials
hi stefan -
thanks for trying my code. i am trying to answer your questions.
there is no loop with poscil, because the frequency input for poscil is
adjusted in a way that the envelope is just performed once. this is the
sense of the statement 1/p3 as frequency input. so, if the duration of a
note is 2 seconds, the frequency of the oscillator is 0.5 hertz, this
means it will cross the whole table (= envelope) in 2 seconds.
to your seconds question: yes, this instrument is independent from how
long you press the key. it's like a pizzicato-like harpsichord here,
because i wanted to focus on the timbre changes. if you want to connect
the actual duration with the time of a key pressed, you have to look at
the release, and then turn off the "slave notes". this is possible - for
instance - with fractional instrument numbers. you can find an example
(07B04) in
http://en.flossmanuals.net/csound/ch045_b-triggering-instrument-instances/
hope this explains, all best -
	joachim


Am 11.12.2011 11:30, schrieb Stefan Thomas:
> Dear Joachim,
> I tried Your code and it works fine on my machine, but I would like to
> ask some questions.
> Why do You use poscil for the envelope? Doesn't it mean You have a loop
> for the envelope?
> And: I've seen that the envelope doensn't stop when You stop playing on
> the midi-keybord.
> When I increase the duration of idur,e.g. idur = 7, then the note last 7
> seconds in every case. How can I avoid this?
> 
> 2011/12/8 joachim heintz >
> 
>     i'd say it depends on what you want to do with the single partials. in
>     natural sounds, each partial 'goes its own way': it has its own envelope
>     in time. if you want to imitate this behaviour, and create your own
>     results based on this, you can use something like this:
> 
>     
>     
>     -m128
>     
>     
>     sr = 44100
>     ksmps = 128
>     nchnls = 1
>     0dbfs = 1
>     massign 0, "midi_receive"
>     gisin ftgen 0, 0, 1025, 10, 1
>     gienv ftgen 0, 0, 4097, 16, 0, 10, 0, 1, 4087, -6, 0
>     instr midi_receive
>     idur = 3
>     ifreq cpsmidi
>     ivel veloc
>     print ivel
>     indx = 0
>     loop:
>     ipart = indx+1 ;number of partial
>     event_i "i", "play_partial", 0, idur, ifreq, ipart
>     loop_lt indx, 1, ivel/16, loop
>     endin
>     instr play_partial
>     ifreq = p4
>     ipart = p5
>     p3 = p3 * (1/ipart) ;higher partials decay faster
>     iadd rnd31 p3/3, 0
>     p3 = p3 + iadd
>     aenv poscil .1, 1/p3, gienv
>     apart poscil aenv, ifreq*ipart, gisin
>     out apart
>     endin
>     
>     
>     f 0 99999
>     
>     
> 
>     this is something like an instrument which reacts as timbre to the
>     velocity, and adds some random deviations to the partials. you can tell
>     the play_partial instrument which behaviour you'd like to get.
>     this (or anything similar) can be put in the form of a recursive udo, as
>     steven mentioned.
>     ciao -
> 
>            joachim
> 
> 
> 
> 
>     Am 08.12.2011 13:48, schrieb zappfinger:
>     > Suppose I want to convert midi velocity (0-127) to the number of
>     harmonics.
>     > So vel = 10 would mean 10 harmonics, vel=100 would mean 100 harmonics.
>     >
>     > Would I have to make 127 wavetables, each filled with one harmonic
>     more and
>     > then switch to a table depending on the velocity?
>     >
>     > Of course I could do it with a filter and one table filled with 127
>     > harmonics, but is there an other way?
>     >
>     > Richard
>     >
>     >
>     >
>     >
>     > --
>     > View this message in context:
>     http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5058653.html
>     > Sent from the Csound - General mailing list archive at Nabble.com.
>     >
>     >
>     > 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-12-13 08:44
FromStefan Thomas
SubjectRe: [Csnd] midi velocity to number of partials
Dear Joachim,
thanks for Your explanations! It was very halpful for me.


2011/12/12 joachim heintz <jh@joachimheintz.de>
hi stefan -
thanks for trying my code. i am trying to answer your questions.
there is no loop with poscil, because the frequency input for poscil is
adjusted in a way that the envelope is just performed once. this is the
sense of the statement 1/p3 as frequency input. so, if the duration of a
note is 2 seconds, the frequency of the oscillator is 0.5 hertz, this
means it will cross the whole table (= envelope) in 2 seconds.
to your seconds question: yes, this instrument is independent from how
long you press the key. it's like a pizzicato-like harpsichord here,
because i wanted to focus on the timbre changes. if you want to connect
the actual duration with the time of a key pressed, you have to look at
the release, and then turn off the "slave notes". this is possible - for
instance - with fractional instrument numbers. you can find an example
(07B04) in
http://en.flossmanuals.net/csound/ch045_b-triggering-instrument-instances/
hope this explains, all best -
       joachim


Am 11.12.2011 11:30, schrieb Stefan Thomas:
> Dear Joachim,
> I tried Your code and it works fine on my machine, but I would like to
> ask some questions.
> Why do You use poscil for the envelope? Doesn't it mean You have a loop
> for the envelope?
> And: I've seen that the envelope doensn't stop when You stop playing on
> the midi-keybord.
> When I increase the duration of idur,e.g. idur = 7, then the note last 7
> seconds in every case. How can I avoid this?
>
> 2011/12/8 joachim heintz <jh@joachimheintz.de <mailto:jh@joachimheintz.de>>
>
>     i'd say it depends on what you want to do with the single partials. in
>     natural sounds, each partial 'goes its own way': it has its own envelope
>     in time. if you want to imitate this behaviour, and create your own
>     results based on this, you can use something like this:
>
>     <CsoundSynthesizer>
>     <CsOptions>
>     -m128
>     </CsOptions>
>     <CsInstruments>
>     sr = 44100
>     ksmps = 128
>     nchnls = 1
>     0dbfs = 1
>     massign 0, "midi_receive"
>     gisin ftgen 0, 0, 1025, 10, 1
>     gienv ftgen 0, 0, 4097, 16, 0, 10, 0, 1, 4087, -6, 0
>     instr midi_receive
>     idur = 3
>     ifreq cpsmidi
>     ivel veloc
>     print ivel
>     indx = 0
>     loop:
>     ipart = indx+1 ;number of partial
>     event_i "i", "play_partial", 0, idur, ifreq, ipart
>     loop_lt indx, 1, ivel/16, loop
>     endin
>     instr play_partial
>     ifreq = p4
>     ipart = p5
>     p3 = p3 * (1/ipart) ;higher partials decay faster
>     iadd rnd31 p3/3, 0
>     p3 = p3 + iadd
>     aenv poscil .1, 1/p3, gienv
>     apart poscil aenv, ifreq*ipart, gisin
>     out apart
>     endin
>     </CsInstruments>
>     <CsScore>
>     f 0 99999
>     </CsScore>
>     </CsoundSynthesizer>
>
>     this is something like an instrument which reacts as timbre to the
>     velocity, and adds some random deviations to the partials. you can tell
>     the play_partial instrument which behaviour you'd like to get.
>     this (or anything similar) can be put in the form of a recursive udo, as
>     steven mentioned.
>     ciao -
>
>            joachim
>
>
>
>
>     Am 08.12.2011 13:48, schrieb zappfinger:
>     > Suppose I want to convert midi velocity (0-127) to the number of
>     harmonics.
>     > So vel = 10 would mean 10 harmonics, vel=100 would mean 100 harmonics.
>     >
>     > Would I have to make 127 wavetables, each filled with one harmonic
>     more and
>     > then switch to a table depending on the velocity?
>     >
>     > Of course I could do it with a filter and one table filled with 127
>     > harmonics, but is there an other way?
>     >
>     > Richard
>     >
>     >
>     >
>     >
>     > --
>     > View this message in context:
>     http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5058653.html
>     > Sent from the Csound - General mailing list archive at Nabble.com.
>     >
>     >
>     > 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
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-12-14 12:27
Fromjoachim heintz
SubjectRe: [Csnd] midi velocity to number of partials
freut mich, stefan. viel spaß weiter -
	joachim

Am 13.12.2011 09:44, schrieb Stefan Thomas:
> Dear Joachim,
> thanks for Your explanations! It was very halpful for me.
> 
> 
> 2011/12/12 joachim heintz >
> 
>     hi stefan -
>     thanks for trying my code. i am trying to answer your questions.
>     there is no loop with poscil, because the frequency input for poscil is
>     adjusted in a way that the envelope is just performed once. this is the
>     sense of the statement 1/p3 as frequency input. so, if the duration of a
>     note is 2 seconds, the frequency of the oscillator is 0.5 hertz, this
>     means it will cross the whole table (= envelope) in 2 seconds.
>     to your seconds question: yes, this instrument is independent from how
>     long you press the key. it's like a pizzicato-like harpsichord here,
>     because i wanted to focus on the timbre changes. if you want to connect
>     the actual duration with the time of a key pressed, you have to look at
>     the release, and then turn off the "slave notes". this is possible - for
>     instance - with fractional instrument numbers. you can find an example
>     (07B04) in
>     http://en.flossmanuals.net/csound/ch045_b-triggering-instrument-instances/
>     hope this explains, all best -
>            joachim
> 
> 
>     Am 11.12.2011 11:30, schrieb Stefan Thomas:
>     > Dear Joachim,
>     > I tried Your code and it works fine on my machine, but I would like to
>     > ask some questions.
>     > Why do You use poscil for the envelope? Doesn't it mean You have a
>     loop
>     > for the envelope?
>     > And: I've seen that the envelope doensn't stop when You stop
>     playing on
>     > the midi-keybord.
>     > When I increase the duration of idur,e.g. idur = 7, then the note
>     last 7
>     > seconds in every case. How can I avoid this?
>     >
>     > 2011/12/8 joachim heintz            >>
>     >
>     >     i'd say it depends on what you want to do with the single
>     partials. in
>     >     natural sounds, each partial 'goes its own way': it has its
>     own envelope
>     >     in time. if you want to imitate this behaviour, and create
>     your own
>     >     results based on this, you can use something like this:
>     >
>     >     
>     >     
>     >     -m128
>     >     
>     >     
>     >     sr = 44100
>     >     ksmps = 128
>     >     nchnls = 1
>     >     0dbfs = 1
>     >     massign 0, "midi_receive"
>     >     gisin ftgen 0, 0, 1025, 10, 1
>     >     gienv ftgen 0, 0, 4097, 16, 0, 10, 0, 1, 4087, -6, 0
>     >     instr midi_receive
>     >     idur = 3
>     >     ifreq cpsmidi
>     >     ivel veloc
>     >     print ivel
>     >     indx = 0
>     >     loop:
>     >     ipart = indx+1 ;number of partial
>     >     event_i "i", "play_partial", 0, idur, ifreq, ipart
>     >     loop_lt indx, 1, ivel/16, loop
>     >     endin
>     >     instr play_partial
>     >     ifreq = p4
>     >     ipart = p5
>     >     p3 = p3 * (1/ipart) ;higher partials decay faster
>     >     iadd rnd31 p3/3, 0
>     >     p3 = p3 + iadd
>     >     aenv poscil .1, 1/p3, gienv
>     >     apart poscil aenv, ifreq*ipart, gisin
>     >     out apart
>     >     endin
>     >     
>     >     
>     >     f 0 99999
>     >     
>     >     
>     >
>     >     this is something like an instrument which reacts as timbre to the
>     >     velocity, and adds some random deviations to the partials. you
>     can tell
>     >     the play_partial instrument which behaviour you'd like to get.
>     >     this (or anything similar) can be put in the form of a
>     recursive udo, as
>     >     steven mentioned.
>     >     ciao -
>     >
>     >            joachim
>     >
>     >
>     >
>     >
>     >     Am 08.12.2011 13:48, schrieb zappfinger:
>     >     > Suppose I want to convert midi velocity (0-127) to the number of
>     >     harmonics.
>     >     > So vel = 10 would mean 10 harmonics, vel=100 would mean 100
>     harmonics.
>     >     >
>     >     > Would I have to make 127 wavetables, each filled with one
>     harmonic
>     >     more and
>     >     > then switch to a table depending on the velocity?
>     >     >
>     >     > Of course I could do it with a filter and one table filled
>     with 127
>     >     > harmonics, but is there an other way?
>     >     >
>     >     > Richard
>     >     >
>     >     >
>     >     >
>     >     >
>     >     > --
>     >     > View this message in context:
>     >    
>     http://csound.1045644.n5.nabble.com/midi-velocity-to-number-of-partials-tp5058653p5058653.html
>     >     > Sent from the Csound - General mailing list archive at
>     Nabble.com.
>     >     >
>     >     >
>     >     > 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"
> 
> 


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"