Controlling amplifier volume with propeller
smbaker
Posts: 164
I have some TPA6021A4 amplifiers (http://focus.ti.com/lit/ds/symlink/tpa6021a4.pdf) that I'm planning on using to amplifier propeller audio to some small speakers. I'm playing 16-bit audio from wav files out of an sd card. There's two obvious ways that came to mind to do control the volume:
1) I can modify the wav player code to apply volume control prior to outputting the signal to the amplifier (i.e. divide the current 16-bit sample by some volume divisor prior to pulsing it out the output pin)
2) This particular amplifier has a volume control input that takes a voltage, approximately 0.5-3.5 V, that adjusts the amplifier volume in 32 steps. I could use the prop to generate D/A to this pin, and set the volume that way.
Anyone have a recommendation on which way would be better? My personal preference is #1 as it does not require any additional pin usage on the prop. For #2 I was considering generating D/A to the volume pin by using a Duty-mode counter, resistor, and capacitor (the software D/A technique outlined in the PE-Kit counters lab). Would this introduce artifacts into the amplification?
Thanks,
Scott
1) I can modify the wav player code to apply volume control prior to outputting the signal to the amplifier (i.e. divide the current 16-bit sample by some volume divisor prior to pulsing it out the output pin)
2) This particular amplifier has a volume control input that takes a voltage, approximately 0.5-3.5 V, that adjusts the amplifier volume in 32 steps. I could use the prop to generate D/A to this pin, and set the volume that way.
Anyone have a recommendation on which way would be better? My personal preference is #1 as it does not require any additional pin usage on the prop. For #2 I was considering generating D/A to the volume pin by using a Duty-mode counter, resistor, and capacitor (the software D/A technique outlined in the PE-Kit counters lab). Would this introduce artifacts into the amplification?
Thanks,
Scott
Comments
So. What does that mean? I would use solution 1 for low or medium quality. For HiFi sound I would use solution 2. Also depends on the speakers...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys
- use a digital pot (maxim have a lot of them) connected on I2C (with the eeprom). You save the pin and have the good sound
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4529
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2480
... and many others
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys