[Csnd] MIDI realtime and a probably feature request
Date | 2012-03-15 20:14 |
From | Julien Claassen |
Subject | [Csnd] MIDI realtime and a probably feature request |
Hello again everyone! OK, having read and meagerly replied to the thread about polyphonic portamento, I thought, that this would make a nice and very useful feature in csound. Voice-tying. Same woyuld go for voice stealing. Csound's current behaviour with maxalloc is to just ignore further events after that. Which certainly is not that behaviour used to from other typical hardware or software synths. I mean those, that are typically associated with attached keyboards and sounds for relatively popular music only. There you'd suspect the next note-on to steal a voice, usually turning of the first allocated voice. So: Would those, who use csound everyday, perhaps think it worth it as well, to have something to control csound's behaviour in that way. Allowing for voice stealing and allowing for some sort of voice tying between instruments. There are techniques to achieve that right now, I am sure, but for someone working with MIDI controlled typical synth instruments - i.e. melodic - things like voice stealing are a piece of daily living. Kind regards and thanks for following my ramblings so far Julien =-=-=-=-=-=-=-=-=-=-=-=- Such Is Life: Very Intensely Adorable; Free And Jubilating Amazement Revels, Dancing On - FLOWERS! ====== Find my music at ====== http://juliencoder.de/nama/music.html ..................................... "If you live to be 100, I hope I live to be 100 minus 1 day, so I never have to live without you." (Winnie the Pooh) |
Date | 2012-03-15 22:16 |
From | Steven Yi |
Subject | Re: [Csnd] MIDI realtime and a probably feature request |
I had implemented a voice stealing algorithm in prior email to the list: http://csound.1045644.n5.nabble.com/Realtime-midi-audio-and-polyphony-td1099266.html#a1099270 It was a bit basic, and not looking at it thoroughly, but assuming since I wrote it 5+ years ago, I'd probably use some of the newer conventions in Csound now. It may be worth looking at though. On Thu, Mar 15, 2012 at 8:14 PM, Julien Claassen |
Date | 2012-03-15 23:04 |
From | Julien Claassen |
Subject | Re: [Csnd] MIDI realtime and a probably feature request |
Hi Steven! Thanks for this. I must admit, it does look a bit long for such a "small" task. This is no critique of your work, it's brilliant and certainly flexible enough at its base to suite more complex algorithms, but for me as a simple-minded orchestra writer it looks like a lot of trouble for a feature, which I've come to know and rely upon quite a bit. It's no criticism of csound as well, and yet it would still be lovely to have a simple opcode for this, which would allow for the typical three algorithms (last, lowest and highest note priority) and which would allow for a release phase of all those envelopes, which allow for it to run through instead of directly cutting the note. This might not be true hard synth behaviour, but something like it - at least as an option - would be absolutely splendid. I will keep your example around here though, Steven, for I think it should very much serve for the time being. Warm regards Julien =-=-=-=-=-=-=-=-=-=-=-=- Such Is Life: Very Intensely Adorable; Free And Jubilating Amazement Revels, Dancing On - FLOWERS! ====== Find my music at ====== http://juliencoder.de/nama/music.html ..................................... "If you live to be 100, I hope I live to be 100 minus 1 day, so I never have to live without you." (Winnie the Pooh) |
Date | 2012-03-16 07:34 |
From | Oeyvind Brandtsegg |
Subject | Re: [Csnd] MIDI realtime and a probably feature request |
I have a similar solution in the Hadron orchestra too (partikkelaudio.com, http://www.partikkelaudio.com/plugin_free/HadronSource.zip, in the file inc/midi_note_instr.inc), it was written "prepared for" polyphonic (mono) voice allocation but currently only one voice is used so some bits may be missing. I probably worte it at the time this was last discussed and inspired by Steven's solution it uses tables to keep lists of active notes in a similar manner . Agreed there's a lot of code for a "simple" thing, so perhaps an opcode for this sort of thing would be nice. The opcode could be used in a control instrument, together with an event opcode to generate the audio generator instrument events. this way release envelopes etc should be more or less straightforward in the audio generator instr. best Oeyvind 2012/3/16 Julien Claassen |
Date | 2012-03-19 00:19 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] MIDI realtime and a probably feature request |
Attachments | modeUDOs_akj.csd |
I've been obsessing with this problem myself for the last week or more! I first thought of implementing it as a simple ring buffer for MIDI notes, but I wanted voice stealing of already sounding notes to make it more efficient (i.e. notes that are the same pitch get automatically turned-off using 'turnoff2' and then restruck). My solution was to use tables as arrays to store the struck notes, oldest to newest, and I had to write some home-rolled UDOs for tables to work as arrays, doing things like getting rid of any slot entries that were empty by shoving all still-sounding entries to the 'front' of the table, etc.
My solution works well, so far. :) Attached is some code. I'd be interested in: 1) anyone's improvements...very rarely, I hear a note that is being attacked that gets cutoff short in a staccato-like way...
2) seeing this, or any other solution hardcoded into Csound as a bona fide opcode! My idea would be a global opcode called "mpolyphony", used like "massign" in the header, and it would maybe be like:
mpolyphony num_notes, instr, [options] num_notes would limit the sounding instances of instr, and options could contain release type, different stealing algorithms like high/low, etc.
In my code, based on Iain McCurdy's non-GUI version of his earlier FLTK 'mode.csd' demo, notice I call a 2nd instrument to trigger via "event_i", because in my case, I'm using it to do bell-like percussion instruments with a natural "release decay", so I use a -1 length in an event_i statement.... Best, AKJ
On Fri, Mar 16, 2012 at 2:34 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote: I have a similar solution in the Hadron orchestra too Aaron Krister Johnson http://www.akjmusic.com http://www.untwelve.org |
Date | 2012-03-19 08:15 |
From | Julien Claassen |
Subject | Re: [Csnd] MIDI realtime and a probably feature request |
Hello Aaron! Thank you for your work. I think you might have been even better off basing your work on Steven Yi's implementation of simple voice stealing. But still with "the same note" feature you certainly got one, that wasn't present in that solution for sure. The turnoff2 opcode also seems a very good choice. I will try it and see, what happens and what I might think of, which is probably not too much. :-( Warm regards Julien =-=-=-=-=-=-=-=-=-=-=-=- Such Is Life: Very Intensely Adorable; Free And Jubilating Amazement Revels, Dancing On - FLOWERS! ====== Find my music at ====== http://juliencoder.de/nama/music.html ..................................... "If you live to be 100, I hope I live to be 100 minus 1 day, so I never have to live without you." (Winnie the Pooh) |