flipnote.js
Advanced tools
Comparing version 1.2.3 to 1.3.0
{ | ||
"name": "flipnote.js", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"description": "API for handling Flipnote Studio's .ppm animation format, capable of real-time playback using webGL", | ||
@@ -5,0 +5,0 @@ "main": "dist/flipnote.js", |
@@ -11,5 +11,5 @@ # flipnote.js | ||
* Full browser-based Flipnote (PPM) playback, with perfect accuracy for both frames, audio, and metadata parsing | ||
* Full browser-based Flipnote (PPM) playback, with perfect accuracy for both frames and audio | ||
* Metadata parsing | ||
* Player API based on the HTML5 Video and Audio APIs | ||
* Flipnotes can be loaded from URLs or file uploads | ||
* ~6KB minified + gzipped | ||
@@ -56,4 +56,8 @@ | ||
Audio was a little tricky. In my Python PPM decoder I was just able to rely on the [audioop module](https://docs.python.org/3.6/library/audioop.html#audioop.adpcm2lin) to decode ADPCM, but JavaScript doesn't have any out-of-the-box way to process ADPCM like that. The [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) API does support PCM audio though, so providing full support for Flipnote audio was just a matter of semi-porting an ADPCM to PCM converter from C to JavaScript. You can see the final audio decoder [here](https://github.com/jaames/flipnote.js/blob/master/src/decoder/adpcm.js). | ||
Audio was a little tricky. In my Python PPM decoder I was just able to rely on the [audioop module](https://docs.python.org/3.6/library/audioop.html#audioop.adpcm2lin) to decode ADPCM, but JavaScript doesn't have any out-of-the-box way to process ADPCM like that. The [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) API does support PCM audio, however it's a rather young and finicky API where implementations still differ quite a bit. That's no biggie though, the HTML5 [`<audio>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio) element also supports PCM via the [WAV](https://en.wikipedia.org/wiki/WAV) format! In the end the audio decoding and playing process looks like this: | ||
* Convert 4-bit ADPCM samples to 16-bit PCM samples. For this I [semi-ported an ACPCM to PCM converter from C to JavaScript](https://github.com/jaames/flipnote.js/blob/master/src/decoder/adpcm.js). | ||
* Prepend the raw PCM data with a [WAV header](https://github.com/jaames/flipnote.js/blob/master/src/player/audio.js#L21) to produce a valid .wav audio file. | ||
* Create an `<audio>` element using the .wav file [blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) as its source. | ||
### Authors | ||
@@ -60,0 +64,0 @@ |
Sorry, the diff of this file is too big to display
80748
1586
79