[Csnd] Why doesn't this trigger work?
Date | 2009-07-29 16:39 |
From | Charles Gran |
Subject | [Csnd] Why doesn't this trigger work? |
I think I know what the problem is here, but I don't know how to fix it. What I'm hoping for is to be able to select where the foot switch data will be send. -Charles |
Date | 2009-07-29 18:04 |
From | Iain McCurdy |
Subject | [Csnd] RE: Why doesn't this trigger work? |
Hi Charles, Bear in mind that kstatus, kdata etc. can only be one value at a time. e.g, first of all you check if kstatus=144 and branch if data1 is 48 or 50. Next you ask if kstatus=176 but it won't be if it is already 144. If kstatus later on becomes 176 its earlier value of 144 is forgotton. Try the code below. I think it does what you want with a slightly different approach. instr 1 ;instrument 1 is triggered when a note on channel 1 is played inum notnum gkstatus, gkchan, gkdata1, gkdata2 midiin a1 subinstr inum ;call a subinstrument based on the note played endin instr 48 ;if note 48 was played if (gkstatus == 176)&&(gkdata1 == 64)&&(gkdata2 == 127) then event "i", 202, 0, 1 endif endin instr 50 ;if note 50 was played if (gkstatus == 176)&&(gkdata1 == 64)&&(gkdata2 == 127) then event "i", 203, 0, 1 endif endin instr 202 prints "INSTRUMENT 202" endin instr 203 prints "INSTRUMENT 203" endin f0 36000 e Iain ---------------------------------------- > Date: Wed, 29 Jul 2009 10:39:30 -0500 > From: chasgran@gmail.com > To: csound@lists.bath.ac.uk > Subject: [Csnd] Why doesn't this trigger work? > > I think I know what the problem is here, but I don't know how to fix > it. What I'm hoping for is to be able to select where the foot switch > data will be send. > -Charles > > > instr 1 > kstatus, kchan, kdata1, kdata2 midiin > if (kstatus == 144) then > if (kdata1 == 48) goto TWO > if (kdata1 == 50) goto THREE > endif > > goto NULL > > TWO: > if (kstatus == 176)&&(kdata1 == 64)&&(kdata2 == 127) then > event "i", 2, 0, 1 > endif > > goto NULL > > THREE: > if (kstatus == 176)&&(kdata1 == 64)&&(kdata2 == 127) then > event "i", 3, 0, 1 > endif > > NULL: > endin > > instr 2 > prints "INSTRUMENT TWO" > endin > > instr 3 > prints "INSTRUMENT THREE" > endin > > > > > f0 36000 > i1 0 36000 > e > > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" _________________________________________________________________ NEW mobile Hotmail. Optimized for YOUR phone. Click here. http://windowslive.com/Mobile?ocid=TXT_TAGLM_WL_CS_MB_new_hotmail_072009 |
Date | 2009-07-30 18:53 |
From | Charles Gran |
Subject | [Csnd] Re: RE: Why doesn't this trigger work? |
I can't seem to get this to work. I read the relevant section of the manual and believe I understand what you've done here (very helpful, thanks!). The data get to instrs 48 and 50, but instruments 202 and 203 don't play. I've checked using midiin.csd from the manual and the footswitch is being received correctly. Is there a typo in what I have or something? |
Date | 2009-07-30 19:38 |
From | Iain McCurdy |
Subject | [Csnd] RE: Re: RE: Why doesn't this trigger work? |
What you have here works okay for me, if I understand correctly what you want it to do. I hold down note 48 on MIDI keyboard... terminal prints INSTRUMENT 48 ENABLED... if I depress the sustain pedal while note 48 is held down... terminal prints INSTRUMENT 202. I hold down note 50 on MIDI keyboard... terminal prints INSTRUMENT 50 ENABLED... if I depress the sustain pedal while note 50 is held down... terminal prints INSTRUMENT 203. If I depress the pedal without either of the two notes being held down, nothing happens. Is this right? Iain ---------------------------------------- > Date: Thu, 30 Jul 2009 12:53:04 -0500 > From: chasgran@gmail.com > To: csound@lists.bath.ac.uk > Subject: [Csnd] Re: RE: Why doesn't this trigger work? > > I can't seem to get this to work. I read the relevant section of the > manual and believe I understand what you've done here (very helpful, > thanks!). The data get to instrs 48 and 50, but instruments 202 and > 203 don't play. I've checked using midiin.csd from the manual and the > footswitch is being received correctly. Is there a typo in what I have > or something? > > > > -M0 > > > sr = 44100 > ksmps = 8 > nchnls = 1 > 0dbfs = 1 > > gkstatus init 0 > gkchan init 0 > gkdata1 init 0 > gkdata2 init 0 > > instr 1 > inum notnum > gkstatus, gkchan, gkdata1, gkdata2 midiin > a1 subinstr inum > endin > > instr 48 > prints "INSTRUMENT 48 ENABLED" > if (gkstatus == 176)&&(gkdata1 == 64)&&(gkdata2 == 127) then > event "i", 202, 0, 1 > endif > endin > > instr 50 > prints "INSTRUMENT 50 ENABLED" > if (gkstatus == 176)&&(gkdata1 == 64)&&(gkdata2 == 127) then > event "i", 203, 0, 1 > endif > endin > > instr 202 > prints "INSTRUMENT 202" > endin > > instr 203 > prints "INSTRUMENT 203" > endin > > > > f0 36000 > e > > > > > > On Wed, Jul 29, 2009 at 12:04 PM, Iain McCurdy wrote: >> >> Hi Charles, >> Bear in mind that kstatus, kdata etc. can only be one value at a time. e.g, first of all you check if kstatus=144 and branch if data1 is 48 or 50. Next you ask if kstatus=176 but it won't be if it is already 144. If kstatus later on becomes 176 its earlier value of 144 is forgotton. >> >> Try the code below. I think it does what you want with a slightly different approach. >> >> >> >> instr 1 ;instrument 1 is triggered when a note on channel 1 is played >> inum notnum >> gkstatus, gkchan, gkdata1, gkdata2 midiin >> a1 subinstr inum ;call a subinstrument based on the note played >> endin >> >> instr 48 ;if note 48 was played >> if (gkstatus == 176)&&(gkdata1 == 64)&&(gkdata2 == 127) then >> event "i", 202, 0, 1 >> endif >> endin >> >> instr 50 ;if note 50 was played >> if (gkstatus == 176)&&(gkdata1 == 64)&&(gkdata2 == 127) then >> event "i", 203, 0, 1 >> endif >> endin >> >> instr 202 >> prints "INSTRUMENT 202" >> endin >> >> instr 203 >> prints "INSTRUMENT 203" >> endin >> >> >> >> >> f0 36000 >> e >> >> >> >> Iain >> >> ---------------------------------------- >>> Date: Wed, 29 Jul 2009 10:39:30 -0500 >>> From: chasgran@gmail.com >>> To: csound@lists.bath.ac.uk >>> Subject: [Csnd] Why doesn't this trigger work? >>> >>> I think I know what the problem is here, but I don't know how to fix >>> it. What I'm hoping for is to be able to select where the foot switch >>> data will be send. >>> -Charles >>> >>> >>> instr 1 >>> kstatus, kchan, kdata1, kdata2 midiin >>> if (kstatus == 144) then >>> if (kdata1 == 48) goto TWO >>> if (kdata1 == 50) goto THREE >>> endif >>> >>> goto NULL >>> >>> TWO: >>> if (kstatus == 176)&&(kdata1 == 64)&&(kdata2 == 127) then >>> event "i", 2, 0, 1 >>> endif >>> >>> goto NULL >>> >>> THREE: >>> if (kstatus == 176)&&(kdata1 == 64)&&(kdata2 == 127) then >>> event "i", 3, 0, 1 >>> endif >>> >>> NULL: >>> endin >>> >>> instr 2 >>> prints "INSTRUMENT TWO" >>> endin >>> >>> instr 3 >>> prints "INSTRUMENT THREE" >>> endin >>> >>> >>> >>> >>> f0 36000 >>> i1 0 36000 >>> e >>> >>> >>> >>> Send bugs reports to this list. >>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" >> >> _________________________________________________________________ >> NEW mobile Hotmail. Optimized for YOUR phone. Click here. >> http://windowslive.com/Mobile?ocid=TXT_TAGLM_WL_CS_MB_new_hotmail_072009 >> >> Send bugs reports to this list. >> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" _________________________________________________________________ Windows Live™ SkyDrive™: Store, access, and share your photos. See how. http://windowslive.com/Online/SkyDrive?ocid=TXT_TAGLM_WL_CS_SD_photos_072009 |
Date | 2009-07-30 22:03 |
From | Charles Gran |
Subject | [Csnd] Re: RE: Re: RE: Why doesn't this trigger work? |
Right, yes that works, sorry! What I want to do is use the keyboard to map the footswitch so that after I press a key 48 (and can let go) the foot switch interacts with a certain instrument. This piece is going to be for a clarinet player using a keyboard or percussion controller to change instruments, but the main interface is the foot switch. On Thu, Jul 30, 2009 at 1:38 PM, Iain McCurdy |
Date | 2009-08-01 14:15 |
From | Iain McCurdy |
Subject | [Csnd] RE: Re: RE: Re: RE: Why doesn't this trigger work? |
Hi Charles, Maybe you've already got it working, but this will do what you want I think: <CsoundSynthesizer> <CsInstruments> ginum init -100 instr 1 ;instrument 1 is triggered when a note on channel 1 is played ginum notnum gknum = ginum print ginum endin instr 2 ;always on ;READ IN SUSTAIN PEDAL CONTROLLER ksustain_pedal ctrl7 1,64,0,127 ;CREATE A TRIGGER IMPULSE (MOMENTARY 1) IF ksustain_pedal CROSSES UPWARDS THROUGH THRESHOLD VALUE (126) ktrigger trigger ksustain_pedal,126,0 schedkwhen ktrigger,0,0,gknum+100,0,1 endin instr 148 ;if note 48 was played prints "INSTRUMENT 148. NOTE 48." endin instr 150 ;if note 50 was played prints "INSTRUMENT 150. NOTE 50." endin </CsInstruments> <CsScore> i 2 0 36000 e </CsScore> </CsoundSynthesizer> Iain > Date: Thu, 30 Jul 2009 16:03:10 -0500 > From: chasgran@gmail.com > To: csound@lists.bath.ac.uk > Subject: [Csnd] Re: RE: Re: RE: Why doesn't this trigger work? > > Right, yes that works, sorry! What I want to do is use the keyboard > to map the footswitch so that after I press a key 48 (and can let go) > the foot switch interacts with a certain instrument. This piece is > going to be for a clarinet player using a keyboard or percussion > controller to change instruments, but the main interface is the foot > switch. > > > On Thu, Jul 30, 2009 at 1:38 PM, Iain McCurdy<i_mccurdy@hotmail.com> wrote: > > > > What you have here works okay for me, if I understand correctly what you want it to do. > > > > I hold down note 48 on MIDI keyboard... terminal prints INSTRUMENT 48 ENABLED... if I depress the sustain pedal while note 48 is held down... terminal prints INSTRUMENT 202. > > > > I hold down note 50 on MIDI keyboard... terminal prints INSTRUMENT 50 ENABLED... if I depress the sustain pedal while note 50 is held down... terminal prints INSTRUMENT 203. > > > > If I depress the pedal without either of the two notes being held down, nothing happens. > > > > Is this right? > > > > Iain > > > > ---------------------------------------- > >> Date: Thu, 30 Jul 2009 12:53:04 -0500 > >> From: chasgran@gmail.com > >> To: csound@lists.bath.ac.uk > >> Subject: [Csnd] Re: RE: Why doesn't this trigger work? > >> > >> I can't seem to get this to work. I read the relevant section of the > >> manual and believe I understand what you've done here (very helpful, > >> thanks!). The data get to instrs 48 and 50, but instruments 202 and > >> 203 don't play. I've checked using midiin.csd from the manual and the > >> footswitch is being received correctly. Is there a typo in what I have > >> or something? > >> > >> > >> > >> -M0 > >> > >> > >> sr = 44100 > >> ksmps = 8 > >> nchnls = 1 > >> 0dbfs = 1 > >> > >> gkstatus init 0 > >> gkchan init 0 > >> gkdata1 init 0 > >> gkdata2 init 0 > >> > >> instr 1 > >> inum notnum > >> gkstatus, gkchan, gkdata1, gkdata2 midiin > >> a1 subinstr inum > >> endin > >> > >> instr 48 > >> prints "INSTRUMENT 48 ENABLED" > >> if (gkstatus == 176)&&(gkdata1 == 64)&&(gkdata2 == 127) then > >> event "i", 202, 0, 1 > >> endif > >> endin > >> > >> instr 50 > >> prints "INSTRUMENT 50 ENABLED" > >> if (gkstatus == 176)&&(gkdata1 == 64)&&(gkdata2 == 127) then > >> event "i", 203, 0, 1 > >> endif > >> endin > >> > >> instr 202 > >> prints "INSTRUMENT 202" > >> endin > >> > >> instr 203 > >> prints "INSTRUMENT 203" > >> endin > >> > >> > >> > >> f0 36000 > >> e > >> > >> > >> > >> > >> > >> On Wed, Jul 29, 2009 at 12:04 PM, Iain McCurdy wrote: > >>> > >>> Hi Charles, > >>> Bear in mind that kstatus, kdata etc. can only be one value at a time. e.g, first of all you check if kstatus=144 and branch if data1 is 48 or 50. Next you ask if kstatus=176 but it won't be if it is already 144. If kstatus later on becomes 176 its earlier value of 144 is forgotton. > >>> > >>> Try the code below. I think it does what you want with a slightly different approach. > >>> > >>> > >>> > >>> instr 1 ;instrument 1 is triggered when a note on channel 1 is played > >>> inum notnum > >>> gkstatus, gkchan, gkdata1, gkdata2 midiin > >>> a1 subinstr inum ;call a subinstrument based on the note played > >>> endin > >>> > >>> instr 48 ;if note 48 was played > >>> if (gkstatus == 176)&&(gkdata1 == 64)&&(gkdata2 == 127) then > >>> event "i", 202, 0, 1 > >>> endif > >>> endin > >>> > >>> instr 50 ;if note 50 was played > >>> if (gkstatus == 176)&&(gkdata1 == 64)&&(gkdata2 == 127) then > >>> event "i", 203, 0, 1 > >>> endif > >>> endin > >>> > >>> instr 202 > >>> prints "INSTRUMENT 202" > >>> endin > >>> > >>> instr 203 > >>> prints "INSTRUMENT 203" > >>> endin > >>> > >>> > >>> > >>> > >>> f0 36000 > >>> e > >>> > >>> > >>> > >>> Iain > >>> > >>> ---------------------------------------- > >>>> Date: Wed, 29 Jul 2009 10:39:30 -0500 > >>>> From: chasgran@gmail.com > >>>> To: csound@lists.bath.ac.uk > >>>> Subject: [Csnd] Why doesn't this trigger work? > >>>> > >>>> I think I know what the problem is here, but I don't know how to fix > >>>> it. What I'm hoping for is to be able to select where the foot switch > >>>> data will be send. > >>>> -Charles > >>>> > >>>> > >>>> instr 1 > >>>> kstatus, kchan, kdata1, kdata2 midiin > >>>> if (kstatus == 144) then > >>>> if (kdata1 == 48) goto TWO > >>>> if (kdata1 == 50) goto THREE > >>>> endif > >>>> > >>>> goto NULL > >>>> > >>>> TWO: > >>>> if (kstatus == 176)&&(kdata1 == 64)&&(kdata2 == 127) then > >>>> event "i", 2, 0, 1 > >>>> endif > >>>> > >>>> goto NULL > >>>> > >>>> THREE: > >>>> if (kstatus == 176)&&(kdata1 == 64)&&(kdata2 == 127) then > >>>> event "i", 3, 0, 1 > >>>> endif > >>>> > >>>> NULL: > >>>> endin > >>>> > >>>> instr 2 > >>>> prints "INSTRUMENT TWO" > >>>> endin > >>>> > >>>> instr 3 > >>>> prints "INSTRUMENT THREE" > >>>> endin > >>>> > >>>> > >>>> > >>>> > >>>> f0 36000 > >>>> i1 0 36000 > >>>> e > >>>> > >>>> > >>>> > >>>> Send bugs reports to this list. > >>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > >>> > >>> _________________________________________________________________ > >>> NEW mobile Hotmail. Optimized for YOUR phone. Click here. > >>> http://windowslive.com/Mobile?ocid=TXT_TAGLM_WL_CS_MB_new_hotmail_072009 > >>> > >>> Send bugs reports to this list. > >>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > >> > >> > >> Send bugs reports to this list. > >> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > > > > _________________________________________________________________ > > Windows Live™ SkyDrive™: Store, access, and share your photos. See how. > > http://windowslive.com/Online/SkyDrive?ocid=TXT_TAGLM_WL_CS_SD_photos_072009 > > > > Send bugs reports to this list. > > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" Windows Live™: Keep your life in sync. Check it out. |
Date | 2009-08-01 20:35 |
From | Charles Gran |
Subject | [Csnd] Re: RE: Re: RE: Re: RE: Why doesn't this trigger work? |
Works beautifully Ian, thanks so much! On Sat, Aug 1, 2009 at 8:15 AM, Iain McCurdy |