fbpx
Skip to main content

MIDI Forum

What is the relatio...
 
Notifications
Clear all

What is the relationship between CC#7 value and the volume?

2 Posts
2 Users
0 Reactions
2,276 Views
BioHazard
Posts: 1
New Member
Topic starter
 

What is the relationship between CC#7 value and the volume?
e.g.
If the value of CC#7 is set to be x / 127, what will the volume be? It's not x / 127!

 
Posted : 21/06/2023 2:56 am
Bavi_H
Posts: 266
Reputable Member
 

Here is my understanding...

If you need a sound wave amplitude from 0 to 1, like you would see in an audio editor, use the following formula:

V is the MIDI volume from 0 to 127.
A is a sound wave amplitude from 0 to 1.

A = (V/127)²

If you need a sound level in decibels from −∞ (silence) to 0 (maximum), use the following formula:

V is the MIDI volume from 0 to 127.
L is a sound level in decibels from −∞ to 0.

L = 40 × log₁₀(V/127)

If you want to account for other values that can affect the volume, I believe they combine into the formulas like this:

M is the MIDI Master Volume value from 0 to 16383.
V is the MIDI volume from 0 to 127.
E is the MIDI expression value from 0 to 127.
Y is the Note On velocity from 1 to 127.
A is a sound wave amplitude from 0 to 1.

A = ( (M/16383) × (V/127) × (E/127) × (Y/127) )²

M is the MIDI Master Volume value from 0 to 16383.
V is the MIDI volume from 0 to 127.
E is the MIDI expression value from 0 to 127.
Y is the Note On velocity from 1 to 127.
L is a sound level in decibels from −∞ to 0.

L = 40 × log₁₀( (M/16383) × (V/127) × (E/127) × (Y/127) )
or
L = (40 × log₁₀(M/16383)) + (40 × log₁₀(V/127)) + (40 × log₁₀(E/127)) + (40 × log₁₀(Y/127))

You can see a formula for volume in terms of a sound level in decibels from −∞ to 0 in the following specifications:
• the General MIDI System Level 1 Developer Guidelines, middle of printed page 9 to page 10 (PDF pages 13 and 14).
• the General MIDI Level 2 Specification, bottom of printed page 6 and top of page 7 (PDF pages 10 and 11).

The formula in terms of a sound wave amplitude from 0 to 1 can be mathematically derived from that formula, see Re: Why is MIDI gain based on a factor of 40? (Music Practice & Theory Stack Exchange).

You can see a formula for volume and expression in terms of a sound level in decibels from −∞ to 0 in the following specifications:
• the General MIDI System Level 1 Developer Guidelines, bottom of printed page 9 (PDF page 13).
• the General MIDI Level 2 Specification, printed page 8 (PDF page 12).

I believe that other values that affect the volume (MIDI Master Volume and Note On velocity) use the same kind of method to contribute to the overall value as shown in my formulas above, see Re: Help understanding Midi volume commands (midi.org Forum).

 
Posted : 21/06/2023 7:00 am
Share: