Socket
Socket
Sign inDemoInstall

audio-waveform-svg-path

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

6

package.json
{
"name": "audio-waveform-svg-path",
"version": "1.0.0",
"version": "1.0.1",
"description": "Building path for SVG element to perform waveform view of audio file",

@@ -23,5 +23,7 @@ "main": "index.js",

"react-dom": "^15.5.4",
"webpack": "^2.3.3"
"webpack": "^2.3.3",
"webpack-dev-server": "^2.4.5"
},
"scripts": {
"start": "webpack-dev-server --colors --inline --port 3000 --content-base dist/",
"build": "webpack",

@@ -28,0 +30,0 @@ "deploy": "gh-pages -d dist"

@@ -33,4 +33,53 @@ ## Audio Waveform SVG Path

![](https://raw.githubusercontent.com/antonKalinin/audio-waveform-svg-path/master/static/waveform.png)
Constructor assept object with one of keys:
```js
{
url: 'url address of audio file',
buffer: 'audio as AudioBuffer'
}
```
### Methods
- loadFromUrl - loads audio from url, returns Promise
- getPath(preprocessChannels) - returns a path of waveform, accepts callback function as only arument
#### Example of getPath with callback
```js
const diffPath = trackWaveform.getPath(
/*
Use preprocessChannels callback to modify final list of channels.
This callback will be invocked as a argument of reduce method of channels array.
*/
(channels, channel) => {
const prevChannel = channels[0];
const length = channel.length;
const outputChannel = [];
if (prevChannel) {
for (let i = 0; i < length; i++) {
// flip phase of right channel
outputChannel[i] = (channel[i] - prevChannel[i]);
}
channels[0] = outputChannel;
} else {
channels.push(channel);
}
return channels;
},
[]
);
```
## License
[MIT](LICENSE)
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc