New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

flipnote.js

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flipnote.js - npm Package Compare versions

Comparing version 1.2.3 to 1.3.0

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc