Volume/Loudness/Amplitude - which to use

Status
Not open for further replies.

Davidelvig

Well-known member
My setup uses a Mic (I2S input) Mixer and earphone jack (I2S output).
I also use a Sine wave Synth as an alternative input with another Mixer.
A setup
Audio Lib Loudness.png
(my SGTL5000 is labeled here as Teensy Codec)
https://www.pjrc.com/teensy/gui

I have choices of using many methods to adjust loudness:
  • TeensyCodec.micGain(0-63)
  • TeensyCodec.volume(0.0-1.0) (guidance in the documentation to leave this below 0.8, and likely in the 0.5 range)
  • Mixer.gain(0-32767)
  • Sine1.amplitude(0.0-0.1)

There are more choices Line-In and Line-Out and for DAC that don't concern me for now.

My aims are to:
- provide subtle moment-to-moment volume control for my wind instrument
- provide a grosser level volume knob.

Is there guidance on how to use each of these variables when used together?
Practical maximums? Agregate maximums (in the case of Mixers)?

Thanks!
 
Generally speaking, you'd want to set the mic gain so the loudest possible sounds end up "close" to 1.0 level within the library (which is really 32767 from the internal integers). Sound levels can be difficult to predict, so often the gain needs to be turned down somewhat. Once you hit the digital 1.0 maximum, you get hard clipping which corrupts your signal with harmonic distortion. See parts 2-2 and 2-3 in the audio tutorial about clipping signals.

Usually processing within the library is done with the goal of always keeping things below 1.0 (max) level, but ideally using as much of the 0 to 1.0 range as possible without hitting the max.

Usually the output volume is adjusted for listening comfort.
 
Thanks, Paul.
I want to make sure I get it right.

At https://www.pjrc.com/teensy/gui/?info=AudioControlSGTL5000 the documentation says set SGTL500.micGain between 0 and 63 (and refers to dB units).

The Mixer.gain at https://www.pjrc.com/teensy/gui/?info=AudioMixer4 talked about 0-32767 range (0-1 attenuates; 1-32767 amplifies)

So:
  1. Set SGTL5000.micGain based on experimentation in my setup to get maximum played input to drive to a level of 1.0. I'll do that by connecting an I2S input directly to a USB output - subsequently into Audacity on the PC. I'll then increase the micGain until I get clipping with a reasonably-loud note.
  2. Set the Sine.amplitude to 1.0.
  3. Adjust internal sound levels (played loudness, vibrato) using various Mixer.gain levels, keeping the internal hand-offs between audio objects to less than 1.0

I'm surprised at the range of Mixer.gain being up to 32767, though I suppose it could be starting with a very small input (e.g. 1/32767), where a very high gain just brings it back up to near 1.0.

What's the best way to test levels internal to my audio network?
The USB/Audacity method I have above has worked for me, but seems a bit rough.

Dave

Edit... some testing right after sending this post:
Testing SGTL5000.micGain.
I needed to go way down to SGTL5000.micGain(2.3) to get a wave for that did not clip. I've realized I have the electret mic very close to the noise end of a trumpet mouthpiece.
With that micGain, I get this waveform in Audacity:
Audcity Shot 1.jpg
With higher micGain (over 3), I get flattening (clipping?) at the top of the waveform.
The lower wave form is a sine wave played to match the frequency of the buzzed pitch.

So, might 2.3 make sense for SGTL5000.micGain in this scenario?
If so, it looks like I have a lot of headroom to play with.
 
Last edited:
Status
Not open for further replies.
Back
Top