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

SoundEffect with frequencies above 10 KHz don't make a sound #120

Closed
microbit-carlos opened this issue Sep 6, 2022 · 4 comments
Closed
Milestone

Comments

@microbit-carlos
Copy link
Contributor

microbit-carlos commented Sep 6, 2022

I'm guessing the frequency string format only takes 4 digits?

This works:

audio.play(audio.SoundEffect(
    freq_start=9999,
    freq_end=9999,
    duration=300,
    vol_start=255,
    vol_end=255,
))

But this doesn't make a sound:

audio.play(audio.SoundEffect(
    freq_start=10000,
    freq_end=10000,
    duration=300,
    vol_start=255,
    vol_end=255,
))

I think 10000 is likely converted to 0. As a SoundEfect like this sounds like it's going from high frequency to low frequency.

audio.play(audio.SoundEffect(
    freq_start=9999,
    freq_end=10000,
    duration=500,
    vol_start=255,
    vol_end=255,
))

Should we throw an exception or clamp for values >10K?

@microbit-carlos
Copy link
Contributor Author

I haven't tried but I guess the same would be true for volume and duration.

@dpgeorge
Copy link
Collaborator

dpgeorge commented Sep 7, 2022

I'm guessing the frequency string format only takes 4 digits?

Yes that's correct. Most of the numbers (volume, frequency, duration) are limited to 4 digits.

Should we throw an exception or clamp for values >10K?

Implementing either of those is easy. Probably best to raise an exception.

@microbit-carlos microbit-carlos added this to the 2.1.0 milestone Sep 15, 2022
@microbit-carlos
Copy link
Contributor Author

Probably best to raise an exception.

Sounds good 👍

dpgeorge added a commit that referenced this issue Sep 21, 2022
Fixes issue #120.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge
Copy link
Collaborator

Fixed by 0b75526

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants