Skip to content

WAV playback is crippled, MP3 playback works #30

@Tinkerer-

Description

@Tinkerer-

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions