[Csnd] Random instrument
| Date | 2011-04-14 11:40 |
| From | Giorgio77 |
| Subject | [Csnd] Random instrument |
Hi, I'm trying to write a instrument controlled by midi where i can change
randomly the signal generator to each event midi,but does not work,some
ideas?my csd example :
-odac -+rtmidi=virtual -M0
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2
ga1 init 0
ga2 init 0
instr 1
iamp ampmidi 8000
ifreq cpsmidi
kinstr = rnd(4)
if (kinstr == 0) goto snd1
if (kinstr == 1) goto snd2
if (kinstr == 2) goto snd3
if (kinstr == 3) goto snd4
if (kinstr == 4) goto snd5
snd1:
a1 oscili iamp,ifreq,1
goto output
snd2:
a1 pluck iamp,ifreq,120,0,1
goto output
snd3:
a1 pluck iamp,ifreq,1420,0,1
goto output
snd4:
a1 bamboo iamp,1
goto output
snd5:
a1 oscili iamp,ifreq,2
goto output
output:
kdeclick linsegr 0, 0.02, 1, 1 - 0.05, 1, 0.02, 0, 0.01, 0
outs (a1)*kdeclick,(a1)*kdeclick
ga1 = (a1+ga1)/2
ga2 = (a1 +ga2)/2
endin
;reverb
instr 2
a1,a2 freeverb ga1,ga2,0.8, 0.35, sr, 0
outs a1,a2
ga1 = 0
ga2 = 0
endin
f1 0 4096 10 1
f2 0 16384 10 0 .1 0 .2 0 .3 0 .4 0 .5 0 .6 0 .7
i1 0 3600
i2 0 3600
thanks!
Giorgio
--
View this message in context: http://csound.1045644.n5.nabble.com/Random-instrument-tp4302699p4302699.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"
|
| Date | 2011-04-14 11:46 |
| From | Victor Lazzarini |
| Subject | Re: [Csnd] Random instrument |
if ... kgoto .... rather if .... goto ... might be what you are
looking for; also rnd() will produce reals rather ints, so when
you compare to an integer, it's unlikely to work (so you could try
comparing to int(kinstr) ). Notice that potentially you will change
instrs at
every k-cycle, so this might also introduce some sort of modulation at
kr, which could generate spurious components.
Victor
On 14 Apr 2011, at 11:40, Giorgio77 wrote:
> Hi, I'm trying to write a instrument controlled by midi where i can
> change
> randomly the signal generator to each event midi,but does not
> work,some
> ideas?my csd example :
>
>
>
>
> -odac -+rtmidi=virtual -M0
>
>
>
>
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 2
>
> ga1 init 0
> ga2 init 0
>
> instr 1
>
> iamp ampmidi 8000
> ifreq cpsmidi
>
> kinstr = rnd(4)
>
> if (kinstr == 0) goto snd1
> if (kinstr == 1) goto snd2
> if (kinstr == 2) goto snd3
> if (kinstr == 3) goto snd4
> if (kinstr == 4) goto snd5
>
> snd1:
> a1 oscili iamp,ifreq,1
> goto output
>
> snd2:
> a1 pluck iamp,ifreq,120,0,1
> goto output
>
> snd3:
> a1 pluck iamp,ifreq,1420,0,1
> goto output
>
> snd4:
> a1 bamboo iamp,1
> goto output
>
> snd5:
> a1 oscili iamp,ifreq,2
> goto output
>
> output:
>
> kdeclick linsegr 0, 0.02, 1, 1 - 0.05, 1, 0.02, 0, 0.01, 0
> outs (a1)*kdeclick,(a1)*kdeclick
>
> ga1 = (a1+ga1)/2
> ga2 = (a1 +ga2)/2
>
> endin
>
> ;reverb
> instr 2
>
> a1,a2 freeverb ga1,ga2,0.8, 0.35, sr, 0
> outs a1,a2
> ga1 = 0
> ga2 = 0
>
> endin
>
>
>
> f1 0 4096 10 1
> f2 0 16384 10 0 .1 0 .2 0 .3 0 .4 0 .5 0 .6 0 .7
>
> i1 0 3600
> i2 0 3600
>
>
>
>
> thanks!
>
> Giorgio
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Random-instrument-tp4302699p4302699.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"
>
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"
|
| Date | 2011-04-14 11:47 |
| From | francesco |
| Subject | [Csnd] Re: Random instrument |
Hello Mr. Giorgio,
You need this (i think):
-odac -+rtmidi=virtual -M0
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2
0dbfs = 1
ga1 init 0
ga2 init 0
instr 1
iamp ampmidi 8000
ifreq cpsmidi
kinstr = rnd(4)
if (kinstr == 0) goto snd1
if (kinstr == 1) goto snd2
if (kinstr == 2) goto snd3
if (kinstr == 3) goto snd4
if (kinstr == 4) goto snd5
snd1:
a1 oscili iamp,ifreq,1
goto output
snd2:
a1 pluck iamp,ifreq,120,0,1
goto output
snd3:
a1 pluck iamp,ifreq,1420,0,1
goto output
snd4:
a1 bamboo iamp,1
goto output
snd5:
a1 oscili iamp,ifreq,2
goto output
output:
kdeclick linsegr 0, 0.02, 1, 1 - 0.05, 1, 0.02, 0, 0.01, 0
outs (a1)*kdeclick,(a1)*kdeclick
ga1 = (a1+ga1)/2
ga2 = (a1 +ga2)/2
endin
;reverb
instr 2
a1,a2 freeverb ga1,ga2,0.8, 0.35, sr, 0
outs a1,a2
ga1 = 0
ga2 = 0
endin
f 0 360
f1 0 4096 10 1
f2 0 16384 10 0 .1 0 .2 0 .3 0 .4 0 .5 0 .6 0 .7
1 - ga1 and ga2 need to be initialized, and
2 - using f0 360 in score, the csd will run for 360 sec.
(using i1 ... only one instance of instrument and only one
choice of rnd value)
To me this work.
Hope helpful,
ciao,
francesco.
--
View this message in context: http://csound.1045644.n5.nabble.com/Random-instrument-tp4302699p4302714.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"
|
| Date | 2011-04-14 11:57 |
| From | Victor Lazzarini |
| Subject | Re: [Csnd] Random instrument |
also, for rnd() to work at krate you need to do this
krand = 4
kinstr = rnd(krand)
don't forget to use kgoto instead of goto too...
On 14 Apr 2011, at 11:46, Victor Lazzarini wrote:
> if ... kgoto .... rather if .... goto ... and kgoto instead of
> goto might be what you are looking for; also rnd() will produce
> reals rather ints, so when
> you compare to an integer, it's unlikely to work (so you could try
> comparing to int(kinstr) ). Notice that potentially you will change
> instrs at
> every k-cycle, so this might also introduce some sort of modulation
> at kr, which could generate spurious components.
>
> Victor
>
> On 14 Apr 2011, at 11:40, Giorgio77 wrote:
>
>> Hi, I'm trying to write a instrument controlled by midi where i can
>> change
>> randomly the signal generator to each event midi,but does not
>> work,some
>> ideas?my csd example :
>>
>>
>>
>>
>> -odac -+rtmidi=virtual -M0
>>
>>
>>
>>
>> sr = 44100
>> kr = 4410
>> ksmps = 10
>> nchnls = 2
>>
>> ga1 init 0
>> ga2 init 0
>>
>> instr 1
>>
>> iamp ampmidi 8000
>> ifreq cpsmidi
>>
>> kinstr = rnd(4)
>>
>> if (kinstr == 0) goto snd1
>> if (kinstr == 1) goto snd2
>> if (kinstr == 2) goto snd3
>> if (kinstr == 3) goto snd4
>> if (kinstr == 4) goto snd5
>>
>> snd1:
>> a1 oscili iamp,ifreq,1
>> goto output
>>
>> snd2:
>> a1 pluck iamp,ifreq,120,0,1
>> goto output
>>
>> snd3:
>> a1 pluck iamp,ifreq,1420,0,1
>> goto output
>>
>> snd4:
>> a1 bamboo iamp,1
>> goto output
>>
>> snd5:
>> a1 oscili iamp,ifreq,2
>> goto output
>>
>> output:
>>
>> kdeclick linsegr 0, 0.02, 1, 1 - 0.05, 1, 0.02, 0, 0.01, 0
>> outs (a1)*kdeclick,(a1)*kdeclick
>>
>> ga1 = (a1+ga1)/2
>> ga2 = (a1 +ga2)/2
>>
>> endin
>>
>> ;reverb
>> instr 2
>>
>> a1,a2 freeverb ga1,ga2,0.8, 0.35, sr, 0
>> outs a1,a2
>> ga1 = 0
>> ga2 = 0
>>
>> endin
>>
>>
>>
>> f1 0 4096 10 1
>> f2 0 16384 10 0 .1 0 .2 0 .3 0 .4 0 .5 0 .6 0 .7
>>
>> i1 0 3600
>> i2 0 3600
>>
>>
>>
>>
>> thanks!
>>
>> Giorgio
>>
>> --
>> View this message in context: http://csound.1045644.n5.nabble.com/Random-instrument-tp4302699p4302699.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"
>>
>
> 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"
>
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"
|
| Date | 2011-04-14 12:05 |
| From | francesco |
| Subject | [Csnd] Re: Random instrument |
Hello,
sorry Mr. Victor, there is need f 0 in score too,
or i'm wrong (again)?
Thank You,
ciao,
francesco.
--
View this message in context: http://csound.1045644.n5.nabble.com/Random-instrument-tp4302699p4302737.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"
|
| Date | 2011-04-14 12:06 |
| From | Victor Lazzarini |
| Subject | Re: [Csnd] Random instrument |
I tested it and the dependency on kr is bad. So I modified it, maybe this is what you wanted: |
| Date | 2011-04-14 12:25 |
| From | Victor Lazzarini |
| Subject | Re: [Csnd] Re: Random instrument |
No really needed if instrument 1 or 2 is always on; but yes it's
needed if you want to do it as standard MIDI synth without any
always-on instrument.
Victor
On 14 Apr 2011, at 12:05, francesco wrote:
> Hello,
> sorry Mr. Victor, there is need f 0 in score too,
> or i'm wrong (again)?
>
> Thank You,
> ciao,
> francesco.
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Random-instrument-tp4302699p4302737.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"
>
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"
|
| Date | 2011-04-14 13:33 |
| From | Giorgio77 |
| Subject | [Csnd] Re: Random instrument |
Dear Dr.Lazzarini,thank you very much for your advice,now it work! my idea
was started from a preset historical of Yamaha Dx series "Marimba magic",I
started with this other simple idea with randomly functions for oscil :
-odac -+rtmidi=virtual -M0
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
instr 1
iamp ampmidi 8000
ifreq cpsmidi
ifunc = rnd(8)
a1 oscili iamp,ifreq,ifunc+1
kdeclick linsegr 0,.1,1,.3,.5,.2,0
out a1*kdeclick
endin
f1 0 4096 10 1
f2 0 4096 10 0 1
f3 0 4096 10 0 1 1
f4 0 4096 10 1 0 0 1
f5 0 4096 10 0 0 1 0 1
f6 0 4096 10 0 1 0 0 0 1
f7 0 4096 10 1 0 0 1 0 0 1
f8 0 4096 10 1 0 1 0 1 0 1 0 1
f9 0 4096 10 0 1 0 1 0 1 0 1 0 1
i1 0 3600
and the next step was to vary the synthesis techniques at event midi,thanks!
Giorgio
--
View this message in context: http://csound.1045644.n5.nabble.com/Random-instrument-tp4302699p4302884.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"
|
| Date | 2011-04-14 14:17 |
| From | Victor Lazzarini |
| Subject | Re: [Csnd] Re: Random instrument |
Ok, now I understand what you wanted to do: instead of changing at
krate, you wanted to decide the instrument at i-time. So I guess, two
things are important
1) comparisons still need to be with int(...) and your kinstr becomes
iinstr (i-time variable)
2) you should remove any i1 line from the score. Instrument 1 then
gets played by MIDI means alone.
I think your original instrument would work just with the two changes
above.
On 14 Apr 2011, at 13:33, Giorgio77 wrote:
> Dear Dr.Lazzarini,thank you very much for your advice,now it work!
> my idea
> was started from a preset historical of Yamaha Dx series "Marimba
> magic",I
> started with this other simple idea with randomly functions for
> oscil :
>
>
>
> -odac -+rtmidi=virtual -M0
>
>
>
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 1
>
> instr 1
>
> iamp ampmidi 8000
> ifreq cpsmidi
> ifunc = rnd(8)
> a1 oscili iamp,ifreq,ifunc+1
> kdeclick linsegr 0,.1,1,.3,.5,.2,0
> out a1*kdeclick
>
> endin
>
>
> f1 0 4096 10 1
> f2 0 4096 10 0 1
> f3 0 4096 10 0 1 1
> f4 0 4096 10 1 0 0 1
> f5 0 4096 10 0 0 1 0 1
> f6 0 4096 10 0 1 0 0 0 1
> f7 0 4096 10 1 0 0 1 0 0 1
> f8 0 4096 10 1 0 1 0 1 0 1 0 1
> f9 0 4096 10 0 1 0 1 0 1 0 1 0 1
>
> i1 0 3600
>
>
>
>
> and the next step was to vary the synthesis techniques at event
> midi,thanks!
>
> Giorgio
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Random-instrument-tp4302699p4302884.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"
>
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"
|