Skip to main content

SoundBuilder

class SoundBuilder 

Constructors​

constructor​

public new SoundBuilderaudio: stringSoundBuilder: SoundBuilder

Begin configuring a sound to be played back.

Parameters

Methods​

detune​

public detunecents: number: SoundBuilder

Pitch shift the played sound.

This also affects the duration of the sound.

Parameters

  • cents: number

    The pitch shift in cents.


gain​

public gaindb: number: SoundBuilder

Set the amplification of the played sound.

Parameters

  • db: number

    The gain in dB.


play​

public playoffset?: number: void

Play the configured sound at the current frame.

Parameters

  • offset?: number

    An offset in seconds from the current frame. Defaults to 0.


playbackRate​

public playbackRaterate: number: SoundBuilder

Change the playback rate of the sound.

This also affects the perceived pitch of the sound.

Parameters

  • rate: number

    The new playback rate. Must be greater than 0.


trim​

public trimstart?: numberend?: number: SoundBuilder

Trim the audio file to a specific portion of it.

Parameters

  • start?: number

    The offset in seconds to play from.

  • end?: number

    The offset in seconds to play to.