fluent-audiowaveform
v1.0.8
Published
Fluent Audiowaveform is a Node.js wrapper around [audiowaveform](https://github.com/bbc/audiowaveform).
Downloads
55
Readme
Fluent Audiowaveform
Fluent Audiowaveform is a Node.js wrapper around audiowaveform.
Installation
yarn add fluent-audiowaveform
Usage
Install audiowaveform before using fluent-audiowaveform.
ES6 Import
import audiowaveform from 'fluent-audiowaveform';
Methods
input(stream: Readable)
// Pass the stream containing input file
audiowaveform().input(stream)
toPng(options: {
width?: number;
height?: number;
colors?: "audacity" | "audition";
borderColor?: string;
backgroundColor?: string;
waveformColor?: string;
axisLabelColor?: string;
})
// Return a png image
audiowaveform().input(stream).toPng({
width: 1200,
height: 200,
axisLabel: "ffffff",
backgroundColor: "000000"
})
toJSON()
// Return a JSON object
audiowaveform().input(stream).toJSON()
start(seconds: number)
// Start at 53 seconds
audiowaveform().input(stream).toPng().start(53).pipe(res)
end(seconds: number)
// End at 745 seconds
audiowaveform().input(stream).toPng().start(53).end(745).pipe(res)
bits(8 | 16: number)
// 8 data bits
audiowaveform().input(stream).toJSON().bits(8).pipe(res)
splitChannels()
// Split channels instead of a single waveform
audiowaveform().input(stream).toJSON().splitChannels().pipe(res)
pixelsPerSecond(zoom: number)
// 50 pixels for second
audiowaveform().input(stream).toPNG().pixelsPerSecond(50).pipe(res)
pipe(stream: Writable)
// Pass the output stream, usually the res object
audiowaveform().input(stream).toJSON().pipe(res)
promise()
// Turn all methods into a promise
const jsonObject = await audiowaveform().input(stream).toJSON().promise()