spessasynth_lib documentation
    Preparing search index...

    Class WorkerSynthesizerCore

    The core audio engine for the worker synthesizer.

    This part of the synthesizer runs in the Web Worker and contains the actual audio engine.

    Hierarchy (View Summary)

    Index
    • Creates a new worker synthesizer core: the synthesizer that runs in the worker. Most parameters here are provided with the first message that is posted to the worker by the WorkerSynthesizer.

      Parameters

      • synthCoreConfig: SynthCoreConfig

        The data from the first message sent from WorkerSynthesizer. Listen for the first event and use its data to initialize this class.

      • workletMessagePort: MessagePort

        The first port from the first message sent from WorkerSynthesizer.

      • mainThreadCallback: {
            (message: any, transfer: Transferable[]): void;
            (message: any, options?: StructuredSerializeOptions): void;
        }

        The function to post a message back to the main thread. Usually postMessage.

          • (message: any, transfer: Transferable[]): void
          • The postMessage() method of the Worker interface sends a message to the worker. The first parameter is the data to send to the worker. The data may be any JavaScript object that can be handled by the structured clone algorithm.

            MDN Reference

            Parameters

            • message: any
            • transfer: Transferable[]

            Returns void

          • (message: any, options?: StructuredSerializeOptions): void
          • Parameters

            • message: any
            • Optionaloptions: StructuredSerializeOptions

            Returns void

      • OptionalcompressionFunction: WorkerSampleEncodingFunction

        Optional function for compressing SF3 banks.

      Returns WorkerSynthesizerCore

    sequencers: SpessaSynthSequencer[] = ...

    The array of sequencers to use with the synthesizer. This property allows for direct access to the sequencers and their MIDI data.

    synthesizer: SpessaSynthProcessor

    The synthesizer instance. This property allows for direct access to the audio engine.

    • Runs an offline operation with the audio loop stopped. The loop is always restarted, and a failure rejects the main thread promise waiting for the response.

      Parameters

      • responseType: keyof SynthesizerReturn

        The response type the main thread is waiting for.

      • operation: () => unknown

        The operation, which posts the response itself on success.

      Returns Promise<void>