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

WAV playback is crippled, MP3 playback works #30

Open
Tinkerer- opened this issue Aug 2, 2022 · 0 comments
Open

WAV playback is crippled, MP3 playback works #30

Tinkerer- opened this issue Aug 2, 2022 · 0 comments

Comments

@Tinkerer-
Copy link

Tinkerer- commented Aug 2, 2022

Hi there!
For the "BouncyBall" game I wanted to add some sound effects. I found some nice WAV files that I wanted to use, which sounded fine on my PC. On the badge they sounded crap. I then tried to convert these with sox ( sox input.wav output.mp3 ), and these files sound fine.

To reproduce, use the attached sounderror app (python file with MP3 and WAV), and use the joystick to play either the MP3 or WAV version of the sound.

Zip with code and audio files

sounderror.zip

Code

import mch22
import buttons
#import display
import audio

left_pressed = False
right_pressed = False

def left(p):
    print("left!")
    if p:
        global left_pressed
        left_pressed = True

def right(p):
    if p:
        global right_pressed
        right_pressed = True

            
def main():
    global left_pressed
    global right_pressed
    while True:
        if left_pressed:             
            audio.play('/apps/python/sounderror/sfx_footsteps.mp3', volume=20);
            left_pressed = False

        if right_pressed:
            audio.play('/apps/python/sounderror/sfx_footsteps.wav', volume=20);
            right_pressed = False

buttons.attach(buttons.BTN_LEFT, left)
buttons.attach(buttons.BTN_RIGHT, right)
main()
@renzenicolai renzenicolai moved this to 🆕 New in BadgePython Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant