Shop OBEX P1 Docs P2 Docs Learn Events
Quality audio generation — Parallax Forums

Quality audio generation

richaj45richaj45 Posts: 179
edited 2014-04-30 10:33 in Propeller 1
Hello:

What is the best audio output that has been generated with PWM and filtering.
That is approximately how many bits of accuracy can be obtained by using a PWM generator in a COG with an external filter.
The project uses a standard stereo audio input ADC but i was hoping i could get away with a PWM and filter for the output.
I would like 16-bits of precision at 10 kHz of bandwidth.

I did search the site but did not get much coherent information.

Thanks for any help.
rich

Comments

  • K2K2 Posts: 693
    edited 2014-04-24 22:07
    Post #8 on this thread is a very curious listing of some code pik33 threw together in 20 minutes that uses the video generator and dithering to improve performance. Whether there is something to it or not, I couldn't say. Perhaps if you need 16-bits of precision, you have means of measuring to that precision. If you do, you could enlighten us on this point.

    http://forums.parallax.com/showthread.php/140927-Propeller-Signal-Generator?highlight=Sinewave_v2.1.spin
  • Ahle2Ahle2 Posts: 1,179
    edited 2014-04-25 02:42
    In simplified theory these formulas gives the bitdepth for a given bandwidth/sample rate when using duty dac:

    bandwidth:
    bitDepth = log2( clkFreq / (bandwidth * 2) )

    sample rate:
    bitDepth = log2( clkFreq / sampleRate )

    For an example, this gives a bit depth of 10.8 for an 44100 Hz CD quality audio signal.
    Or in other words, ~64 times less resolution compared to 16 bits.
    Even so, a "CD track" played back from the Propeller this way sounds surprisingly good. Not Hifi in any way, but good enough for many projects.

    Btw, by using pik33´s technique you would gain a little bit more than 1 bit of resolution.

    /Johannes
  • richaj45richaj45 Posts: 179
    edited 2014-04-30 10:33
    Thanks MarkT that is the ticket.

    Thanks much all.
    This forum is surely the best feature of the Prop.

    cheers,
    rich
Sign In or Register to comment.