Shop OBEX P1 Docs P2 Docs Learn Events
Playing wav files - but without a MAX4411ETP chip - can it be done? — Parallax Forums

Playing wav files - but without a MAX4411ETP chip - can it be done?

pacmanpacman Posts: 327
edited 2010-02-15 14:21 in Propeller 1
I notice on the schematic for the demo board that P10 and P11 go through a MAX4411ETP before being able to be 'heard' via headphones (I don't have a demo board so I'm taking a bit of a punt on this).

How can I test that wave files are playing (by hearing them) if I don't have this chip? Can I just connect a headphone and listen _real_ hard? Would that damage my prop chip?

Am I completely misunderstanding audio? {Probably. As I'm even more of a noob on audio....}


Thanks in advance..

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
=================
The future is in our hands.
Which way to the future?
=================

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-15 06:31
    Paul, the audio is filtered by an RC filter which by it's very nature needs buffering to drive any kind of load. But you can feed this unbuffered audio into amplified PC speakers or alternatively add a simple voltage follower opamp such as the LM358 (running from at least +5V volts) or similar.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • pacmanpacman Posts: 327
    edited 2010-02-15 07:56
    Thanks Peter.

    So the speaker output on the demo board isn't really suitable for directly plugging headphone into?

    Means I have to find some amped speakers (none of the audio components we have now have inputs for anything other than ipods). Knew there was reason to be sad when the 'proper' amp died.

    So what's the cheapest way to bolt a 'speaker' onto a prop? (for testing) does GG have a module? Got a tried and true circuit using cheap bits?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    =================
    The future is in our hands.
    Which way to the future?
    =================
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-15 08:07
    The demo board has an amp chip which runs headphones or speakers but you were asking about how to do it without an amp chip.

    The dollar stores usually have cheap powered speakers, there's even the tiny ones that run off two pen-cells.
    Of course you can always make one but you need parts and I'm not sure what you limitations are in getting parts. Even DSE will have some kind of ancient LM386 chip.
    www.dse.com.au/cgi-bin/dse.storefront/4b7900cc013d0642273fc0a87e0105da/Product/View/Z6086
    BTL chips such as the venerable TDA7052 etc are far superior and easier to use though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • pacmanpacman Posts: 327
    edited 2010-02-15 08:31
    Think I've got it now.

    No amp chip = external amp.


    With the demo board how do you do volume control? Can the prop do it natively? (this chip just gets better and better)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    =================
    The future is in our hands.
    Which way to the future?
    =================
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-15 09:13
    Simple volume control can be effected by arithmetically shifting left or right essentially which is what I do in my wav players. For finer control you really need fast multiply/divide so it's not an option with the Prop. There are also audio processor chips (analog or dsp) that can do this easily.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Ahle2Ahle2 Posts: 1,179
    edited 2010-02-15 11:25
    My propeller based C64 SID emulator( SIDcog ) is a proof that it's possible to do linear volume controlling at full CD quality without ANY problems.
    (Even though SIDcog has got a sample rate of just ~31Khz and has got mono output. (CD quality is 44.1Khz in stereo) )

    A wav player is very simple in comparison to SIDcog, leaving A LOT of extra cycles for multiplication/division subroutines.
    SIDcog uses 187.200 32bit multiplications per second for "analog multimode resonance filter", volume controlling and envelope calculations.
    A wav player needs just 2*44.100 = 88.200 multiplications per second for volume calculations at CD quality.

    The "inner loop" of a wav player could be done with just a couple of PASM instruction.
    Every sample loop of SIDcog needs >350 pasm instructions plus additional pasm instructions in the multiplication subroutine.

    Conclusion:
    The Parallax Propeller could EASILY do a wav player with linear volume controlling at full CD quality using a single cog.
    The cog would spend most of it's time waiting actually.

    /Johannes Ahlebrand
  • KyeKye Posts: 2,200
    edited 2010-02-15 13:00
    So, I wrote the perfect object to do all this stuff for you very easily.

    Go to the obex. Click on the sound stuff link. Find the stereo DAC object. Download it. Read the documentation and realize the awsomeness.

    If you can't realize the awsomeness then the object may not be for you. However, the stero DAC object makes playing WAV files soooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo... EASY!

    (Hint, the transfer data function in the object should be used with FSRW's getData block function that grabs 512 bytes at a time.)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-15 14:00
    Johannes, yes, you are perfectly right that there is time to do arithmetic. I don't know what I was thinking. I normally run at 44.1kHz myself and I think my cog may have been doing double duty which ruled out muldiv at the time but that is not normally the case though (I need more cogs!).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Ahle2Ahle2 Posts: 1,179
    edited 2010-02-15 14:21
    @Peter Jakacki
    I forgive you [noparse];)[/noparse]

    Btw, most of the time I do a simple SHR/SHL for multiplication/division, but it's not always a sufficiant method.
    The Prop2 will not only be 8 times faster compared to the Prop, it will also have DIV/MUL instructions wich in reality will make it even faster for many tasks.
Sign In or Register to comment.