Audio mixer

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Wurls80
 
Posts: 2
Joined: Mon Sep 19, 2022 11:17 am

Audio mixer

Post by Wurls80 »

Hi,
Have been using pico w today to play mp3 files with MAX98357A over i2s. Code is in circuitpython.

Works fine if I just use audiomp3 to play. However I wanted to have volume as a variable in the Code, so tried to implement with audio mixer (single voice playing the mp3).

The file is 22050 Hz sample rate and I've exported it (from audacity) as 16 bit PWM.

If I play through the mixer it plays a very repetitive crackle noise over the top. It sounds like a constant frequency. Playing it Just through audiomp3 works fine (no changes with hardware).

What should I be looking at to solve?

User avatar
Wurls80
 
Posts: 2
Joined: Mon Sep 19, 2022 11:17 am

Re: Audio mixer

Post by Wurls80 »

Don't know if this helps anyone, but my findings are:
- works fine with mono mp3s, stereo mp3s are all distorted with the crackling over the top.

How i got there:
Decided to find someone else's published code and files on assumption they work correctly. Found TodBots repo here:
https://github.com/todbot/circuitpython ... ger-tricks

Found mp3 file and realised it was mono.

Converted my files to mono and they then worked. Tried various combinations of settings but it doesn't work properly with stereo files.

Took TodBots audiomixer_demo.py and modified it to work with mp3s, and it worked as it should.

I don't know if it is because I'm using i2s audio out or mp3 files rather than wavs, but the above gives me a workable solution. So sharing in case it helps someone else.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”