Great work! Glancing over the source code (I'm not that well versed in js btw) it looks like you use the browser's resampling (is that called webaudio?) and clamp float values to the desired range (i.e. number of bits per sample). Perhaps there are a few things to improve the audio quality even more:
* Strong low-pass filter before resampling to a lower bit rate (i.e. remove all frequencies that can not be represented in the new bit rate anyway)
* Normalize to 0dB to be sure every bit is used to the max (a signal floating between -0.7 and 0.7 won't use the maximum dynamic range of 8-bits). This could be the final step before resampling.
* Use dither and triangular noise shaping during depth reduction. The latter makes sure the added dither noise is mostly in the higher frequency ranges and not just plain white noise. This might increase the dynamic range to around 56dB instead of 48dB which one would expect from 8-bits (8 bits * 6 = 48dB). At low playback rates, the noise will still be heard too much I guess, but at rates >30kHz I think it should be OK and indeed increase fidelity.
Anyway, very nice project!
Yep, I'm using the WebAudio API. All processing takes place within the browser. No data is transferred to a server. You can actually install the files locally and point your browser the appropriate "file://" URL and get the same behavior.
I'm relying on WebAudio to perform the resampling operation. I haven't found a whole lot of configuration knobs in the API for this operation, so I'm not sure what technique it's using, e.g. Lanczos, sinc, cubic, linear, etc. Probably something fast since it seems to be geared towards real time games in the browser. Another option would be to compile sox or just the filter from C to WebAssembly and use that instead.
I do plan on trying out WebAudio's DynamicsCompressorNode to normalize to the available dynamic range of the target playback method.
I would like to play with noise shaping. Another benefit of compiling sox to WebAssembly would be to take advantage of its noise reshaping features.
are there any plans to have a standalone version? or is .js browser the only possibility?
great tho, nonetheless.
I do plan on using electron to bundle the code as a native app for a few platforms. If anyone has experience with electron, let me know.
I test it on real HW and its great! But is possible to convert to format which is not limited to 1Mb and is compatible with Ultimate Cart ? Now I can use only Atarimax and it is 1MB only
The Ultimate Cart only supports carts up to 1MB because that's how much RAM it has on board. I don't recall if it has a SIDE-like IDE interface to the flash card. If so, then flashjazzcat's PDM Player may work (or could be made to work?) for arbitrarily large files.