Shop OBEX P1 Docs P2 Docs Learn Events
Controlling amplifier volume with propeller — Parallax Forums

Controlling amplifier volume with propeller

smbakersmbaker Posts: 164
edited 2009-02-24 10:42 in Propeller 1
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

Comments

  • virtuPICvirtuPIC Posts: 193
    edited 2009-02-23 19:29
    Well, it depends on your preferences. Solution 1 saves you a Propeller pin and a counter and gives quicker response to volume changes. Solution 2 gives better sound quality and only 32 steps (if I have seen correctly in the TI data sheet), but there is no increased dither at low volume.

    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
  • dMajodMajo Posts: 855
    edited 2009-02-23 20:31
    Solution 3
    - 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
  • virtuPICvirtuPIC Posts: 193
    edited 2009-02-23 21:32
    Uh! you are perfectly right! I didn't mention them because of the additional hardware which is not for free. BUT there are logarithmic digital pots. See e.g. para.maxim-ic.com/en/search.mvp?fam=dig_pot&918=Volatile&807=Log&tree=master. I don't know about the volume control of the amplifier - but digitally need some multiplication with many ones drawing some computing performance. Solution 3 also has lower sound quality, but probably looses not much.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • dMajodMajo Posts: 855
    edited 2009-02-24 10:42
    virtuPIC said...
    Uh! you are perfectly right! I didn't mention them because of the additional hardware which is not for free. BUT there are logarithmic digital pots. See e.g. para.maxim-ic.com/en/search.mvp?fam=dig_pot&918=Volatile&807=Log&tree=master. I don't know about the volume control of the amplifier - but digitally need some multiplication with many ones drawing some computing performance. Solution 3 also has lower sound quality, but probably looses not much.

    Solution 3 have same quality as solution 2 because with the pot you are not managing audio signal, you are just driving vith voltage the amplifier gain control (the pot is used as voltage divider: the two sides gnd/vcc and cursor to the amplifier volume pin)
Sign In or Register to comment.