Re: MIDI Wavetable Technical Implementation Reference?
- From: N0Spam@xxxxxxxxxxx (Bob Masta)
- Date: Wed, 31 Dec 2008 14:18:21 GMT
On Tue, 30 Dec 2008 22:23:47 GMT, "Karl Uppiano"
<Karl_Uppiano@xxxxxxx> wrote:
I have been scouring the web for an implementation reference for MIDI
wavetable synthesizers. So far I have not found the magic Google keyword, or
the information isn't published. All I have found so far are layman's
descriptions (instruments are sampled and played back at the proper pitch
and loudness -- yeah, I get that).
I am more interested in the compute intensity and hardware layout for a
typical computer MIDI sound card, and the trade-offs for different price
points. It seems that 16 channels with 32 note polyphony would require lots
of DACs and analog faders, or lots of DSP, or both. I don't see the main CPU
handling all that in real time.
Can someone direct me to a good technical reference?
I don't have a reference, but I would assume this
is done similarly to the way DirectSound handles
multiple output streams. There is only one DAC
and hardware fader per channel, so the streams are
all faded in software and summed together before
going out to the single DAC.
If you have 32 separate streams sounding at once,
then there is the possibility that their sum will
be up to 32x larger than the full-scale range of
the DAC, so you will have to shift the sum down by
5 bits before sending it out. (Unless you have
already faded them down appropriately before
summing. Otherwise, it's better to keep them high
and scale after summing.)
So to handle this all in real time, you could have
a buffer for each stream. When you get a Note On
command, copy the appropriate voice data into that
buffer starting from the beginning of the font
image for that voice. When the buffer is full you
store a pointer to the source and go on to handle
the next simultaneous voice. When all 32 buffers
are updated, sum them sample-by-sample and shift
down and copy to the output buffer.
You will have to keep this process going all the
time, keeping the stream buffers and the output
buffer from getting sucked dry by the DAC. When a
stream buffer is emptied, you fill it from the
current source pointer and advance the pointer.
When the source finishes with the attack phase and
goes to sustain (for those voices with sustain)
then you will switch to the sustain source. When
you get a Note Off command for that stream you
switch to the decay source. When that is
exhausted you send silence until the stream is
re-used.
All of the above glosses over how to handle
transitions between attack, sustain, and decay.
It also assumes that you have a memory image of
every possible note for every possible voice. I
don't know how real synths handle note
interpolation... it's technically the same thing
as sample rate conversion, which is non-trivial.
There are a few tricks you could use if you knew
you were only going to need equal-tempered tones,
but that wouldn't accomodate pitch bend.
Anyway, that's a rough outline from someone who is
definitely *NOT* a synth designer, but who has a
fair amount of sound card experience. YMMV! <g>
Best regards,
Bob Masta
DAQARTA v4.51
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
FREE Signal Generator
Science with your sound card!
.
- Follow-Ups:
- Re: MIDI Wavetable Technical Implementation Reference?
- From: Karl Uppiano
- Re: MIDI Wavetable Technical Implementation Reference?
- References:
- MIDI Wavetable Technical Implementation Reference?
- From: Karl Uppiano
- MIDI Wavetable Technical Implementation Reference?
- Prev by Date: MIDI Wavetable Technical Implementation Reference?
- Next by Date: Re: MIDI Wavetable Technical Implementation Reference?
- Previous by thread: MIDI Wavetable Technical Implementation Reference?
- Next by thread: Re: MIDI Wavetable Technical Implementation Reference?
- Index(es):
Relevant Pages
|