[Csnd] Re: Re: csound Digest Fri, 07 Mar 2008 (2/3)
Date | 2008-03-07 16:04 |
From | mark jamerson |
Subject | [Csnd] Re: Re: csound Digest Fri, 07 Mar 2008 (2/3) |
Even Brenden, This is how I have done it, placing a trigger before the schedkwhen: turnon 44 instr 44 kf1 init 0 kk OSClisten gihandle, "/pd100", "f", kf1 kthresh = (whatever you want your threshold to be) ktrig trigger kf1,kthresh,kmode schedkwhen trig, 0.1, 2, 100, 0, 2 endin Mark Jamerson ----- Original Message ---- From: Even Brenden <evenbrenden@gmail.com> To: csound@lists.bath.ac.uk Sent: Friday, March 7, 2008 6:52:10 AM Subject: [Csnd] Re: csound Digest Fri, 07 Mar 2008 (2/3) "segmentaton violation - problems with event, event_i and schedkwhen" i'm using OSC for communication between PD and csound for triggering single instances of of my instruments from events in PD. i have tried these two approaches: ----1---- turnon 44 instr 44 kf1 init 0 nxtmsg: kk OSClisten gihandle, "/pd100", "f", kf1 if (kk == 0) goto ex event_i "i", 100, 0.1 ,1.2 kgoto nxtmsg ex: endin ----2---- turnon 44 ; slår på osctriglytting for perks instr 44 ;LYTTE OSC -> TRIG kf1 init 0 kk OSClisten gihandle, "/pd100", "f", kf1 schedkwhen kk, 0.1, 2, 100, 0, 2 endin ---- both attempts, which have been tried out with several duration values and such, give a "segmentaton violation" the instant that schekwhen/event_i is executed. any suggestions? is there perhaps a better approach for triggering instruments via OSC? -Even Brenden Never miss a thing. Make Yahoo your homepage. |
Date | 2008-03-07 17:08 |
From | Cortaigne |
Subject | [Csnd] Random Question |
Heyas. I'm really new to Csound, so most of it's way over my head. I've got this little experiment going, though, and I'm trying to figure out how to get it to work properly. Essentially, I'd like to have an instrument select notes at random -- ideally, diatonically, but for right now I'm just trying to get it to work chromatically. The problem is, with the current revision, it seems to repeat notes four or five times before selecting a different note. I suspect I'm using the wrong randomizing opcode, but when I've tried others, I get conflicts (like it produces a k-rate variable and I need it to make an i-rate variable, or whatever; remember, I'm very new at this, so what I'm saying might be gibberish). Anyway, here's what I've got -- I hope someone can make sense of it and tell me what I'm doing wrong: |
Date | 2008-03-07 18:16 |
From | Cortaigne |
Subject | [Csnd] Random Question (Supplemental) |
Just in case this might help, here's an earlier experiment that uses a different randomizing opcode. It definitely does a better job at randomization, but as I mentioned in the other message, I couldn't figure out a way to harness the output of the randh and mold it into something cpspch could use. |
Date | 2008-03-07 18:21 |
From | Rory Walsh |
Subject | [Csnd] Re: Random Question (Supplemental) |
You could do something like this: |
Date | 2008-03-07 18:36 |
From | Cortaigne |
Subject | [Csnd] Re: Re: Random Question (Supplemental) |
There's definitely stuff going on in there that I haven't learned about yet, so I'll need to hit the manual, but on first glance, it looks like you might be randomizing MIDI notes. That's an excellent possibility I hadn't even considered! (I won't even pretend to understand the math in that, by the way -- something about exponents and logarithms, maybe?) ;-) Thanks for the suggestion! I'll need to pick it apart further and see what I can derive from it. On Mar 7, 2008, at 12:21:57 PM CST, Rory Walsh wrote: > You could do something like this: > > |
Date | 2008-03-07 18:37 |
From | Rory Walsh |
Subject | [Csnd] Re: Re: Random Question (Supplemental) |
You could also load the diatonic scale into a function table and read back the values randomly, in fact that would be easier I think. You can use GEN02. Rory. Rory Walsh wrote: > You could do something like this: > > |
Date | 2008-03-07 18:41 |
From | Cortaigne |
Subject | [Csnd] Re: Re: Re: Random Question (Supplemental) |
I haven't done anything like that yet, but as I understand these things so far, that sounds like it might just be exactly the answer I need. It could be set to whatever bizarre sort of scale one would wish to use, couldn't it? On Mar 7, 2008, at 12:37:45 PM CST, Rory Walsh wrote: > You could also load the diatonic scale into a function table and > read back the values randomly, in fact that would be easier I > think. You can use GEN02. > > Rory. > > > Rory Walsh wrote: >> You could do something like this: >> |
Date | 2008-03-07 18:42 |
From | "Aidan Collins" |
Subject | [Csnd] Re: Random Question |
Attachments | None |
Date | 2008-03-07 18:43 |
From | Rory Walsh |
Subject | [Csnd] Re: Re: Re: Random Question (Supplemental) |
That midi2cps macro simply converts midi numbers to frequencies. Istvan Varga posted it to this list a while back and I've used it quite a bit. To tell you the truth I've never even looked at the equation. Rory. Cortaigne wrote: > There's definitely stuff going on in there that I haven't learned about > yet, so I'll need to hit the manual, but on first glance, it looks like > you might be randomizing MIDI notes. That's an excellent possibility I > hadn't even considered! (I won't even pretend to understand the math in > that, by the way -- something about exponents and logarithms, maybe?) ;-) > > Thanks for the suggestion! I'll need to pick it apart further and see > what I can derive from it. > > > On Mar 7, 2008, at 12:21:57 PM CST, Rory Walsh wrote: > >> You could do something like this: >> >> |
Date | 2008-03-07 18:47 |
From | Rory Walsh |
Subject | [Csnd] Re: Re: Re: Re: Random Question (Supplemental) |
You can also try the cpstun opcode if you want to mess around with your own scales. I don't know much about it but others on the list do. Rory. Cortaigne wrote: > I haven't done anything like that yet, but as I understand these things > so far, that sounds like it might just be exactly the answer I need. It > could be set to whatever bizarre sort of scale one would wish to use, > couldn't it? > > > On Mar 7, 2008, at 12:37:45 PM CST, Rory Walsh wrote: > >> You could also load the diatonic scale into a function table and read >> back the values randomly, in fact that would be easier I think. You >> can use GEN02. >> >> Rory. >> >> >> Rory Walsh wrote: >>> You could do something like this: >>> |
Date | 2008-03-07 18:51 |
From | Cortaigne |
Subject | [Csnd] Re: Re: Random Question |
I'd actually considered the possibility of close results, which is why I put in the "print iBase" bit, and it turns out to produce sequences like: instr 1: iBase = 19.119 instr 1: iBase = 19.119 instr 1: iBase = 19.119 instr 1: iBase = 6.965 instr 1: iBase = 6.965 instr 1: iBase = 6.965 instr 1: iBase = 6.965 instr 1: iBase = 19.812 instr 1: iBase = 19.812 instr 1: iBase = 19.812 instr 1: iBase = 19.812 instr 1: iBase = 19.812 instr 1: iBase = 7.658 instr 1: iBase = 7.658 instr 1: iBase = 7.658 Incidentally, one thing I've noticed is that it tends to climb in two alternating bits -- like, four or five low-ish notes, then four or five high-ish notes, then four or five slightly-higher-than-the-previous-low-ish notes, then four or five slightly-higher-than-the-previous-high-ish notes, and so on. (Very technical, I know.) ;-) On Mar 7, 2008, at 12:42:51 PM CST, Aidan Collins wrote:
|
Date | 2008-03-07 19:42 |
From | Frank Hübenthal |
Subject | [Csnd] Re: Random Question |
Cortaigne schrieb: > Heyas. I'm really new to Csound, so most of it's way over my head. > I've got this little experiment going, though, and I'm trying to > figure out how to get it to work properly. Essentially, I'd like to > have an instrument select notes at random -- ideally, diatonically, > but for right now I'm just trying to get it to work chromatically. > The problem is, with the current revision, it seems to repeat notes > four or five times before selecting a different note. I suspect I'm > using the wrong randomizing opcode, but when I've tried others, I get > conflicts (like it produces a k-rate variable and I need it to make an > i-rate variable, or whatever; remember, I'm very new at this, so what > I'm saying might be gibberish). Anyway, here's what I've got -- I > hope someone can make sense of it and tell me what I'm doing wrong: > > [...] > > instr 1 > > ; Random Note Selector > seed 0 > iBase linrand 25 > iNum = int(iBase) > iNote = (iNum/100) + 7 > [...] You should remove the "seed 0" line from your instrument, because this command reinitializes the random generator everytime you use instrument 1. Don't know how it is implemented in csound, but usually the system time is used as the new seed if zero is given to the command. If the resolution is low (e.g. on a one second base), you start the same random sequence again and again until the system time advances one step. Place the "seed 0" line directly after the header (it is then called once when your performance starts) and have fun :-) Example follows: sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 seed 0 instr 1 ; Random Note Selector iBase linrand 25 iNum = int(iBase) [...] |
Date | 2008-03-07 19:53 |
From | Cesare Marilungo |
Subject | [Csnd] Re: Re: Re: Re: Random Question (Supplemental) |
Since version 5.07 there's also the cpsmidinn opcode for this. Best, -c. Rory Walsh wrote: > That midi2cps macro simply converts midi numbers to frequencies. > Istvan Varga posted it to this list a while back and I've used it > quite a bit. To tell you the truth I've never even looked at the > equation. > > Rory. > > > Cortaigne wrote: >> There's definitely stuff going on in there that I haven't learned >> about yet, so I'll need to hit the manual, but on first glance, it >> looks like you might be randomizing MIDI notes. That's an excellent >> possibility I hadn't even considered! (I won't even pretend to >> understand the math in that, by the way -- something about exponents >> and logarithms, maybe?) ;-) >> >> Thanks for the suggestion! I'll need to pick it apart further and >> see what I can derive from it. >> >> >> On Mar 7, 2008, at 12:21:57 PM CST, Rory Walsh wrote: >> >>> You could do something like this: >>> >>> |
Date | 2008-03-08 02:47 |
From | Cortaigne |
Subject | [Csnd] Re: Re: Random Question |
YES! That was the answer! It works! Thank you so much! :-) Now to explore diatonic techniques -- starting, I think, with Rory's suggestion of a function table and GEN02 (if I can figure out how to do it!). >:) On Mar 7, 2008, at 01:42:56 PM CST, Frank Hübenthal wrote: > You should remove the "seed 0" line from your instrument, because > this command reinitializes the random generator everytime you use > instrument 1. Don't know how it is implemented in csound, but > usually the system time is used as the new seed if zero is given to > the command. If the resolution is low (e.g. on a one second base), > you start the same random sequence again and again until the system > time advances one step. > > Place the "seed 0" line directly after the header (it is then > called once when your performance starts) and have fun :-) > Example follows: > > sr = 44100 > kr = 4410 > ksmps = 10 > nchnls = 1 > > seed 0 > > instr 1 > > ; Random Note Selector > iBase linrand 25 > iNum = int(iBase) > [...] |
Date | 2008-03-08 02:51 |
From | Cortaigne |
Subject | [Csnd] Re: Re: Re: Random Question |
Er, okay, so, maybe I spoke too soon. Though each successive note is now different, it gives the same sequence with each performance. :-\ On Mar 7, 2008, at 08:47:42 PM CST, Cortaigne wrote: > YES! That was the answer! It works! Thank you so much! :-) > > Now to explore diatonic techniques -- starting, I think, with > Rory's suggestion of a function table and GEN02 (if I can figure > out how to do it!). >:) > > > On Mar 7, 2008, at 01:42:56 PM CST, Frank Hübenthal wrote: > >> You should remove the "seed 0" line from your instrument, because >> this command reinitializes the random generator everytime you use >> instrument 1. Don't know how it is implemented in csound, but >> usually the system time is used as the new seed if zero is given >> to the command. If the resolution is low (e.g. on a one second >> base), you start the same random sequence again and again until >> the system time advances one step. >> >> Place the "seed 0" line directly after the header (it is then >> called once when your performance starts) and have fun :-) >> Example follows: >> >> sr = 44100 >> kr = 4410 >> ksmps = 10 >> nchnls = 1 >> >> seed 0 >> >> instr 1 >> >> ; Random Note Selector >> iBase linrand 25 >> iNum = int(iBase) >> [...] > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body > "unsubscribe csound" |