fasterthanlime / jsmad

:saxophone: Javascript MPEG-1 Audio Layer III (mp3) and ID3v2 decoder
http://audiocogs.org/codecs/mp3/
762 stars 41 forks source link

audio plays faster than it should #27

Open vigata opened 13 years ago

vigata commented 13 years ago

On Chrome 15.0.874.120 the player at http://jsmad.org/ plays a regular 44100hz MP3 faster than it should. Pitch is clearly higher.

auroranockert commented 13 years ago

Yes, it is a known problem. Chrome doesn't really support non-standard sampling rates, and we are not currently resampling.

I guess it is actually playing at 48kHz.

It is on the to-do list, I'll close this issue when there is a work-around in the audio library we are using.

nddrylliog commented 13 years ago

@JensNockert there is a work-around in the audio library we are using (ping @jussi-kalliokoski) however we're not willing to fix it because it's a browser support issue which should be fixed on the browser side: http://code.google.com/p/chromium/issues/detail?id=73062

However, this issue doesn't seem to be high-priority for them, I think Chris & co have better things to do right now.

kilokeith commented 13 years ago

Not entirely related, but it would be waaaay cool to control the speed/pitch on playback. That could allow for some nifty audio experiments in browser.

jussi-kalliokoski commented 13 years ago

Wow nice idea! And I'm actually implementing a Resampler class into sink.js, allowing people to attach multiple sources of varying sample rates to the same sink. It would make that possible. :D

kilokeith commented 13 years ago

Wow, that would be killer. If you get it working, I have a badass project I could demo it with.

nddrylliog commented 13 years ago

@kilokeith @jussi-kalliokoski Let me know when you get something running, I'd be happy to feature it on ofmlabs.org if you wanted :)

kilokeith commented 13 years ago

@nddrylliog In that case, I'm soft launching an audio centered Soundcloud + Three.js experiment today: http://www.webuiltthishouse.com/ (sorry for spamming this issue up)

vigata commented 13 years ago

@jussi. does your resampler in sink.js use filtered resampling? Meaning it just doesn't drop/repeat samples to meet the target sampling rate?

jussi-kalliokoski commented 13 years ago

@concalma nope, not yet, it's in baby boots right now, all it has is two interpolation methods (nearest-neighbour and linear) and no extrapolation methods at all, contributions welcome ^^ also, it's not even working quite yet. It's in the branch resampler.

vigata commented 13 years ago

@jussi I'll take a look if I have some time. How about porting some of the code from libsamplerate http://www.mega-nerd.com/SRC/ libsample rate is a very decent audio resampling library with which you can make tradeoffs of quality vs speed.

jussi-kalliokoski commented 13 years ago

@concalma thanks a lot for the reference, looks like a good idea!