Csound Csound-dev Csound-tekno Search About

Re: Realtime midi/audio and polyphony

Date2006-05-03 15:28
From"Art Hunkins"
SubjectRe: Realtime midi/audio and polyphony
I may be missing something, but I don't really see a problem. Whan a MIDI
device "expires" a note, surely it sends a note off message for the expired
note as it initiates a new one. So, the receiving software would be
completely unaware of the "too many voices" situation.

(A real challenge would be presented by trying to have Csound play more
simultaneous notes/voices than your synth allows, by *not* stopping voices
"expired" by your MIDI device. Of course, then you'd need to find some other
method of stopping these voices at the appropriate time.)

Art Hunkins

----- Original Message -----
From: "Tobiah" 
To: 
Sent: Tuesday, May 02, 2006 5:24 PM
Subject: [Csnd] Realtime midi/audio and polyphony


> I recently bought a synthesizer that has a given level of available
> polyphony; it can play a certain number of  simultaneous notes at one
time.
> As I noted in a previous email, I have been testing the limits
> of my machine's ability to render csound orchestras in realtime
> at the beck and call of my MIDI keyboard.
>
> I know that the synthesizer that I am using keeps track of
> the number of 'notes' that are used, and expires the oldest
> ones in favor of the ones that are more recently activated.
>
> My question is whether others have attacked the same problem
> using cound.  Has anybody come up with a way to expire active
> instruments based on the present level of polyphony?
>
> As always, thanks very much.
>
> Tobiah
> --
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk

Date2006-05-03 18:26
FromTobiah
SubjectRe: Realtime midi/audio and polyphony
Art Hunkins wrote:
> I may be missing something, but I don't really see a problem. Whan a MIDI
> device "expires" a note, surely it sends a note off message for the expired
> note as it initiates a new one. 

I'm not sure of that.  In the case of my synth, the keyboard and
synthesizer are in the same physical unit.  I imagine that the
synth computer simply replaces old notes with new ones when the
max polyphony is reached.  I would not guess that there is a
MIDI message involved.  It would be poor design as well in my opinion
if a note-off was sent from a unit just because it's own synth
could not handle the level of polyphony.


> So, the receiving software would be
> completely unaware of the "too many voices" situation.

> (A real challenge would be presented by trying to have Csound play more
> simultaneous notes/voices than your synth allows, by *not* stopping 
voices
> "expired" by your MIDI device.

My keyboard will surely send as many simultaneous notes as I am
able to press.  It just refuses to respond with sound to more
than 64 at one time.  My note bottleneck is in feeding processing power
to Csound.  After 20 or 30 notes are activated, I get buffer underruns,
and the sound breaks up.  That's why I want csound to drop old notes
in favor of new ones.

Toby

Date2006-05-03 20:21
FromDave Phillips
SubjectRe: Realtime midi/audio and polyphony
Art Hunkins wrote:

>I may be missing something, but I don't really see a problem. Whan a MIDI
>device "expires" a note, surely it sends a note off message for the expired
>note as it initiates a new one. So, the receiving software would be
>completely unaware of the "too many voices" situation.
>  
>
If I understand Tobiah correctly, he's made a virtue out of his hardware 
synth's polyphony limitation and wants Csound to behave in a similar 
fashion. I think the term in Ye Olden Tymes was something like "voice 
allocation". I always considered it a PITA but maybe Tobiah has found a 
musically useful purpose for the limitation ? At any rate, I don't 
recall that the hardware synths sent any MIDI message when the 
allocation limit was reached.

Best,

dp

Date2006-05-03 20:56
FromCharles Baker
SubjectRe: Realtime midi/audio and polyphony
On May 3, 2006, at 3:21 PM, Dave Phillips wrote:

> Art Hunkins wrote:
>
>> I may be missing something, but I don't really see a problem. Whan  
>> a MIDI
>> device "expires" a note, surely it sends a note off message for  
>> the expired
>> note as it initiates a new one. So, the receiving software would be
>> completely unaware of the "too many voices" situation.
>>
> If I understand Tobiah correctly, he's made a virtue out of his  
> hardware synth's polyphony limitation and wants Csound to behave in  
> a similar fashion. I think the term in Ye Olden Tymes was something  
> like "voice allocation".



"Voice Stealing" was a less kind phrase for it.
Many many words have been spent in arguing the "best voice stealing  
algorithm":

Longest sounding note?
Lowest note sounding over a set length threshold?
Duplicated notes?
Based on simple harmonic analysis ("never remove sounding root")?


This is not simple and straight forward. But well done voice  
allocation algorithms
are quite helpful in having performing synths w/ voice limitations  
sound good when performed with
unknown, unpredictable real time MIDI input:
if a melody note is stolen mid phrase, you're in trouble: so how do  
we *know*?


I've heard some wonderfully clear demonstrations of this:
by having a keyboard player play a (typically 16 voice) synth
with a sustain pedal, and shutting off the voice  
allocation/"stealing" software...
anyone can hear the in-opportune stolen notes.... turn the software  
back on,
and the "stolen" note  is almost always less audible: an inner voice,  
a note without immediate import in the music.

My guess is Toby thinks this sort of voice allocation software would  
be a nice addition to Csound,
given that it is becoming a quite useful real-time synth, gioven the  
latest processors/motherboards/discs.

hmmm?
j2k


> I always considered it a PITA but maybe Tobiah has found a  
> musically useful purpose for the limitation ? At any rate, I don't  
> recall that the hardware synths sent any MIDI message when the  
> allocation limit was reached.
>
> Best,
>
> dp
>
> -- 
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk

Date2006-05-03 20:59
FromTobiah
SubjectRe: Realtime midi/audio and polyphony
Art Hunkins wrote:
> I may be missing something, but I don't really see a problem. Whan a MIDI
> device "expires" a note, surely it sends a note off message for the expired
> note as it initiates a new one. 

I'm not sure of that.  In the case of my synth, the keyboard and
synthesizer are in the same physical unit.  I imagine that the
synth computer simply replaces old notes with new ones when the
max polyphony is reached.  I would not guess that there is a
MIDI message involved.  It would be poor design as well in my opinion
if a note-off was sent from a unit just because it's own synth
could not handle the level of polyphony.


> So, the receiving software would be
> completely unaware of the "too many voices" situation.

> (A real challenge would be presented by trying to have Csound play more
> simultaneous notes/voices than your synth allows, by *not* stopping 
voices
> "expired" by your MIDI device.

My keyboard will surely send as many simultaneous notes as I am
able to press.  It just refuses to respond with sound to more
than 64 at one time.  My note bottleneck is in feeding processing power
to Csound.  After 20 or 30 notes are activated, I get buffer underruns,
and the sound breaks up.  That's why I want csound to drop old notes
in favor of new ones.

Toby

Date2006-05-03 22:40
FromTobiah
SubjectRe: Realtime midi/audio and polyphony
I may have done a poor job of expressing my wishes.  Charlie Baker
was the closest at interpreting what must have been a slightly
incoherent email.  I don't enjoy the polyphony limitation.  I
just want csound to intelligently manage my voices when I approach
the limitation of my computer's processing power as applied to
realtime performance, and in particular where the performance is 
triggered by MIDI control.

Thanks,

Toby

Dave Phillips wrote:
> Art Hunkins wrote:
> 
>> I may be missing something, but I don't really see a problem. Whan a MIDI
>> device "expires" a note, surely it sends a note off message for the 
>> expired
>> note as it initiates a new one. So, the receiving software would be
>> completely unaware of the "too many voices" situation.
>>  
>>
> If I understand Tobiah correctly, he's made a virtue out of his hardware 
> synth's polyphony limitation and wants Csound to behave in a similar 
> fashion. I think the term in Ye Olden Tymes was something like "voice 
> allocation". I always considered it a PITA but maybe Tobiah has found a 
> musically useful purpose for the limitation ? At any rate, I don't 
> recall that the hardware synths sent any MIDI message when the 
> allocation limit was reached.
> 
> Best,
> 
> dp
> 

Date2006-05-04 13:12
FromTobiah
SubjectRe: Realtime midi/audio and polyphony
> but yer right Stephen: a FIFO queue implementation is the first step.

FILO, right?

Date2006-05-04 19:15
From"Steven Yi"
SubjectRe: Realtime midi/audio and polyphony
AttachmentsNone  

Date2006-05-04 19:54
FromCharles Baker
SubjectRe: Realtime midi/audio and polyphony
Stephen, Toby, et.al.

Hardware synth designers have been interested in this issue for  
years....
one of the best reviews of the area is in  a wonderful book (hard to  
find)
in the "Computer Music and Digital Audio " series from
A-R Editions:

Synthesiser Performance and real-time techniques
by Jeff Pressing (may he rest.in.peace)
ISBN 0-89579-9000
Pages 139-144

FIFO is the most common,
but can cause problems,
there are many tricks:
Yamaha and Kurzwiel implement a "forced damp" or "steal release rate"  
on the stolen notes, so their drop out is not so noticable:
you can also do tricks like detecting non-legato voices (voice w/  
"rest"/"air" in it) and locking one voice to it, freeing up any other  
voices to handle the more difficult legato notes, where voice  
stealing can ruin the musical sense.

but yer right Stephen: a FIFO queue implementation is the first step.

We really need the experience of a hardware synth designer here ...

*ping*   *ping*    *ping*


None on my radar right now, but this is a big community....


Charlie B.






ps: anybody know why no one wants me as a electromus teacher, given  
that this c**p is what I do best????...sigh.
ok, *please* don' t answer

On May 4, 2006, at 2:15 PM, Steven Yi wrote:

> Hi Toby,
>
> I was thinking about this last night and in non-Csound terms it seems
> that it could be implemented as linked list of active notes, new notes
> added to the tail.  As each note normally deactivates, it removes
> itself from the linked-list and joins the links around it.  When a
> note is added to the tail, it does a call back down the chain to check
> if there's any notes beyond the limit and tells them to turn off.
>
> With Csound, I'm wondering what ways are there to implement that.  I
> don't use MIDI ever with Csound so am speculating here, but perhaps
> you could make an instrument that recieves the MIDI info and does the
> voice stealing logic and will turn on and off notes; the list of
> active notes could be stored in a local ftable, and when notes are
> deactivated, the notes in the table can be cleaned of old notes (to
> act like unlinking a node from the linked list).  It's hard to explain
> exactly; I'll try to see if I can make an orc that does the trick.  If
> this works, then I think the technique could be later expanded to do
> things that Charles was mentioning.
>
> steven
>
>
> On 5/3/06, Tobiah  wrote:
>> I may have done a poor job of expressing my wishes.  Charlie Baker
>> was the closest at interpreting what must have been a slightly
>> incoherent email.  I don't enjoy the polyphony limitation.  I
>> just want csound to intelligently manage my voices when I approach
>> the limitation of my computer's processing power as applied to
>> realtime performance, and in particular where the performance is
>> triggered by MIDI control.
>>
>> Thanks,
>>
>> Toby
>>
>> Dave Phillips wrote:
>> > Art Hunkins wrote:
>> >
>> >> I may be missing something, but I don't really see a problem.  
>> Whan a MIDI
>> >> device "expires" a note, surely it sends a note off message for  
>> the
>> >> expired
>> >> note as it initiates a new one. So, the receiving software  
>> would be
>> >> completely unaware of the "too many voices" situation.
>> >>
>> >>
>> > If I understand Tobiah correctly, he's made a virtue out of his  
>> hardware
>> > synth's polyphony limitation and wants Csound to behave in a  
>> similar
>> > fashion. I think the term in Ye Olden Tymes was something like  
>> "voice
>> > allocation". I always considered it a PITA but maybe Tobiah has  
>> found a
>> > musically useful purpose for the limitation ? At any rate, I don't
>> > recall that the hardware synths sent any MIDI message when the
>> > allocation limit was reached.
>> >
>> > Best,
>> >
>> > dp
>> >
>>
>> --
>> Send bugs reports to this list.
>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>
> --
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk

Date2006-05-04 20:30
From"Steven Yi"
SubjectRe: Realtime midi/audio and polyphony
AttachmentsNone  

Date2006-05-04 22:07
FromCharles Baker
SubjectRe: Realtime midi/audio and polyphony


FILO , sorry...
I am over 102 degrees right now, so I am both rambing,  not coding  
for a living so I haunt non-work lists, , and bitter/sad.
Bad combo.
Gonna take more pills & sleep.

Dr B.
On May 4, 2006, at 3:30 PM, Steven Yi wrote:

> I think what you were looking for was FIFO, no?  First-In, First-Out,
> meaning if the list is full, take out the oldest note (the first one
> into the list).  FILO, First-In, Last-Out, would mean when you pop out
> notes from the list, it'd act like a stack and so the last one you put
> in would come out first.
>
>
> On 5/4/06, Tobiah  wrote:
>>
>> > but yer right Stephen: a FIFO queue implementation is the first  
>> step.
>>
>> FILO, right?
>> --
>> Send bugs reports to this list.
>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>
> --
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk

Date2006-05-05 00:00
From"Steven Yi"
SubjectRe: Realtime midi/audio and polyphony
AttachmentsNone  

Date2006-05-07 07:57
FromAtte André Jensen
SubjectRe: Realtime midi/audio and polyphony
Charles Baker wrote:

> FILO , sorry...

It must be FIFO ...

The allocator puts notes on the queue and the stealer removed notes from 
the bottom of the queue if it reaches a certain size...

-- 
peace, love & harmony
Atte

http://www.atte.dk      | quartet:      http://www.anagrammer.dk
http://www.atte.dk/gps  | compositions: http://www.atte.dk/compositions

Date2006-05-07 13:10
FromCharles Baker
SubjectRe: Realtime midi/audio and polyphony
On May 7, 2006, at 2:57 AM, Atte André Jensen wrote:

> Charles Baker wrote:
>
>> FILO , sorry...
>
> It must be FIFO ...
>
> The allocator puts notes on the queue and the stealer removed notes  
> from the bottom of the queue if it reaches a certain size...



right: FILO queue = "push-down stack"

FIFO = "bottom-trimmed queue"

The earliest notes are the first "stolen"...they *should* be mostly  
through their en velope cycles: if they are still sustained,
they produce audible clicking.


Fever broke, now If they send me that contract, all will somewhat ok  
(still no music jobs, tho...hecka lotta good that PhD did me: I work  
in a field in which I took no classes at all!)

PS: Toby: a simple ramp down on the stolen note would improve the  
real time sound immensely, I should imagine: it was Yamaha and  
Kurzweil's first choice to fix this realtime problem....