Digital Control over Audio Stream Volume

Discussion around product based on ARM Cortex M3 core.
This forum will be discontinued soon.

Moderators: nferre, ncollot

yun
Posts: 11
Joined: Mon Apr 13, 2015 9:10 pm

Digital Control over Audio Stream Volume

Wed Mar 08, 2017 11:03 pm

Hi everyone! Hopefully this doesn't fall on empty ears, but here goes!

I'm using the SAM3U for USB audio and I'm planning to use a codec without a control interface. If I wanted to have "internal" controls for automating output gain, how would I do this? Lets say the output from a computer/master is always going to outputting it's max signal (-1 to 1). How would I lower the volume/gain of the USB stream before it hits the DAC? I know in the software world this is pretty easy; you divide the signal by a number to lower the gain.

Now the question is... how do I do this in the microcontroller world? I'm packing my 24 bit USB stream into a 32 bit variable to transfer to the codec right now. Would I be doing the same thing as I do in software; do I just divide this 32 bit variable by my gain variable to lower it?

Thanks!
blue_z
Location: USA
Posts: 1547
Joined: Thu Apr 19, 2007 10:15 pm

Re: Digital Control over Audio Stream Volume

Thu Mar 09, 2017 3:24 am

yun wrote:How would I lower the volume/gain of the USB stream before it hits the DAC?
Are you aware that straightforward division is a really bad idea, e.g. you're going to lose resolution and increase quantization (noise)?

http://www.esstech.com/files/3014/4095/ ... ontrol.pdf

Regards
yun
Posts: 11
Joined: Mon Apr 13, 2015 9:10 pm

Re: Digital Control over Audio Stream Volume

Thu Mar 09, 2017 5:37 pm

blue_z wrote:Are you aware that straightforward division is a really bad idea, e.g. you're going to lose resolution and increase quantization (noise)?

http://www.esstech.com/files/3014/4095/ ... ontrol.pdf

Regards
Hi blue_z,

Thanks for the link/advice. I would use a codec with a control interface but unfortunately I will be using the 2 TWI for a different function and thus cannot use a codec with a control interface/finding a way to do digital control.

The link was very helpful. Fortunately, I'm using a 32 bit DAC and hopefully I can work around this issue.

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: No registered users and 1 guest