[Csnd] MIDI controlled envelope...
Date | 2010-05-15 16:41 |
From | Anthony Palomba |
Subject | [Csnd] MIDI controlled envelope... |
I want to create a MIDI instrument that allows me to control the attack and release of notes when played by MIDI. This is my sample instrument... instr 1 iCPS cpsmidi iAmp veloc 0.01, 1 a1 oscili 1, iCPS, 1 ; Apply the amp envelope and velocity. a1 = a1 * iAmp outs a1, a1 endin Controlling the envelope attack time is easy. The problem is how can I tell when the note off occurs so I can determine the release time? Thanks, Anthony |
Date | 2010-05-15 16:51 |
From | Victor Lazzarini |
Subject | [Csnd] Re: MIDI controlled envelope... |
You can use the 'release' opcode. On 15 May 2010, at 16:41, Anthony Palomba wrote: > I want to create a MIDI instrument that allows me to control the > attack and release of notes when played by MIDI. > > This is my sample instrument... > > instr 1 > iCPS cpsmidi > iAmp veloc 0.01, 1 > > a1 oscili 1, iCPS, 1 > > ; Apply the amp envelope and velocity. > a1 = a1 * iAmp > > outs a1, a1 > endin > > > Controlling the envelope attack time is easy. The problem > is how can I tell when the note off occurs so I can > determine the release time? > > > > Thanks, > Anthony > 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 | 2010-05-15 17:17 |
From | Andres Cabrera |
Subject | [Csnd] Re: Re: MIDI controlled envelope... |
Or any of the 'r' family of opcodes: madsr, linenr, expsegr, etc. Cheers, Andrés On Sat, May 15, 2010 at 4:51 PM, Victor Lazzarini |
Date | 2010-05-15 18:29 |
From | Rory Walsh |
Subject | [Csnd] Re: Re: Re: MIDI controlled envelope... |
You may also want to look at using the MIDI/Score Interoperability opcodes which eliminates the use of midicps and opcodes like that. Using these opcodes allows you to pass midi data to instruments using p-fields. This means you don't need to hardcode any midi opcodes directly into your instruments. Rory. On 15 May 2010 17:17, Andres Cabrera |
Date | 2010-05-16 19:07 |
From | Anthony Palomba |
Subject | [Csnd] Re: Re: Re: Re: MIDI controlled envelope... |
Hey guys, thanks for the replies. madsr is what I went with. This is what I have so far... ; simple sine wave instrument instr 1 ; MIDI input iCPS cpsmidi iVel veloc 0.01, 1 ; ADSR values iattack = 0.15 idecay = 0 isustain = 1 irelease = 0.5 aenv madsr iattack, idecay, isustain, irelease a1 oscili 1, iCPS, 1 a1 = a1 * aenv ; Apply the amp envelope a1 = a1 * iVel ; scale for velocity outs a1, a1 endin The problem I have now is that when I play multiple notes, I tend to get a lot of samples out of range. Is there a way to tell csound to scale the output of each voice so that I do not get distortion. -ap On Sat, May 15, 2010 at 12:29 PM, Rory Walsh <rorywalsh@ear.ie> wrote: You may also want to look at using the MIDI/Score Interoperability |
Date | 2010-05-16 19:45 |
From | Oeyvind Brandtsegg |
Subject | [Csnd] Re: Re: Re: Re: Re: MIDI controlled envelope... |
The most common thing to do is to just scale everything down. e.g. a1 = a1 *0.3 The sum output will be significantly higher when you play more notes, but this is quite natural. If you think of how e.g. an acoustic piano works, it will also create a louder sound when you play more notes simultaneously. best Oeyvind 2010/5/16 Anthony Palomba |
Date | 2010-05-16 19:51 |
From | Felipe Sateler |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: MIDI controlled envelope... |
But the piano does not have an amplitude proportional to the number of notes played. Or does it? On Sun, May 16, 2010 at 14:45, Oeyvind Brandtsegg |
Date | 2010-05-16 19:58 |
From | Victor Lazzarini |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: MIDI controlled envelope... |
You will need to set a certain headroom instead. On 16 May 2010, at 19:51, Felipe Sateler wrote: > But the piano does not have an amplitude proportional to the number of > notes played. Or does it? > > On Sun, May 16, 2010 at 14:45, Oeyvind Brandtsegg > |
Date | 2010-05-16 19:59 |
From | Oeyvind Brandtsegg |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: MIDI controlled envelope... |
Well, it is proportional, but not twice as high for two notes as for one (and so on). Neither will the Csound instrument do this, unless the added notes have exactly the same frequency and phase. best Oeyvind 2010/5/16 Felipe Sateler |
Date | 2010-05-16 20:37 |
From | Felipe Sateler |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: MIDI controlled envelope... |
I know it is not twice as high, because it will depend on the phase and frequency of the notes played, as you note. However, what I had in mind is that there is an upper bound to how high an amplitude can a piano emit, because the amplitude is mostly determined by the resonance box, not the source vibration in the string. On Sun, May 16, 2010 at 14:59, Oeyvind Brandtsegg |
Date | 2010-05-16 20:45 |
From | Anthony Palomba |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: MIDI controlled envelope... |
Wow, I would think that by now csound would be able to manage mixing of polyphony better. Is there a way I can get the number of voices that are currently playing? -ap
On Sun, May 16, 2010 at 1:59 PM, Oeyvind Brandtsegg <obrandts@gmail.com> wrote: Well, it is proportional, but not twice as high for two notes as for |
Date | 2010-05-16 22:03 |
From | Victor Lazzarini |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: MIDI controlled envelope... |
What do you mean? No system does that. What your synth box usually do is to have enough headroom to play max polyphony without clipping. My old emulator sampler has even a parameter to set extra headroom if you ran out of it. Regards Victor On 16 May 2010, at 20:45, Anthony Palomba wrote: Wow, I would think that by now csound would be able to manage |
Date | 2010-05-16 22:38 |
From | Oeyvind Brandtsegg |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: MIDI controlled envelope... |
agreed, as it would make any previously sounding notes suddenly drop in amplitude when new notes were added. Or is there some clever trick you're suggesting that we're unaware of? all best Oeyvind 2010/5/16 Victor Lazzarini |
Date | 2010-05-16 22:46 |
From | Steven Yi |
Subject | [Csnd] Re: MIDI controlled envelope... |
I had written an example of how to do voice allocation with first-in/first-out behavior on this list before. I'm cureently away from computer en route home, but it should be in the mailing list archive. On 5/16/10, Anthony Palomba |
Date | 2010-05-19 03:12 |
From | Steven Yi |
Subject | [Csnd] Re: MIDI controlled envelope... |
Hi Anthony, Here's a link to an email I wrote that has a voice allocation mechanism example CSD: http://old.nabble.com/Re:-Realtime-midi-audio-and-polyphony-p4239007.html May not be the most efficient, but it works and may be something to start from in implementing your own voice allocation system. steven On Sun, May 16, 2010 at 5:46 PM, Steven Yi |