@euirim/microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
121 lines (120 loc) • 4.04 kB
TypeScript
import { Promise } from "../../common/Exports";
import { AudioStreamFormat } from "../Exports";
export declare const bufferSize: number;
/**
* Represents audio input stream used for custom audio input configurations.
* @class AudioInputStream
*/
export declare abstract class AudioOutputStream {
/**
* Creates and initializes an instance.
* @constructor
*/
protected constructor();
/**
* Creates a memory backed PullAudioOutputStream with the specified audio format.
* @member AudioInputStream.createPullStream
* @function
* @public
* @param {AudioStreamFormat} format - The audio data format in which audio will be
* written to the push audio stream's write() method (currently only support 16 kHz 16bit mono PCM).
* @returns {PullAudioOutputStream} The audio input stream being created.
*/
static createPullStream(format?: AudioStreamFormat): PullAudioOutputStream;
/**
* Explicitly frees any external resource attached to the object
* @member AudioInputStream.prototype.close
* @function
* @public
*/
abstract close(): void;
}
/**
* Represents memory backed push audio input stream used for custom audio input configurations.
* @class PullAudioOutputStream
*/
export declare abstract class PullAudioOutputStream extends AudioOutputStream {
/**
* Creates a memory backed PullAudioOutputStream with the specified audio format.
* @member PullAudioOutputStream.create
* @function
* @public
* @param {AudioStreamFormat} format - The audio data format in which audio will be written to the
* push audio stream's write() method (currently only support 16 kHz 16bit mono PCM).
* @returns {PullAudioOutputStream} The push audio input stream being created.
*/
static create(format?: AudioStreamFormat): PullAudioOutputStream;
/**
* Reads audio data from the internal buffer.
* @member PullAudioOutputStream.prototype.read
* @function
* @public
* @returns {Promise<ArrayBuffer>} Audio buffer data.
*/
abstract read(): Promise<ArrayBuffer>;
/**
* Closes the stream.
* @member PullAudioOutputStream.prototype.close
* @function
* @public
*/
abstract close(): void;
}
/**
* Represents memory backed push audio input stream used for custom audio input configurations.
* @private
* @class PullAudioOutputStreamImpl
*/
export declare class PullAudioOutputStreamImpl extends PullAudioOutputStream {
private privFormat;
private privId;
private privStream;
private streamReader;
/**
* Creates and initalizes an instance with the given values.
* @constructor
* @param {AudioStreamFormat} format - The audio stream format.
*/
constructor(chunkSize: number, format?: AudioStreamFormat);
/**
* Format information for the audio
*/
readonly format: AudioStreamFormat;
/**
* Checks if the stream is closed
* @member PullAudioOutputStreamImpl.prototype.isClosed
* @property
* @public
*/
readonly isClosed: boolean;
/**
* Gets the id of the stream
* @member PullAudioOutputStreamImpl.prototype.id
* @property
* @public
*/
readonly id: string;
/**
* Reads data from the buffer
* @member PullAudioOutputStreamImpl.prototype.read
* @function
* @public
* @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.
*/
read(): Promise<ArrayBuffer>;
/**
* Writes the audio data specified by making an internal copy of the data.
* @member PullAudioOutputStreamImpl.prototype.write
* @function
* @public
* @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.
*/
write(dataBuffer: ArrayBuffer): void;
/**
* Closes the stream.
* @member PullAudioOutputStreamImpl.prototype.close
* @function
* @public
*/
close(): void;
}