Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • atsvb

Index

Constructors

  • new atsvb(customer_id?: string): atsvb
  • Initiation of main SDK instance.

    Parameters

    • Optional customer_id: string

      the unique customer identifier provided by SDK vendor.

    Returns atsvb

Properties

onReady?: (() => void)

Type declaration

    • (): void
    • Returns void

Methods

  • clear(): void
  • This call will destroy the audio graph and worker along with all resources.

    Returns void

  • clearCache(): Promise<void>
  • Ability to clear all models from local cache

    Returns Promise<void>

  • config(config: any): void
  • Ability to configure sdk execution environment

    example

    General configuration options

    config = {
    customer_id: 'customer_id', // Specify customer_id (can also be specified by passing it to the SDK constructor)
    api_url: 'url', // Custom URL for SDK authentication, applicable for on-premises
    sdk_url: 'url', // Specifies the URL to the SDK folder in case you host model files yourself
    preset: 'balanced', / You can specify the default segmentation preset (quality, speed, balanced)
    sample_rate: 48000, // You can specify the default sample rate for model processing
    cacheModels: true, // If true, the SDK will load ML models locally, making subsequent loads faster with no network requests
    processingChunk: 64, // Frame size for communication between worklet and worker in milliseconds; higher value -> more latency and less CPU usage, and vice versa
    wasmPaths: { // Currently, WASM files are loaded from the same directory where the SDK is placed, but custom URLs are also supported (e.g., loading from CDNs)
    'ort-wasm.wasm': 'url',
    'ort-wasm-simd.wasm': 'url',
    }
    }
    example

    Example of how to change default denoise quality preset

    config = {
    preset: 'quality'
    sample_rate: 48000
    }
    • @example Example of how to hot models on custom domain
    config = {
    sdk_url: 'https://domain.com/sdk/' // in this derectory should be subfolder models with all required models
    }

    Parameters

    • config: any

      configuration object

    Returns void

  • getAudioTrack(): MediaStreamAudioTrack
  • Get the output MediaStreamTrack object with denoise applied for further use.

    Returns MediaStreamAudioTrack

  • getCustomerId(): string
  • Get Customer ID provided by vendor.

    Returns string

  • getStream(): MediaStream
  • This object remains permanent throughout the entire lifetime of the SDK instance. When a new stream is provided as the source for processing, the SDK replaces the audio track within this MediaStream.

    Returns MediaStream

  • onError(f: ((e: ErrorObject) => void)): void
  • pass onError callback to ErrorBus

    example
    export interface ErrorObject {
    message: string;
    type: ErrorType;
    code?: ErrorCode;
    emitter?: ErrorEmitter;
    cause?: Error;
    data?: any;
    }

    export enum ErrorCode {
    PERFORMANCE_STOP = 1001, // When the SDK can't perform processing in real-time and latency becomes too high, it will stop processing and bypass the original audio to the output to prevent breaking the user experience and causing audio issues.
    REDUCE_LATENCY = 1002, // When we receive more processed frames than we can render at the moment (this may happen due to short-term performance issues or the browser lowering worker priority), the SDK will increase the speed of the voice (from 10% to 20%) to stabilize latency.
    }

    export enum ErrorType {
    INFO = "info",
    WARNING = "warning",
    ERROR = "error",
    }

    Parameters

    • f: ((e: ErrorObject) => void)

      callback function that takes ErrorObject as its first argument.

        • (e: ErrorObject): void
        • Parameters

          • e: ErrorObject

          Returns void

    Returns void

  • preload(): Promise<void>
  • Ability to preload all required resourses specified in config. This functionality make the initialization faster. Should be started after all configs are passet to sdk.config

    Returns Promise<void>

  • resume(): undefined | false
  • Returns undefined | false

  • run(): void
  • This call starts applying noise reduction effects to the configured audio track. This should be called only after the onReady callback has been triggered.

    Returns void

  • setAudioContext(context: AudioContext): Promise<void>
  • Ability to pass an AudioContext to the SDK. We use it to process audio frames in the Audio Worklet. If a context is not passed, the SDK will create a new context internally.

    Parameters

    • context: AudioContext

    Returns Promise<void>

  • setDenoisePower(power: number): void
  • Set denoise power at runtime. Available only for the balanced preset.

    Parameters

    • power: number

      the number parameter with range 0.0-1.0

    Returns void

  • setPreset(preset: ModelType, sampleRate: number): Promise<void>
  • Changes the denoise preset in real-time. Available presets:

    • speed: Supported sample rate - 16000
    • balanced: Supported sample rates - 32000, 44100, 48000
    • quality: Supported sample rate - 16000

    Parameters

    • preset: ModelType

      The preset to use. Default is 'balanced'. Available options: 'speed', 'balanced', 'quality'.

    • sampleRate: number

      The sample rate to use. Default is 32000. Available options: 16000, 32000, 44100, 48000.

      • The 'speed' and 'quality' presets are supported only with a sample rate of 16000.
      • This method reinitializes the audio processing pipeline. During initialization, the SDK will be stopped. After initialization, it will restore the previous state (i.e., it will resume running if it was active before setPreset was called).

    Returns Promise<void>

  • stop(): void
  • This call stops applying noise reduction effects to the configured audio track and bypasses the original audio to the output. So, if you need to disable effects, you can just call stop and not touch the main logic related to WebRTC and MediaStreams. You can enable it again at any time by calling sdk.run().

    Returns void

  • suspend(): undefined | false
  • Returns undefined | false

  • useAudioTrack(track: MediaStreamTrack): void
  • Set the AudioTrack object to be the source of audio frames for processing. This call recreates the entire processing pipeline and loads all required resources. Once everything is loaded, the SDK calls the onReady callback.

    Parameters

    • track: MediaStreamTrack

      the source MediaStreamTrack object.

    Returns void

  • useStream(stream: MediaStream): void
  • Set the MediaStream object to be the source of audio frames for processing. This call recreates the entire processing pipeline and loads all required resources. Once everything is loaded, the SDK calls the onReady callback.

    Parameters

    • stream: MediaStream

      the source MediaStream object.

    Returns void

Generated using TypeDoc