Previous topicNext topic

Overall volume and volume in the frequency ranges

Questions, comments, feedback, etc.
Post Reply
cdrtz
Posts: 6
Joined: Sun May 08, 2016 1:59 am

Overall volume and volume in the frequency ranges

Post by cdrtz »

I have a question about the overall volume and volume in the frequency ranges. In the guide it is stated that the Freq. Range feature "Measures the volume of only certain frequency ranges in the audio. " Also that "Complete silence is measured as 0, and maximum volume is measured as 1." My question is how is the maximum volume determined? How many samples are considered when the maximum is calculated? Or is the volume in a frequency range reported relative the the volume in other frequency ranges? Is the same approach used to calculate the maximum for live audio input and for a pre-recorded audio?

For a pre-recorded audio, for example, when I use the overall Volume parameter I get the volume to be mostly between 0 and 0.5. Doesn't seem to ever reach 1. I tried increasing the gain +5dB, and that seems to take me closer to 1. But my question about gain is: is it multiplicative or additive? Does it act like an offset, pushing all the amplitudes higher, or as scale, multiplying the amplitudes by a factor, preserving the 0 for complete silence?

I also read other forum posts about using a power modifier to reverse engineer the compression, or using a different scaling factor for different frequency ranges to emphasize the volume of certain frequencies. I will have to try that next.

It would be nice if I could output the parameters (e.g., volume, volume in frequency range, etc.) in a log format which I could then super impose with the audio wave form and frequency spectrum. Maybe that would give me more insight about how magic interprets the sound.

Thank you!
Sadler
Posts: 1143
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: Overall volume and volume in the frequency ranges

Post by Sadler »

In this image audio is visualised from a media player at full volume going through VB-Audio Virtual Cable. On the left you can see the audio goes from 0 (in the middle) to 1 (top) and on the right the same music offset by -0.5. I guess, if the audio is normalised to 0-1 you'd expect the peaks to touch the top. When I turn the volume down on the media player the hight of the visualisation decreases proportionally. So, I would hazard a guess that the 0-1 range matches the capability of the device it is connected to and in the case of a media file inside of Magic, the the specs of MP3 volume.
magic_volume.jpg
magic_volume.jpg (45.15 KiB) Viewed 5808 times
Obviously (though perhaps not), volumes of frequency ranges would be proportional to their width (and the volume within that range). I certainly find I have to boost selected frequencies most of the time, perhaps as much as 10 times for certain songs but perhaps that's because I tend to choose the bass and high treble frequencies to react to which might not be as loud.

Magic is a great/fun/flexible/powerful program to work with but in many cases, fine-tuned values really only work for a limited types of music (sometimes only a single track), and I can find myself frantically adjusting values to get a certain feel back. A difficult problem to solve though, I'd wager.
Magic
Site Admin
Posts: 3441
Joined: Wed Apr 09, 2014 9:28 pm

Re: Overall volume and volume in the frequency ranges

Post by Magic »

My question is how is the maximum volume determined? How many samples are considered when the maximum is calculated? Is the same approach used to calculate the maximum for live audio input and for a pre-recorded audio?
Good questions. I'll try to give you a brief explanation, but if you want a more in-depth discussion, it may help you to search for some articles on the basics of digital audio.

Digital audio is the same whether it's from a live input or from a file. It's always stored with two parameters that form a 2-dimensional graph: sample rate and bit depth. Sample rate (such as 44100 Hz) describes time on the x-axis, and bit depth (such as 16-bit) describes amplitude on the y-axis.

The number of possible values for each moment in time ("sample") can be calculated by 2 ^ bit depth. So, for example, 2 ^ 16 = 65536, meaning that each point on the x-axis has 65536 possible values on the y-axis. Samples can be positive or negative, so the maximum possible value is 32768 (65536/2), and the minimum possible value is -32768.

In Magic, and many other audio applications, it is more sensible to work with the range [-1, 1] than [-32768, 32768], so each sample is scaled by 1/32768.

Thus, for any particular sample, the maximum value is 1, and the minimum value is -1.

In Magic, Volume is measured by taking the average sample value at every graphics frame. Let's say your graphics are running at 60fps, and your audio sample rate is 44100 Hz. 44100/60 = 735. So the average sample value is calculated over 735 samples.

Because the average of 1 and -1 is 0, you actually want the average of the absolute value of each sample. This results in a number in the range [0, 1]. And that's how Magic calculates the Volume.
For a pre-recorded audio, for example, when I use the overall Volume parameter I get the volume to be mostly between 0 and 0.5. Doesn't seem to ever reach 1. I tried increasing the gain +5dB, and that seems to take me closer to 1. But my question about gain is: is it multiplicative or additive? Does it act like an offset, pushing all the amplitudes higher, or as scale, multiplying the amplitudes by a factor, preserving the 0 for complete silence?
If the volume of your file is only going to .5, it just means it was recorded quietly. Making audio louder is as simple as multiplying each sample by a scale factor. Multiplying by 2 will make it twice as loud, and multiplying by .5 will make it half as loud. Silence is always preserved.

The relationship between gain and dB is a mathematical formula. dB is logarithmic, and it's used because it's generally easier for people to think logarithmically. A +6dB gain is the same as making the volume twice as loud, and -6dB is the same as making it half as loud.
is the volume in a frequency range reported relative the the volume in other frequency ranges?
When dealing with frequency ranges, the only difference from what I described above is that an EQ is applied to the audio first. So if you are measuring only the lowest frequencies, what's actually happening is that all the high frequencies are being filtered out. Then the Volume is measured.
fine-tuned values really only work for a limited types of music (sometimes only a single track), and I can find myself frantically adjusting values to get a certain feel back. A difficult problem to solve though, I'd wager.
Yes, very difficult :). Every song is completely different, and it almost never works to use the same frequency ranges across different songs.
damstraversaz
Posts: 176
Joined: Tue Aug 26, 2014 11:22 am

Re: Overall volume and volume in the frequency ranges

Post by damstraversaz »

very interesting !
cdrtz
Posts: 6
Joined: Sun May 08, 2016 1:59 am

Re: Overall volume and volume in the frequency ranges

Post by cdrtz »

Very good explanations. Thank you!
Post Reply