Audio To SVG Waveform
Convert an audio file to a compressed (gzip) SVG waveform
This module uses a converted version of antonKalinin/audio-waveform-svg-path that runs in Node instead of in the browser.
Usage
const audioToSvgWaveform = require('audio-to-svg-waveform');
audioToSvgWaveform('./infile.mp3', './output.svg.gz')
.then(() => console.log('complete!'))
.catch(console.error)
Output
The default stroke color is set to #000
but you can override with SVG_STROKE
environment variable. But that can be changed with CSS when the file is included inline.
Babel.js
The current, stable version of node.js supports 95% ES6 features.
Also, we build npm modules to run on older versions of Node.js.
We will use Babel.js with ES2015 preset to compile ES6 code to ES5.
Coding style
Airbnb has an excellent style guide for ES6. We will follow the guide and adhere to the recommended coding style.
ESLint
We will use ESLint with Airbnb style and pre-parse our code to detect violations of the style.
Quick Start
- Make sure you have recent, stable version of node (>= 6.1.0).
nave use stable
node -v
-
Clone or download this repo.
-
Get latest releases of the tools
npm update --save
Commands
Test
npm run test
Lint
npm run lint
Build
npm run build
Run
ES6 code via babel
npm run dev
ES5 code (Transpiled)
npm run build
node lib/
or
npm start
Code Directories
./src - source code, stays in git repo.
./lib - transpiled ES5 code, not saved in git, gets published to npm.