How many values of MIDI (envelope) do I need for it to be "fine"?

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

How many values of MIDI (envelope) do I need for it to be "fine"?

Like what's the (vertical) resolution of automation envelopes in DAWs?
Last edited by soundmodel on Thu May 24, 2018 9:18 am, edited 1 time in total.

Post

It seems that the fineness is restricted by the audio buffer size. That is, one will not hear changes that are finer than the audio buffer.

For example for 256 samples buffer size @ 44.1kHz:

44100/256=172.265625 audio frames in a second

So it's enough to have at most 172 midi points for a second of audio to get the maximum audible resolution. Right?

Post

soundmodel wrote:How many values of MIDI (envelope) do I need for it to be "fine"?

Like what's the resolution of automation envelopes in DAWs?
Do you mean horizontally (automation envelopes per second) or vertically (value range granularity) ?

First the vertical axis: controller messages in MIDI can be single-byte or double-byte values. Since MIDI uses only seven bits, that means you can have 128 or 16.384 different values. It depends on the usage whether 128 is enough or not. Things like volume sliders will be fine with 128 values, but for setting a (cutoff) frequency you might need more resolution.

Now about the horizontal (time) axis: MIDI hardware works on a 32000 baud transmission speed. Since the transport layer uses start & stop bits, there are 10 bits needed to transmit one 8-bit byte. So you can transmit 3200 bytes per second. Since a CC message uses 3 bytes (or 4 for the higher 2-byte resolution) you can send 800 to 1000 CC messages per second before the MIDI bus gets jammed by too much traffic. If you want to allow CC messages to be sent on all 16 channels simultaneously without traffic jam, you can send 50 to 100 CC messages per channel per second.

So it's a given that there are only 50 automation events per second, otherwise it could not be transferred relyably on MIDI hardware. This can result in automation sounding like zipper noise. Plugins can (and should) counter that effect with parameter smoothing, that is interpolating the automation events to smooth out the commands
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

BertKoor wrote:
soundmodel wrote: First the vertical axis: controller messages in MIDI can be single-byte or double-byte values. Since MIDI uses only seven bits, that means you can have 128 or 16.384 different values.
Wait, how do you get 128=2^7 or 16384=2^14?

Post

soundmodel wrote:Wait, how do you get 128=2^7 or 16384=2^14?
Indeed. With seven bits there are 2^7=128 permutations (values 0-127), with 14 bits its 128*128=16384 permutations (values 0-16383)
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

BertKoor wrote:
soundmodel wrote:Wait, how do you get 128=2^7 or 16384=2^14?
Indeed. With seven bits there are 2^7=128 permutations (values 0-127), with 14 bits its 128*128=16384 permutations (values 0-16383)
But how can 7 bits have either 7 bits or 14 bits?

"Since MIDI uses only seven bits, that means you can have 128 or 16.384 different values"

I read this, "seven bits can store 128 or 16384 values (depending on usage)".

Post

It uses either one or two bytes for the payload, with just 7 bits per byte used. So effectively there are 7 or 14 bits.
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

soundmodel wrote: But how can 7 bits have either 7 bits or 14 bits?

"Since MIDI uses only seven bits, that means you can have 128 or 16.384 different values"
Some CCs have separate LSB/MSB numbers, so you send two CC messages that together form the 14-bit number. For NRPN you similarly send two messages, one for LSB and another for MSB. A few things (eg. pitchbend) take 14 bits directly.

Post Reply

Return to “DSP and Plugin Development”