AudioChip

AudioChip

Properties

ChannelsCount numberread only

Number of available channels for this AudioChip. Each channel can independently play an audio sample.

Volume number

The global AudioChip volume.

Methods

GetSpectrumData( channel number, samplesCount number ) number[]

Returns the audio spectrum values of a channel as a table of number values, each one expressing the value of a different frequency.
samplesCount must be a power of 2 (ie 128/256/512 etc) Min = 64 Max = 8192.

GetDspTime( ) number

Returns the current internal AudioChip's DSP time. It is meant to be used in combination with the PlayScheduled method. The returned number is expressed in seconds.

Play( audioSample AudioSample, channel number )

Immediately plays an AudioSample on a specific channel.

PlayScheduled( audioSample AudioSample, channel number, dspTime number )

Schedule the play of and AudioSample at a specific DSP time, expressed in seconds, on the specific channel.

PlayLoop( audioSample AudioSample, channel number )

Immediately plays an AudioSample on a specific channel, looping it.

PlayLoopScheduled( audioSample AudioSample, channel number, dspTime number )

Schedule the play of and AudioSample at a specific DSP time, expressed in seconds, on the specific channel, looping it.

Stop( channel number )

Stops any audio playing on a specific channel

Pause( channel number )

Pause the audio on a specific channel

UnPause( channel number )

Resumes the audio on a specific channel

IsPlaying( channel number ) boolean

Returns true if a channel is currently playing audio

IsPaused( channel number ) boolean

Returns true if a channel is currently paused.

GetPlayTime( channel number ) number

Returns the current play time of a channel, expressed in seconds.

SeekPlayTime( time number, channel number )

Sets the current position of the play head, for the specific channel, expressed in seconds.

SetChannelVolume( volume number, channel number )

Sets the current volume for a channel, 0-100 range.

GetChannelVolume( channel number ) number

Gets the current volume for a channel, 0-100 range.

SetChannelPitch( pitch number, channel number )

Sets the pitch for a channel. Acts as a multiplier. A value of 1 means the default pitch for a sample, a value of 2 plays the sample one octave higher.

GetChannelPitch( channel number ) number

Gets the current pitch of a channel.