Shop OBEX P1 Docs P2 Docs Learn Events
MISSING: documented circuit setup for propeller audio output — Parallax Forums

MISSING: documented circuit setup for propeller audio output

WBA ConsultingWBA Consulting Posts: 2,934
edited 2013-08-13 10:34 in Propeller 1
In attempting to make a quick point to someone about the basic setup for an audio output circuit for the Propeller to connect it to a small amplifier circuit, I could not find anything in the Propeller Manual, PE Kit PDF, Propeller Datasheet, the Learn.Parallax site, or anywhere else. The only audio circuits I could find were on Parallax Product schematics (demoboard, PropBOE, QS HIB, etc) which of course are all different for various reasons.

Am I simply missing something or is there no clear detail for the basic circuit for audio output from the Propeller posted anywhere?

Comments

  • RaymanRayman Posts: 14,662
    edited 2013-05-16 15:24
    Maybe the easiest way is to just use an RC filter with no amp but go into powered speakers...

    Radio Shack does sell some amp that's been discussed here. I used it a long time ago to drive a speaker...

    Most of my boards use the MAX4410 as audio amp and Parallax uses a similar chip...
    In the Prop Tool you can view the "Demo Board Schematic" to see what they did...
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2013-05-16 15:41
    You are right - we do have various open-source boards that include audio output, and they all vary a bit, but not a document that discusses the particulars of designing such a circuit. Is what you are looking for something along the lines of a Propeller audio stereo output circuit/design consideration appnote?
  • WBA ConsultingWBA Consulting Posts: 2,934
    edited 2013-05-16 16:53
    Steph; Yes, exactly! I can copy other designs and accomplish what Ray suggests, but it would be nice to know what I "should" be doing from the prop for standard audio output or what basic concepts I should be using to define my own to interface with a particular amplifier IC's specifications (in my case it is a Texas Instruments 15 Watt Class-D Amplifier TPA3110D2PWPR).
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2013-05-16 16:59
    Sorry I don't have that up my sleeve for you! But I will forward this as an appnote request.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-05-16 17:07
    This is the circuit (duplicatable for stereo output) which GG and PP have been using in products.

    https://www.dropbox.com/sh/qwhixzvtlrvp1u1/_rcN6Ncv27/Schematics#f:simple_audio_circuit.JPG

    This was adopted from @Ahle2 who seems to be our resident "picky ear" (I mean that in a very nice way! so thickheaded here, that I couldn't tell the difference between one and another)

    Jeff
  • WBA ConsultingWBA Consulting Posts: 2,934
    edited 2013-05-16 17:43
    I will forward this as an appnote request.
    That's a good place for it to be documented. And while on the topic of an AppNote, maybe it should be a "basic interfacing for the Propeller" AppNote and include all standard connections (VGA, microphone, NTSC video, SD, etc).

    VGA connections are another that I have seen different. What's the difference between the 240/470 pair and the 240/560 pair? (The Hydra has the 240/560 and the Demoboard/PropBOE use 240/470)


    EDIT: The Hydra manual has some good background on Audio, VGA, and NTSC. Maybe that can be rolled over for the AppNote?

    Hydra_Fig_9.1_Audio.jpg
    1024 x 354 - 34K
  • TymkrsTymkrs Posts: 539
    edited 2013-05-17 04:21
    Is it really as simple as these circuits?? And question, when using the "PlayWav_8bit.spin" object, I end up specifying two pins:
    PUB PlaySound | n,i,j  'Play a WAV File  Player(@Wav,26,27)
    
    
    
    
    PUB Player(pWav, PinR, PinL):bOK|n,i,nextCnt,rate,dcnt
      'Play the wav data using counter modules
      'although just mono, using both counters to play the same thing on both left and right pins
    
    
      'Set pins to output mode
      DIRA[PinR]~~                              'Set Right Pin to output
      DIRA[PinL]~~                              'Set Left Pin to output
    
    
      'Set up the counters
      CTRA:= %00110 << 26 + 0<<9 + PinR         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
      CTRB:= %00110 << 26 + 0<<9 + PinL         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
    

    In that example, 26 and 27. So if you're only interfacing with one pin in these circuits, do you just set both pins as the same? (so instead of 26,27, set 10 in OBC's example)
  • MacTuxLinMacTuxLin Posts: 821
    edited 2013-05-17 04:38
    Tymkrs wrote: »
    Is it really as simple as these circuits?? And question, when using the "PlayWav_8bit.spin" object, I end up specifying two pins:
    PUB PlaySound | n,i,j  'Play a WAV File  Player(@Wav,26,27)
    
    
    
    
    PUB Player(pWav, PinR, PinL):bOK|n,i,nextCnt,rate,dcnt
      'Play the wav data using counter modules
      'although just mono, using both counters to play the same thing on both left and right pins
    
    
      'Set pins to output mode
      DIRA[PinR]~~                              'Set Right Pin to output
      DIRA[PinL]~~                              'Set Left Pin to output
    
    
      'Set up the counters
      CTRA:= 110 << 26 + 0<<9 + PinR         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
      CTRB:= 110 << 26 + 0<<9 + PinL         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
    

    In that example, 26 and 27. So if you're only interfacing with one pin in these circuits, do you just set both pins as the same? (so instead of 26,27, set 10 in OBC's example)

    Looks like the PlaySound is "stereo" whereas OBC's is mono.
  • TymkrsTymkrs Posts: 539
    edited 2013-05-17 15:08
    Right so could I just write the same pin for the obj code? Or would I need another obj completely?
  • TymkrsTymkrs Posts: 539
    edited 2013-05-17 19:40
    NM, I figured it out. It should work even with the code being used for stereo.
  • AribaAriba Posts: 2,690
    edited 2013-05-17 19:47
    Tymkrs wrote: »
    Right so could I just write the same pin for the obj code? Or would I need another obj completely?

    The comment in the code says it's monophon but sent out on two channels with two DUTY-Counter DACs.
    So you can disable one channel by deleting the lines with PinL, or better make a little modification, so that the object is usable with one or two channels:
    PUB PlaySound | n,i,j  'Play a WAV File  Player(@Wav,26,27)
    
    
    
    
    PUB Player(pWav, PinR, PinL):bOK|n,i,nextCnt,rate,dcnt
      'Play the wav data using counter modules
      'although just mono, using both counters to play the same thing on both left and right pins
      'you can disable the second channel by setting PinL to -1.
    
    
      'Set pins to output mode
      DIRA[PinR]~~                              'Set Right/mono Pin to output
      if PinL => 0
        DIRA[PinL]~~                            'Set Left Pin to output, if not -1
    
    
      'Set up the counters
      CTRA:= %00110 << 26 + 0<<9 + PinR         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
      CTRB:= %00110 << 26 + 0<<9 + PinL         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
    

    Andy
  • AribaAriba Posts: 2,690
    edited 2013-05-17 19:59
    This is the circuit (duplicatable for stereo output) which GG and PP have been using in products.

    https://www.dropbox.com/sh/qwhixzvtlrvp1u1/_rcN6Ncv27/Schematics#f:simple_audio_circuit.JPG

    This was adopted from @Ahle2 who seems to be our resident "picky ear" (I mean that in a very nice way! so thickheaded here, that I couldn't tell the difference between one and another)

    Jeff

    I don't think that Ahle2 will agree wirth the values in that circuit. The circuit itself is okay, but the filter has a cutoff frequency of only 1.45 kHz, which makes the sound muffled. Better values for the R-C filter are for example 330 Ohm and 47nF instead of 1.1k and 100nF.

    Andy
  • MacTuxLinMacTuxLin Posts: 821
    edited 2013-05-18 01:54
    Tymkrs wrote: »
    NM, I figured it out. It should work even with the code being used for stereo.

    Sorry for the late reply due to this half-way around the world effect.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2013-05-18 20:42
    To be different, here is a bridge-tied circuit that I've used to drive a monaural 8Ω speaker. The circuit is differential at both input and output. At the output, the fact that it is bridge tied means that it does not require a capacitor between the speaker and the amplifier. At the input, it driven from the Prop using duty-differential mode. In my setup there was a PCB with 200Ω resistors close to the pins and I tied the 10nF capacitor there to filter down to a about 40kHz. The second stage filter with capacitors to ground filters down to about 10kHz. The 30kΩ resistors set the gain of the TPA6204. (8-pin DFN)

    Another nice thing about differential is that it avoids the pop that comes from a single-ended output suddenly rising to the 1/2 scale bias point. Chips like tjhe MAX4410 include special pop suppression circuitry.
    TPA6204_EME_audio_amp.png
    966 x 409 - 27K
  • TymkrsTymkrs Posts: 539
    edited 2013-05-19 00:12
    MacTuxLin wrote: »
    Sorry for the late reply due to this half-way around the world effect.

    I demand instant gratification! hehe jk :) - turns out it's good to try reading comments on objs! And Ariba, for my particular application it won't matter if it's muffled or not, since what i'm modeling is muffled by tissue! (human heartbeat)
  • WBA ConsultingWBA Consulting Posts: 2,934
    edited 2013-05-21 09:52
    While working on the project that needs the audio circuit, I found that Kye has another version of the audio setup laid out in the KISS WAV player DAC engine SPIN file:

    KISS_WAV_Audio.jpg
    827 x 322 - 79K
  • JonnyMacJonnyMac Posts: 9,107
    edited 2013-05-21 13:48
    I've been doing a little clean-up of my own WAV player object. It's attached for those that want to give it a try.
  • Ahle2Ahle2 Posts: 1,179
    edited 2013-05-23 09:13
    @OBC
    I would definitely not agree. When did I say those values were good?
    As far as I can remember I have been saying that R=1k and C=7.5nF are good values (-3dB cutoff at 21.2 kHz) and gives less distortion than using a lower value on R.

    /Johannes
  • TymkrsTymkrs Posts: 539
    edited 2013-08-12 17:36
    Can I safely assume that the majority of this circuit is required for stereo audio?

    Image1.png


    I was thinking of taking out the opamps/LEDs section, but otherwise keeping the rest the same?
    985 x 479 - 69K
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2013-08-13 10:34
    That will work, provided the op-amp can supply the necessary current and that it has sufficient bandwidth. You can enter the part values from that schematic into the nice calculator provided at okawa-denshi, to see that the corner frequency is near 19kHz. Good. It is a gain=1 circuit, so the op-amp selected should have a bandwidth of at least 2MHz. Many systems get away with a simpler filter, an RC circuit feeding an op-amp buffer. The RC values alhe2 suggested in post #19 just above have a corner frequency of 21kHz (= 1/(2piRC))

    Integrated stereo headphone amplifiers such as the ones found on many Parallax products contain both channels as well as in internal charge pump that generates a negative power supply. E.g. MAX4411. That avoids the necessity for the large output capacitor between the circuit and the headphone, and it reduces the "pop" that you might hear when the single-supply circuit first turns on.
Sign In or Register to comment.