mmontag / chip-player-js

Web-based music player for a variety of video game and chiptune music formats.
https://chiptune.app
GNU General Public License v3.0
324 stars 17 forks source link

Glitchy audio on Windows/Chrome #118

Open mmontag opened 1 year ago

mmontag commented 1 year ago

Getting a couple reports of audio pop/glitches on Windows+Chrome. +1 the issue if you have experienced this.

polygonnedpotato commented 1 year ago

this also happens to me but im on chrome os so i should have expected it

applecuckoo commented 1 year ago

@mmontag getting skippy/jumpy sound when changing songs, playlist used is /Nintendo 64/Super Mario 64 (1996)(Nintendo EAD)(Nintendo). Using Chrome 106. Explained further below https://github.com/mmontag/chip-player-js/issues/118#issuecomment-1275214375

mmontag commented 1 year ago

@applecuckoo This is a performance problem of emulating the N64.

The N64 miniusf/usflib support has bothered me ever since I added it, because it goes against the spirit of Chip Player. It is not sequenced music with an emulated audio chip, but instead a black box emulation of the N64 that just happens to write some audio output. The music sequence is not exposed, tempo and voice settings are fixed, and fast seeking is impossible.

This is why I've started working on MIDI+SF2 support (check the Soundfont MIDI folder at top level).

Titanic4 commented 1 year ago

I think the issue is related to default audio buffer size given by Google Chrome, or any Chrome based browser, such as Microsoft Edge. I've added --audio-buffer-size=512 as the launch parameter for Google Chrome and the audio is butter smooth when playing N64 music files with Chip Player. Adjusting the audio buffer on the Chip Player itself could possibly fix the audio issues for users, who use default audio buffer size.

Titanic4 commented 1 year ago

I've just noticed that the playback quality greatly depends on the sampling rate of the user's sound card. After setting it to 16 kHz I've got somewhat smooth audio without using any command line parameters, which would override Chrome's audio buffer size. To achieve that I had to use Voicemeeter, since its audio output allows me to set the sampling rate to quite wide range of selections. There was similar issue regarding the playback speed, which was also dependant on the sampling rate.