Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distorted mp3 playback on MAX98357A #10175

Closed
bbtinkerer opened this issue Mar 24, 2025 · 6 comments · Fixed by #10185
Closed

Distorted mp3 playback on MAX98357A #10175

bbtinkerer opened this issue Mar 24, 2025 · 6 comments · Fixed by #10185
Assignees
Labels
audio bug rp2 Both RP2 microcontrollers
Milestone

Comments

@bbtinkerer
Copy link

CircuitPython version and board name

Adafruit CircuitPython 9.2.6 on 2025-03-23; Raspberry Pi Pico 2 with rp2350a
Board ID:raspberry_pi_pico2

same issue when using Pi Pico rp2040

Code/REPL

# sample code and mp3 from https://learn.adafruit.com/mp3-playback-rp2040/pico-i2s-mp3
#
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT

"""
CircuitPython I2S MP3 playback example.
Plays a single MP3 once.
"""
import board
import audiomp3
import audiobusio

audio = audiobusio.I2SOut(board.GP0, board.GP1, board.GP2)

mp3 = audiomp3.MP3Decoder(open("slow.mp3", "rb"))

audio.play(mp3)
while audio.playing:
    pass

print("Done playing!")

Behavior

Audio playback of mp3s are distorted when playing back using a MAX98357A.

Description

Distorted playback also with CircuitPython 9.2.5 on both Pi Pico with rp2040 and Pi Pico 2 rp2350

Additional information

Tried using audiomixer to lower volume since audio sounded like a high gain was applied to it, but that only lowered the volume, the audio was still distorted.

MP3s play fine when using CircuitPython 9.2.4 and earlier.

@bbtinkerer bbtinkerer added the bug label Mar 24, 2025
@bablokb
Copy link

bablokb commented Mar 24, 2025

I can confirm this behavior using a PCM5102 and a Pico2-W. So this is not related to the specific I2S-amp chip MAX98357A.

@bablokb
Copy link

bablokb commented Mar 24, 2025

It is not related to the Pico, I have the same issue with an ESP32-S3

@dhalbert dhalbert added audio rp2 Both RP2 microcontrollers labels Mar 25, 2025
@dhalbert dhalbert added this to the 9.x.x milestone Mar 25, 2025
@jepler
Copy link
Member

jepler commented Mar 26, 2025

I reproduced the same/similar issue on pygamer. Through git bisect, I narrowed it down to e15eba0 (#10036).

I'll investigate further & hopefully make a fix.

@jepler jepler self-assigned this Mar 26, 2025
@bablokb
Copy link

bablokb commented Mar 27, 2025

PR #10185 fixes it for me. Tested with a Pico2-W and PCM5102.

Thanks!

@jepler
Copy link
Member

jepler commented Mar 27, 2025

thanks for testing @bablokb !

@dhalbert
Copy link
Collaborator

Fixed by #10185.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audio bug rp2 Both RP2 microcontrollers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants