|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
[csnd] Windcontroller Portamento with cpsmidib opcodeHello! csounder.
It is a question about Portamento and cpsmidib. This csd file is for woodwind instrument for Akai_Ewi and Wiimote. This csd use cpsmidib with i-rate as note input and Linseg opcode as a portamento funtion, in this case I can't control pitchbend, when I am blowing Ewi(noteon). Can you tell me what I miss, some hint or tips for using k-rate_cpsmidib and portamento together, Or another Idea for making portamento. Thank you in advance. <CsoundSynthesizer> <CsOptions> -odac -iadc -d </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 giseed = .5 garev init 0 gicps init 440 gitable1 ftgen 1, 0, 4096, 10, 1 gitable2 ftgen 3, 0, 4097, -10, 2661, 87, 33, 18 gitable3 ftgen 4, 0, 4097, -10, 174, 12, gitable4 ftgen 5, 0, 4097, -10, 314, 13, gitable5 ftgen 6, 0, 16, -2, 40, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 10240 ctrlinit 1, 2, 0 instr 1 ; This is based on Flute1.csd from Dr. Boulanger's csound library. I modified it for Midi_Windcontoroller and Wiimote. knoise chnget "breathnoise" kvib chnget "vibrato" kport chnget "port" kfilt chnget "filt" kfilt2 chnget "filt2" iportim chnget "portamento" icpsb init gicps icps cpsmidib gicps = icps kport linseg icpsb, iportim, gicps kbreath midictrl 2, 0, 1 gkbreath = kbreath kbreath port kbreath, 0.02 kbreath linenr kbreath, 0.02, 0.05, 0.1 kvibdepth = abs(kvib*kport/100.) kvibdepth randi kvibdepth*.1, 1000,giseed giseed = frac(giseed*105.947) kport = kport + kvibdepth iphase = giseed knfrq = kport kampr1 randi .02*kbreath, 10, giseed giseed = frac(giseed*105.947) kamp1 = kbreath + kampr1 kampr2 randi .02*kbreath, 10, giseed giseed = frac(giseed*105.947) kamp2 = kbreath + kampr2 kampr3 randi .02*kbreath, 10, giseed giseed = frac(giseed*105.947) kamp3 = kbreath + kampr3 awt1 oscili kamp1, kport, gitable3, iphase awt2 oscili kamp2, kport, gitable4, iphase awt3 oscili kamp3, kport, gitable5, iphase awnoise rand 20000, giseed afiltn butbp awnoise, knfrq,100 kbreath = (knoise = 1 ? kbreath : 0) asig = awt1 + awt2 + awt3+(afiltn*kbreath*.4) asig = asig/3/4000 afilt tone asig, kfilt2 asig balance afilt, asig outs asig, asig garev = garev + asig endin instr 100 ;printk 1, gkbreath ;krevenv linseg 2, p3, 2, 1.0, 0.1 arev reverb garev, 2.0;krevenv ;arev clip arev, 5 outs arev*0.1, arev*0.1 garev = 0 endin </CsInstruments> <CsScore> f 0 36000 i 100 0 3600 </CsScore> </CsoundSynthesizer> |
|
|
Re: [csnd] Windcontroller Portamento with cpsmidib opcodeSteven Yi wrote an article in an early Csound journal (online) about legato & portamento handling.
I wrote some code (featuring portomento) for somebody's wx7 wind controller, & the easiest solution i came up with (utilising Steven Yi's tiestatus UDO from the journal article) is to handle midi / user input in one csound instrument, & then translate that into sending score events to a subsequent sound generating instrument. i dont have code to hand. if you are patient i may be able to dig out some examples. but I dont have any experience with the wii. Steven's article & tiestatus opcode however is/are highly recommended
|
|
|
Re: Re: [csnd] Windcontroller Portamento with cpsmidib opcodeHello Tim
Thank you for your comment. I am very interested in your works about WX-7 and other. Tie-opcode and 'Legato & portamento handlings' will be useful for me. It is my csd file which I came up with just before.(It was a simple way. Still have a minor problem -less effective than pitchbend. I don't know why.-) Your recommendations will make it better. Thank you so much. Have a great days~ <CsoundSynthesizer> <CsOptions> -odac -iadc -d </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 giseed = .5 garev init 0 gicps init 440 gitable1 ftgen 1, 0, 4096, 10, 1 gitable2 ftgen 3, 0, 4097, -10, 2661, 87, 33, 18 gitable3 ftgen 4, 0, 4097, -10, 174, 12, gitable4 ftgen 5, 0, 4097, -10, 314, 13, gitable5 ftgen 6, 0, 16, -2, 40, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 10240 ctrlinit 1, 2, 0 ctrlinit 1, 1, 0 instr 1 ;This is based on Flute1.csd from Dr. Boulanger's csound library. I modified it for Midi_Windcontoroller and Wiimote. knoise chnget "noise" kvib chnget "vibrato" kport chnget "port" kfilt chnget "filt" kfilt2 chnget "filt2" iportim chnget "portamento" icpsb init gicps icps cpsmidi gicps = icps kpitch midictrl 1, 0, 100 kport linseg icpsb, iportim, gicps kport = kport - kpitch kbreath midictrl 2, 0, 1 gkbreath = kbreath kbreath port kbreath, 0.02 kbreath linenr kbreath, 0.02, 0.05, 0.1 kvibdepth = abs(kvib*kport/100.) kvibdepth randi kvibdepth*.1, 1000,giseed giseed = frac(giseed*105.947) kport = kport + kvibdepth iphase = giseed knfrq = kport tigoto kampr1 randi .02*kbreath, 10, giseed giseed = frac(giseed*105.947) kamp1 = kbreath + kampr1 kampr2 randi .02*kbreath, 10, giseed giseed = frac(giseed*105.947) kamp2 = kbreath + kampr2 kampr3 randi .02*kbreath, 10, giseed giseed = frac(giseed*105.947) kamp3 = kbreath + kampr3 awt1 oscili kamp1, kport, gitable3, iphase awt2 oscili kamp2, kport, gitable4, iphase awt3 oscili kamp3, kport, gitable5, iphase awnoise rand 20000, giseed afiltn butbp awnoise, knfrq,100 kbreath = (knoise = 1 ? kbreath : 0) asig = awt1 + awt2 + awt3+(afiltn*kbreath*.4) asig = asig/3/4000 afilt tone asig, kfilt2 asig balance afilt, asig outs asig, asig garev = garev + asig endin instr 100 ;printk 1, gkbreath ;krevenv linseg 2, p3, 2, 1.0, 0.1 arev reverb garev, 2.0;krevenv ;arev clip arev, 5 outs arev*0.1, arev*0.1 garev = 0 endin </CsInstruments> <CsScore> f 0 36000 i 100 0 3600 </CsScore> </CsoundSynthesizer> On Tue, Jun 30, 2009 at 9:01 PM, Tim Mortimer <timmortimer@...> wrote:
|
|
|
RE: [csnd] Windcontroller Portamento with cpsmidib opcodeYour portamento function (kport linseg icpsb, iportim, gicps) won't do anything because it begins and ends on the same value. I think what you want it to do is to glide from the previous pitch value to the current one, the following example does that. For pitch bend I would recommend 'pchbend' over 'cpsmidib'. This is probably not the way that you want to implement pitch portamento. See second example. ;----------------------------------------------------------------------------------------------------------------------- <CsoundSynthesizer> <CsOptions> -M0 -odac </CsOptions> <CsInstruments> sr = 44100 ksmps = 64 nchnls = 2 0dbfs = 1 gisine ftgen 0,0,4096,10,1 gkOctOld init 8 instr 1 ;PORTAMENTO TIME iporttime init 0.2 ;READ MIDI PITCH VALUES (OCT FORMAT) ioct octmidi ;PITCH BEND INFORMATION IS READ (2 SEMITONE RANGE) kbend pchbend 0, 2/12 ;AMPLITUDE ENVELOPE aenv linenr 0.1, 0.01, 0.01, 0.01 ;PORTAMENTO GLIDE FROM PREVIOUS PITCH TO CURRENT PITCH koct expseg i(gkOctOld), iporttime, ioct, 1, ioct ;AUDIO OSCILATOR asig oscili aenv, cpsoct(gkOctOld+kbend), gisine ;DEFINE OLD PITCH VALUE FOR NEXT PASS (I.E. NEXT NOTE); MUST BE GLOBAL VARIABLE gkOctOld = koct ;SEND AUDIO TO OUTPUTS outs asig, asig endin </CsInstruments> <CsScore> f 0 3600 </CsScore> </CsoundSynthesizer> ;----------------------------------------------------------------------------------------------------------------------- A more likely method of using portamento, and the one that I think Tim suggests, is on a monophonic instrument in which 2 instruments are used: one senses changes in pitch values and whether a note is actually being played and the other actually creates the sound. The first instrument instructs the second instrument to play if required. ;----------------------------------------------------------------------------------------------------------------------- <CsoundSynthesizer> <CsOptions> -odac -M0 </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 ;INITIALISE GLOBAL VARIABLES giportamento init 0.06 ;PORTAMENTO TIME gkcps init 0 ;INITIALISE GLOBAL VARIABLES gkNumInstr1 init 0 ;INITIALISE GLOBAL VARIABLES gisine ftgen 1, 0, 131072, 10, 1 ;A SINE WAVE - USED BY BOTH THE VIBRATO AND THE vco ;THIS INSTRUMENT SENSES INCOMING MIDI BUT DOESN'T MAKE ANY SOUND ITSELF, IT INSTRUCTS INSTR 2 TO PLAY instr 1 ;READ IN MIDI PITCH (OCT FORMAT) ioct octmidi ;PITCH BEND INFORMATION IS READ (2 SEMITONE RANGE) kbend pchbend 0, 2/12 ;CPS VALUE FOR PITCH gkcps = cpsoct(ioct + kbend) ;INSTR 2 IS INSTRUCTED TO PLAY A VERY LONG NOTE - ONLY ONE NOTE AT A TIME IS ALLOWED ; KTRIGGER, KMINTIM, KMAXNUM, KINSNUM, KWHEN, KDUR schedkwhen 1, 0, 1, 2, 0, 3600 endin ;SOUND PRODUCING INSTRUMENT (MONOPHONIC) instr 2 ;SENSE THE NUMBER OF NOTES ARE BEING PLAYED BY INSTR 1 gkNumInstr1 active 1 ;IF INSTR 1 IS NOT ACTIVE; I.E. NO MIDI NOTES ARE BEING HELD... if gkNumInstr1=0 then turnoff ;INSTR 2 TURNS ITSELF OFF IF INSTR IS INACTIVE endif ;CREATE PORTAMENTO ON PITCH PARAMETER kporttime linseg 0, (.01), giportamento, (1), giportamento kcps portk gkcps, kporttime ;AMPLITUDE ENVELOPE aenv linenr 0.5, 0.01, 0.01, 0.01 ;CREATE AN OSILLATOR asig oscili aenv, kcps, gisine ;SEND SIGNAL TO OUTPUT outs asig, asig endin </CsInstruments> <CsScore> f 0 3600 ;DUMMY SCORE EVENT - REAL TIME PERFORMANCE FOR 1 HOUR </CsScore> </CsoundSynthesizer> ;----------------------------------------------------------------------------------------------------------------------- You should still investigate Steven Yi's work on designing legato instruments. I hope this helps, Bye, Iain Date: Tue, 30 Jun 2009 17:49:53 -0400 From: jaikai10@... To: csound@... Subject: [Csnd] [csnd] Windcontroller Portamento with cpsmidib opcode Hello! csounder. It is a question about Portamento and cpsmidib. This csd file is for woodwind instrument for Akai_Ewi and Wiimote. This csd use cpsmidib with i-rate as note input and Linseg opcode as a portamento funtion, in this case I can't control pitchbend, when I am blowing Ewi(noteon). Can you tell me what I miss, some hint or tips for using k-rate_cpsmidib and portamento together, Or another Idea for making portamento. Thank you in advance. <CsoundSynthesizer> <CsOptions> -odac -iadc -d </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 giseed = .5 garev init 0 gicps init 440 gitable1 ftgen 1, 0, 4096, 10, 1 gitable2 ftgen 3, 0, 4097, -10, 2661, 87, 33, 18 gitable3 ftgen 4, 0, 4097, -10, 174, 12, gitable4 ftgen 5, 0, 4097, -10, 314, 13, gitable5 ftgen 6, 0, 16, -2, 40, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 10240 ctrlinit 1, 2, 0 instr 1 ; This is based on Flute1.csd from Dr. Boulanger's csound library. I modified it for Midi_Windcontoroller and Wiimote. knoise chnget "breathnoise" kvib chnget "vibrato" kport chnget "port" kfilt chnget "filt" kfilt2 chnget "filt2" iportim chnget "portamento" icpsb init gicps icps cpsmidib gicps = icps kport linseg icpsb, iportim, gicps kbreath midictrl 2, 0, 1 gkbreath = kbreath kbreath port kbreath, 0.02 kbreath linenr kbreath, 0.02, 0.05, 0.1 kvibdepth = abs(kvib*kport/100.) kvibdepth randi kvibdepth*.1, 1000,giseed giseed = frac(giseed*105.947) kport = kport + kvibdepth iphase = giseed knfrq = kport kampr1 randi .02*kbreath, 10, giseed giseed = frac(giseed*105.947) kamp1 = kbreath + kampr1 kampr2 randi .02*kbreath, 10, giseed giseed = frac(giseed*105.947) kamp2 = kbreath + kampr2 kampr3 randi .02*kbreath, 10, giseed giseed = frac(giseed*105.947) kamp3 = kbreath + kampr3 awt1 oscili kamp1, kport, gitable3, iphase awt2 oscili kamp2, kport, gitable4, iphase awt3 oscili kamp3, kport, gitable5, iphase awnoise rand 20000, giseed afiltn butbp awnoise, knfrq,100 kbreath = (knoise = 1 ? kbreath : 0) asig = awt1 + awt2 + awt3+(afiltn*kbreath*.4) asig = asig/3/4000 afilt tone asig, kfilt2 asig balance afilt, asig outs asig, asig garev = garev + asig endin instr 100 ;printk 1, gkbreath ;krevenv linseg 2, p3, 2, 1.0, 0.1 arev reverb garev, 2.0;krevenv ;arev clip arev, 5 outs arev*0.1, arev*0.1 garev = 0 endin </CsInstruments> <CsScore> f 0 36000 i 100 0 3600 </CsScore> </CsoundSynthesizer> Windows Live™: Keep your life in sync. Check it out. |
|
|
Re: [csnd] Windcontroller Portamento with cpsmidib opcodeIve cut this out of a larger ensemble, so there may be some redundant / wierd code, or slightly idiosyncratic things going on, but it should give you another example to pour over & hopefully find some useful ideas.
it uses cc1 (modwheel) to model what would happen when controlled by cc2 breath control. just change the appropraite cc number - there's a note to this effect in the code. you'll no doubt have to fiddle around with it. take & use what is of any use. hope it helps / is of interest. ;;;************************ ;;;************************ ;;;************************ <CsoundSynthesizer> <CsOptions> ;;; --midi-device=0 -d </CsOptions> <CsInstruments> sr = 48000 ksmps = 16 nchnls = 2 0dbfs = 1 gicctodBmap ftgen 1,0,128,-7,-50,128,0 gamp init 0 gktakeover init 0 ;;;soft takeover release start for notes ;;;truncated during atk phase gkPORTOtakeover init 0 gisine ftgen 100, 0, 16384, 10, 1 zakinit 2,1 massign 0,0 ;;;************************ ;;;************************ ;;;************************ ;;;DEFINE UDOS opcode tieStatus,i,0 itie tival if (itie == 0 && p3 < 0) ithen ; this is an initial note within a group of tied notes itiestatus = 0 elseif (p3 < 0 && itie == 1) ithen ; this is a middle note within a group of tied notes itiestatus = 1 elseif (p3 > 0 && itie == 1) ithen ; this is an end note out of a group of tied notes itiestatus = 2 elseif (p3 > 0 && itie == 0) ithen ; this note is a standalone note itiestatus = -1 endif xout itiestatus endop opcode MIDI2cpsi, i, i imidi xin inotexpo = (imidi-69)/12 i2x = powoftwo (inotexpo) icps = i2x*440 xout icps endop opcode MIDI2cpsk, k, k kmidi xin knotexpo = (kmidi-69)/12 k2x = powoftwo (knotexpo) kcps = k2x*440 xout kcps endop ;;;************************ ;;;************************ ;;;************************ ;;;USER MIDI INPUT instr 01 kactivenote init -1 kinsttarget = 100 ;;;************** ;;; raw midi input kstatus, kchan, kdata1, kdata2 midiin if (kstatus == 144) then ;;noteon if (kdata2 != 0) then if kactivenote != -1 then ;;;switch off currently active note event "i", kinsttarget, 0, .01, kactivenote endif ;;;transmit new note knote = kdata1 event "i", kinsttarget, 0, -.1, kdata1 ;;;log new note as active note kactivenote = kdata1 printk2 kactivenote endif endif ;;;************** ;;; test using modwheel (icc = 1) ;;;change to cc2 for breath control (icc = 2) icc = 1 kbreath ctrl7 1,icc,0,127 ;;;************** ;;;breath control Xing conditional triggers koffflag trigger kbreath, 1, 1 konflag trigger kbreath, 0.5, 0 printk2 koffflag,10 printk2 konflag,5 if koffflag == 1 && kactivenote != -1 then ;;;switch off currently active note event "i", kinsttarget, 0, .01, kactivenote elseif konflag == 1 && kactivenote != -1 then event "i", kinsttarget, 0, -.1, kactivenote endif kdB table kbreath, 1 kdB port kdB,.02 kamp = ampdb(kdB) adB = a(kdB) aamp = ampdb(adB) gamp = aamp endin ;;; ********* ;;; INSTR 100 ;;; SIMPLE SINE SYNTH instr 100 imidi = p4 icps MIDI2cpsi imidi kmidi init imidi iportostart = i(gkPORTOtakeover) ;;;TIED NOTE? itie tieStatus itakeover = i(gktakeover) if itie == 0 then ;; initial tied note iphase = 1 aenv linseg 0,.005,1,0,1 ;aenv = 1 kenv linseg 0,.005,1,0,1 ;;;for soft takeover purposes gktakeover = kenv kporto init imidi elseif itie == 1 then iphase = -1 aenv = a(gktakeover) ;aenv = 1 kporto linseg iportostart,.25,imidi,0,imidi ;;;for soft takeover purposes elseif itie == 2 then iphase = -1 aenv linseg itakeover,.01,0,0,1 kporto linseg iportostart,.25,imidi,0,imidi ;;;for soft takeover purposes endif ;print itie gkPORTOtakeover = kporto kcps MIDI2cpsk kporto asig oscili aenv, kcps, 100, iphase zawm asig, 0 endin ;;;************************ ;;;************************ ;;;************************ ;;;global amplitude control instr 10000 ain zar 0 aout = ain*gamp aout = aout*.5 outs aout,aout zacl 0, 1 endin ;;;************************ ;;;************************ ;;;************************ </CsInstruments> <CsScore> i 1 0 360 i 10000 0 360 e </CsScore> </CsoundSynthesizer> |
|
|
Re: RE: [csnd] Windcontroller Portamento with cpsmidib opcodeHello Lain, Tim
Thank you for your comments and codes. The pchbend and octmidi are exactly what I am looking for. There are lots of stuff I haven't seen before. I need time for understanding yours. I will try t now!! And, I am sorry about I didn't write down comment each line for understanding my code easily. By the way, I don't understand part of your comment - "Your portamento function (kport linseg icpsb, iportim, gicps) won't do anything because it begins and ends on the same value." It may not be a same value. It works. Am I missunderstanding or miss something? My portamento function(which I updated, yesterday) has been working. =============================================================================== icpsb init gicps ; icpbs is previous pitch icps cpsmidi ; It is a new pitch gicps = icps ; assign new pitch to gicp kpitch midictrl 1, 0, 100 ; It is for pitchbend kport linseg icpsb, iportim, gicps ; Portamento from old pitch to new pitch, iportamento time from wiimote in Max patch. ================================================================================ I am happy in csound world. I glad to know yours in csound world. Thank you for your guide and teach. On Wed, Jul 1, 2009 at 5:15 AM, Iain McCurdy <i_mccurdy@...> wrote:
|
|
|
RE: Re: RE: [csnd] Windcontroller Portamento with cpsmidib opcodeIain Date: Wed, 1 Jul 2009 14:13:33 -0400 From: jaikai10@... To: csound@... Subject: [Csnd] Re: RE: [csnd] Windcontroller Portamento with cpsmidib opcode Hello Lain, Tim Thank you for your comments and codes. The pchbend and octmidi are exactly what I am looking for. There are lots of stuff I haven't seen before. I need time for understanding yours. I will try t now!! And, I am sorry about I didn't write down comment each line for understanding my code easily. By the way, I don't understand part of your comment - "Your portamento function (kport linseg icpsb, iportim, gicps) won't do anything because it begins and ends on the same value." It may not be a same value. It works. Am I missunderstanding or miss something? My portamento function(which I updated, yesterday) has been working. =============================================================================== icpsb init gicps ; icpbs is previous pitch icps cpsmidi ; It is a new pitch gicps = icps ; assign new pitch to gicp kpitch midictrl 1, 0, 100 ; It is for pitchbend kport linseg icpsb, iportim, gicps ; Portamento from old pitch to new pitch, iportamento time from wiimote in Max patch. ================================================================================ I am happy in csound world. I glad to know yours in csound world. Thank you for your guide and teach. On Wed, Jul 1, 2009 at 5:15 AM, Iain McCurdy <i_mccurdy@...> wrote:
Lauren found her dream laptop. Find the PC that’s right for you. |
| Free embeddable forum powered by Nabble | Forum Help |