@tropicbliss/symphonia
Version:
An audio playback library for Node.js
43 lines (40 loc) • 1.69 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export interface Options {
volume?: number
speed?: number
isBlocking?: boolean
}
export interface Data {
channels: number
currentFrameLen?: number
sampleRate: number
/** In seconds. */
totalDuration?: number
/** Provides controls to play, pause, and stop the audio. */
controller?: Controller
}
/**
* This method blocks the thread by default. Set `isBlocking` to `false` to allow this method to spawn a thread in the background. Note that this incurs some additional overhead.
* The speed and volume is both set to 1.0 by default. Take note that a controller is only returned if the method is non-blocking,
*/
export function playFromBuf(buf: Buffer, opt?: Options | undefined | null): Data
/**
* This method blocks the thread by default. Set `isBlocking` to `false` to allow this method to spawn a thread in the background. Note that this incurs some additional overhead.
* The speed and volume is both set to 1.0 by default. Take note that a controller is only returned if the method is non-blocking,
*/
export function playFromSine(freq: number, ms: number, opt?: Options | undefined | null): Data
/** Provides methods to play, pause, and stop the audio. */
export class Controller {
/** Resumes playback. */
play(): void
/** Pauses playback. No effect if already paused. A paused controller can be resumed with `play()`. */
pause(): void
/** Stops the playback. Once stopped, the audio track can never be played again. */
stop(): void
/** Sets the playback speed. */
setSpeed(speed: number): void
/** Sets the playback volume. */
setVolume(volume: number): void
}