deskjet / chiptune.js

A port of the module player libary libxmp to javascript using emscripten.
http://deskjet.github.io/chiptune.js/
37 stars 4 forks source link

Chirping and unsteady sound #1

Closed tomas closed 9 years ago

tomas commented 9 years ago

Hi, and congrats for your work! Chiptune looks slick!

I'm trying to play a few .mods/s3m/it files on your demo player but I'm having some trouble, though.

First, I hear a constant chirping or crackling sound every 1 sec or less, that seems to be occur whenever the play() function is called (e.g. wave data being read from XMP or set into the output channels).

Secondly, whenever the tab loses focus, I start hearing constant pauses, as if the browser lowered the tab's CPU priority resulting in the JS loop being unable to process the module data on time.

I'm not sure if this would require any patching to the original XMP c code, but I'd be happy to help you out with testing if you need anything.

Thanks

danvim commented 9 years ago

I know about the "tab loses focus" thing, if you search on Google: infinite jukebox(a fantastic app that loops your music infinitely seamlessly) you will see it does not allow playing when your tab loses focus.

Seeing the example, the fix is probably not up to the author. You should pause the music when the tab loses focus. I think it's a safety measure by the browser to not let your computer explode and prioritize your current tab.

Hope it helps :)

tomas commented 9 years ago

Thanks for the answer. I actually found your chiptune2 implementation that works far better and the chirping totally disappears, being the tab active or not. So we're good!

tomas commented 9 years ago

That's odd, I thought you had commented on this thread but the message disappeared. Was it just me? :)

danvim commented 9 years ago

@tomas Never mind me, I've made a very stupid speech about how I didn't know how to find chiptune2.js :D

For those who sees this, here's his newer version: https://github.com/deskjet/chiptune2.js The author says that this one would not be updated any day soon(probably)

tomas commented 9 years ago

This is crazy. For one second I JUST saw your comment again. Looks like there's trouble going on at GIthub's devops. Now I'm getting "Cannot save your comment" messages.

Anyway, the chiptune2 I was referring to is this. Isn't it yours?

tomas commented 9 years ago

Oh I just realized you're not the owner of the repo! That explains it all, haha.

danvim commented 9 years ago

@tomas That's solved my confusion too. I thought someone else has spoken

deskjet commented 9 years ago

@tomas The original chiptune.js audio scheduling is not good. It relies on setTimeout, which is not meant to be used like that. I highly recommend chiptune2.js, which has improved scheduling.

I'll update this projects Readme to avoid further confusion :-).