Skip to content

Commit

Permalink
doc(silero): document everything
Browse files Browse the repository at this point in the history
  • Loading branch information
nbsp committed Nov 4, 2024
1 parent bd64bfd commit 82532de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/silero/src/vad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const defaultVADOptions: VADOptions = {
forceCPU: true,
};

/** An instance of Silero VAD. */
export class VAD extends baseVAD {
#session: InferenceSession;
#opts: VADOptions;
Expand Down Expand Up @@ -76,19 +77,20 @@ export class VAD extends baseVAD {
* });
* ```
*
* @param options -
* @returns Promise\<{@link VAD}\>: An instance of the VAD class ready for streaming.
*/
static async load(opts = defaultVADOptions): Promise<VAD> {
const session = await newInferenceSession(opts.forceCPU);
return new VAD(session, opts);
}

/** Returns a {@link VADStream} that can be used to push audio frames and receive VAD events. */
stream(): VADStream {
return new VADStream(this.#opts, new OnnxModel(this.#session, this.#opts.sampleRate));
}
}

/** An instance of VADStream using Silero VAD. */
export class VADStream extends baseStream {
#opts: VADOptions;
#model: OnnxModel;
Expand Down

0 comments on commit 82532de

Please sign in to comment.