cacophony
    Preparing search index...

    Class Synth

    The base interface for any sound-producing entity, including individual sounds, groups, and playbacks. BaseSound

    Hierarchy

    • RoutableSource
      • Synth

    Implements

    Index
    _filters: BiquadFilterNode[] = []
    _oscillatorOptions: Partial<OscillatorOptions>
    _position: Position
    _routeTarget: Bus | null = null

    Primary route target. null is the canonical master route.

    _sends: Map<Bus, number> = ...

    Additional send target to gain-value mappings.

    _stereoPan: number
    _threeDOptions: ThreeDOptions
    _volume: number
    context: BaseContext
    globalGainNode: GainNode
    panType: PanType = "HRTF"
    playbacks: SynthPlayback[] = []
    soundType: SoundType = "oscillator"
    • get detune(): number

      Returns number

    • set detune(detune: number): void

      Parameters

      • detune: number

      Returns void

    • get frequency(): number

      Returns number

    • set frequency(frequency: number): void

      Parameters

      • frequency: number

      Returns void

    • get oscillatorOptions(): Partial<OscillatorOptions>

      Returns Partial<OscillatorOptions>

    • set oscillatorOptions(options: Partial<OscillatorOptions>): void

      Parameters

      • options: Partial<OscillatorOptions>

      Returns void

    • get stereoPan(): number

      Returns number

    • set stereoPan(value: number): void

      Parameters

      • value: number

      Returns void

    • get type(): OscillatorType

      Returns OscillatorType

    • set type(type: OscillatorType): void

      Parameters

      • type: OscillatorType

      Returns void

    • Called by Bus.drainTo to move this source off the draining bus onto target. The source reroutes its primary route and/or any send that targeted bus.

      Parameters

      Returns void

    • Materialize all declared recipes, then establish this playback's sends.

      Parameters

      • playback: BasePlayback

      Returns void

    • Resolve the node used by future playbacks for their primary output. Sources left on a subsequently destroyed bus fall back to master.

      Returns GainNode

    • Establish every configured send on a newly created playback.

      Parameters

      • playback: BasePlayback

      Returns void

    • Clones the current Synth instance, creating a deep copy with the option to override specific properties. This method allows for the creation of a new, independent Synth instance based on the current one, with the flexibility to modify certain attributes through the overrides parameter. This is particularly useful for creating variations of a synth without affecting the original instance. The cloned instance includes all properties, playback settings, and filters of the original, unless explicitly overridden.

      Parameters

      • overrides: Partial<SynthCloneOverrides> = {}

        An object specifying properties to override in the cloned instance. This can include audio settings like volume, playback rate, and spatial positioning, as well as more complex configurations like 3D audio options and filter adjustments.

      Returns Synth

    • Type Parameters

      • K extends
            | "play"
            | "stop"
            | "pause"
            | "resume"
            | "ended"
            | "volumeChange"
            | "error"
            | "fadeStart"
            | "fadeEnd"
            | "fadeCancel"
            | "frequencyChange"
            | "typeChange"
            | "detuneChange"

      Parameters

      Returns void

    • Type Parameters

      • K extends
            | "play"
            | "stop"
            | "pause"
            | "resume"
            | "ended"
            | "volumeChange"
            | "error"
            | "fadeStart"
            | "fadeEnd"
            | "fadeCancel"
            | "frequencyChange"
            | "typeChange"
            | "detuneChange"

      Parameters

      Returns Promise<void>

    • Parameters

      • value: number
      • duration: number
      • Optionaltype: FadeType

      Returns Promise<void>

    • Remove event listener.

      Type Parameters

      • K extends
            | "play"
            | "stop"
            | "pause"
            | "resume"
            | "ended"
            | "volumeChange"
            | "error"
            | "fadeStart"
            | "fadeEnd"
            | "fadeCancel"
            | "frequencyChange"
            | "typeChange"
            | "detuneChange"

      Parameters

      Returns void

    • Register event listener.

      Type Parameters

      • K extends
            | "play"
            | "stop"
            | "pause"
            | "resume"
            | "ended"
            | "volumeChange"
            | "error"
            | "fadeStart"
            | "fadeEnd"
            | "fadeCancel"
            | "frequencyChange"
            | "typeChange"
            | "detuneChange"

      Parameters

      Returns () => void

      Cleanup function

    • Generates a Playback instance for the synth without starting playback. This allows for pre-configuration of playback properties such as volume and position before the synth is actually played.

      Returns SynthPlayback[]

    • Route this source to a bus, or add an independent send when sendGain is provided.

      Parameters

      • target: string | Bus
      • OptionalsendGain: number

      Returns void