Global

Methods

addSample(sample)

Add a sample to the wave data.
Parameters:
Name Type Description
sample Number The sample to add
Source:

addSampleToAllChannels(sample)

Add a sample to all the channels in the wave data (e.g. if you want the left and right channel in a stereo file to be the same).
Parameters:
Name Type Description
sample Number The sample to add
Source:

create(channelCount, sampleRate, bitsPerSample)

Construct a new wav file instance. This creates a PCM encoded wave file (so isuncompressed).
Parameters:
Name Type Description
channelCount Number The number of channels (1 = mono, 2 = stereo, etc)
sampleRate Number The sample rate (8000, 44100, etc)
bitsPerSample Number The number of bits per sample - see WaveFile.SampleSize
Source:
Returns:
A new WaveFile instance.

getChannelCount()

Gets the number of channels in the wave data.
Source:

getDataChunkSize()

Gets the size, in bytes, of the data portion of the file.
Source:
Returns:
The size of the data chunk (in bytes).

getFrequency()

Gets the frequency of the wave data.
Source:

getSampleCountInOneChannel()

Gets the sample count in a single channel.
Source:
Returns:
The number of samples in a single channel.

getSampleSize()

Gets the number of bits per sample in the wave data.
Source:

getTotalSampleCount()

Gets the total number of samples in the data.
Source:
Returns:
The total number of samples in the data (if there are multiple channels this may not be what you expect - see getSampleCountInOneChannel).

toByteArray()

Convert the wave file instance to a byte array.
Source:
Returns:
The wave file as a byte array.