1

I'm using a Raspberry Pi 4 with an Adafruit I2S Stereo speaker bonnet. I've run their setup script and rebooted many times.

I can play sample mp3 files just fine. They usually sound great. (I've had some distortions in some cases, but not always).

I can also use espeak without any noticeable problems.

I've also downloaded some sample wav files that seem to work file.

The problem arises with some wav files that I created in Garage Band. When I try to play these, I get some normal audio, but then also a lot of scratchy audio to go with it. Changing the volume with alsamixer changes the distortions but does not monotonically scale the output volume as expected indicating some other type of conflict. Playing the possibly bad files on Windows or MacOS works fine.

Sample wav files at various bitrates (including the bitrate of the problematic files) work fine.

I've tried reducing the amplitude of the problematic wave files with sox -v 0.1 but that maintains the distortion.

Any thoughts on what to try would be greatly appreciated.


Update:

Some of my problems were caused by pigpio using the PCM timer for GPIO operations. Switching to use PWM timer fixed that problem.

I still have problems playing the files but now the scratchiness is showing up on the files on Windows. I'm wondering if some aggressive CR/LF conversion tried to happen which broke the binary wav file.

1

I'm not a 100% sure but think some kind of compression would help. You could use a software like Audacity where you would just import the file and export it as an mp3 with a bitrate of around 192kbps. You could also use an online converter like this: https://convertio.co/wav-mp3/. If it still sounds scratchy you should probably lower the bitrate and try again.

| improve this answer | |
  • Thanks for the thought. I've tried such conversions to no avail :-/ – Cameron Tacklind Aug 6 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.