This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PWM Audio driver

Hello,

I just wanted to throw in that for a hobby project I created a PWM audio driver, with which one can play back 8-bit audio data very easily. Since it may be useful for others, too, I have uploaded the sources to https://nrf52-pwm-audio.sourceforge.io/, along with SES project files for nRF52832 and nRF52840. Plus, there you will also find a link to a video to see what you can do with the driver.

Cheers,
Tamas

Parents
  • Hi

    I had a hand in testing your library. It works pretty well, however, I noticed something strange in the way my melody is played and I wonder if I'm doing something wrong.

    I created a simple melody in LMMS (I'm using ubuntu), and I export it to a .WAV file. Then, I used audacity to trim it and export it to .raw (headerless) and a signed 8-bit PCM. I made sure to also set in preferences the sample rate to one of the supported frequencies you mentioned.

    After this, I use xxd -i to convert it to a .c file. I also create a .h file based on it to include in my main.c file.

    The melody reproduces faithfully, except for the fact that it's about half the tempo I originally created it for. Could it be something caused by the xxd, some setting in your library I didn't set properly?

    To initialize it I'm using:
        bool const pwm_audio_highdrive = true;
        nrf_pwm_audio_init(buzzer_external_pin, pwm_audio_highdrive);
    where buzzer_external_pin = 3.

    Thanks in advance if there's any suggestion

Reply
  • Hi

    I had a hand in testing your library. It works pretty well, however, I noticed something strange in the way my melody is played and I wonder if I'm doing something wrong.

    I created a simple melody in LMMS (I'm using ubuntu), and I export it to a .WAV file. Then, I used audacity to trim it and export it to .raw (headerless) and a signed 8-bit PCM. I made sure to also set in preferences the sample rate to one of the supported frequencies you mentioned.

    After this, I use xxd -i to convert it to a .c file. I also create a .h file based on it to include in my main.c file.

    The melody reproduces faithfully, except for the fact that it's about half the tempo I originally created it for. Could it be something caused by the xxd, some setting in your library I didn't set properly?

    To initialize it I'm using:
        bool const pwm_audio_highdrive = true;
        nrf_pwm_audio_init(buzzer_external_pin, pwm_audio_highdrive);
    where buzzer_external_pin = 3.

    Thanks in advance if there's any suggestion

Children
Related