octal-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: some simple physical modelling


From: David O'Toole
Subject: Re: some simple physical modelling
Date: Mon Mar 12 15:09:01 2001

> However, it would also be nice to be able to use one track to play a
> melody with all notes sustained, something like playing a melody on a
> piano with the sustain pedal held.  Using tracks for polyphony works
> well for emulating lute-like instruments, but it's not as easy for more
> harp- / piano-like instruments.

If the user wants all the notes to ring out as if the sustain pedal were
held, just don't send note-offs until you really want all the notes to
stop. You can do this by editing the pattern so that notes start at
different times but end at once. For live MIDI we might have to do some
buffering of note-offs (holding them until you release the midi sustain)
but I would rather write that code once than make machine authors each
do their own algorithm for holding notes on sustain. This is why I am
changing the name of ox_track to ox_channel.... the channel is really a
more general mechanism that is mapped to the voices inside each machine
(if you make objects that are capable of making one voice, you can
easily combine their output into polyphony.)  

That way the machine developer worries only about how to generate their
sound and how to respond to events; some of the general details like
voice allocation can be handled easily by the host. If the host can also
handle sustain in a transparent way (by postponing note-off events) then
we can use that for any generator instead of just ones that had sustain
code written in. I'm trying to make it as clean and easy as possible to
write machines that can take advantage of future host extensions.

How do you feel about doing it that way? 

> I think a combination of Matt's method 1 (but maybe so the number of
> buffers (degree of polyphony) could be set as a parameter) and

You don't actually need a buffer per voice if the algorithm is written
to add each output sample to its destination instead of replacing it.
That is, 

outbuf[index] += current_sample;

instead of outbuf[index] = current_sample;

Then you can give each voice the same output buffer, they don't all need
their own. Cache-friendly, eh? :-) If you choose to do this, don't
forget to clear the buffer before each block. 

> you wanted to emulate a 6-stringed instrument you would set the
> per-track polyphony to 1), and one where all tracks would share the
same
> polyphony (one set of buffers), for more harp- / piano-like things.

I agree we need both modes. I think that the model of "channel equals
voice" is low-level enough to make the machine-writing easy, but with a
little extra logic in the host, it can be made to do both guitar-style
voice cutoffs and piano-style sustain. And possibly other weird things
in the future. 


-- 
@@@ david o'toole
@@@ address@hidden
@@@ www.gnu.org/software/octal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]