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

Android: Noise During Sound Playback and Persistent Sound After Page Navigation #588

Open
shiromofufactory opened this issue Dec 25, 2024 · 3 comments

Comments

@shiromofufactory
Copy link

When playing sound on Android devices, the following two issues occur:

  1. Noise During Sound Playback:
    It seems that the sound playback process cannot keep up, resulting in frequent noise. This issue does not occur with relatively simple songs, such as Sample 04 or 10, but it happens with more complex tracks like Sample 14. (Sample 14 includes channel extensions and waveform editing, but the issue can also occur with dense tracks even within standard specifications.)

  2. Persistent Sound After Page Navigation:
    The sound continues to play even after navigating away from the Pyxel page. This issue does not seem to occur on iPhone.
    I also tried detecting page inactivity in JavaScript using the visibilitychange event and stopping the sound from Python code. However, this did not work, possibly because the page navigates away before Pyxel can fully stop the sound.

I believe Issue 1 could become a significant problem in developing high-quality applications with Pyxel in the future. Could you please consider addressing these issues?

@kitao
Copy link
Owner

kitao commented Dec 29, 2024

Regarding the first issue, this is fundamentally similar to the problem of handling frame drops when displaying many sprites. The root cause is the high load required to run a software synthesizer in a browser environment. This occurs because the sound chip simulator's clock must be emulated regardless of whether the audio output is 44.1kHz or 22kHz.

However, the clock frequency was experimentally set to a higher value. In the next version, I plan to lower it to match the SNES's equivalent clock speed. I believe this adjustment should reduce the load.

As for the second issue, I currently don't have an Android testing environment, and setting one up would require additional investment, so it's difficult to provide any concrete answers at the moment.

@kitao
Copy link
Owner

kitao commented Dec 29, 2024

Please check 2.2.10.

@shiromofufactory
Copy link
Author

Thanks, it seems to have improved slightly regarding issue 1.
However, when I create a song that processes a lot of sounds in a short period of time (when I create a song with SPEED=1~3), noise still occurs.
The degree of noise seems to vary depending on the model, so I guess the only way is to deal with it on the application side.

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