audio_8_new numSamples
audio_16_new numSamples
Allocate a new physical Audio buffer of size numSamples samples. The amount of memory allocated is:
numSamples bytes -- 8-bit audio buffer numSamples*sizeof(short) bytes -- 16-bit audio buffer.Returns a handle to the newly created Audio buffer.
audio_free audio
Free the memory allocated for the Audio buffer. If the audio buffer is physical, all memory allocated for the buffer will be freed. If the buffer is virtual, only the "header" information is freed, the memory it borrows from its parent is not freed.
audio_8_clip audio x numSamples
audio_16_clip audio x numSamples
Creates a virtual Audio buffer from the Audio buffer audio. The virtual buffer consists of samples starting from the x-th sample of audio, and contains numSamples samples. A handle to the virtual buffer is returned.
audio_8_reclip audio x numSamples clipped
audio_16_reclip audio x numSamples clipped
This function is identical to AudioClip, except that it destructively modifies the virtual Audio buffer clipped (instead of allocating a new virtual Audio buffer). Warning : memory leaks will occurs if clipped is a physical Audio buffer.
audio_8_set audio v
Set each sample in the Audio buffer audio to value v. The implementation uses memset(). For setting values in a 16 bit audio buffer, use audio_16_set_some
audio_8_set_some audio v offset stride
audio_16_set_some audio v offset stride
Set each sample in the Audio buffer audio as selected by (offset, stride) to value v.
audio_8_copy src dest
audio_16_copy src dest
Copy all the samples from src to dest.
audio_8_copy_some src dest srcOffset srcStride destOffset destStride
audio_16_copy_some src dest srcOffset srcStride destOffset destStride
Copy the specified amount of samples from src to dest. This function can be used to copy one channel of audio data by specifying the right values for offset and stride. To copy mono data or both channels of stereo data, use offset=0 and stride=1. To copy one channel of stereo data, use stride=2 and specify the channel by setting offset to 0 for the left channel or offset to 1 for the right channel.
audio_8_split src left right
audio_16_split src left right
Demultiplex audio data from the stereo Audio buffer src into two mono Audio buffers (one for each channel). Samples from left channel of src are stored in left; samples from right channel of src are stored in right.
audio_8_merge left right dest
audio_16_merge left right dest
Multiplex the two mono Audio buffers left and right into the stereo Audio buffer dest.
audio_8_resample_half in out
audio_8_resample_quarter in out
audio_16_resample_half in out
audio_16_resample_quarter in out
Reduce the sampling rate of in by one-half (or one-quarter), and write the resulting signal in out. The audio data is resampled by averaging pairs or quadruples of values, so it must be in PCM format. To obtain a lower quality resampling of μ-law or A-law data without resampling use one of the decimate commands (see below).
For example, if in contains 16-bit audio sampled at 44100 Hertz, audio_16_resample_quarter will write the equivalent data sampled at 11025 Hertz.
audio_8_resample_linear src dest srcSamples destSamples
audio_8_resample_decimate src dest srcSamples destSamples
audio_16_resample_linear src dest srcSamples destSamples
audio_16_resample_decimate src dest srcSamples destSamples
Resample the audio data in src and write the resulting signal in dest. srcSamples samples of data in src are mapped to destSamples samples to data in dest. The sampling method uses either linear interpolation or decimation, depending on the function called. Decimation is typically significantly faster than interpolation, but introduces more artifacts. The audio data must be in PCM format for linear interpolation to function correctly. These functions may be used to either increase or decrease the sampling rate in an Audio Buffer.
For example, if in contains one second of 8-bit PCM audio sampled at 11025 Hertz, audio_8_resample_linear in out 11025 8000 will convert it to 8000 Hz.
bitstream_cast_to_audio_8 bs offset length
bitstream_cast_to_audio_16 bs offset length
Cast data from bs into a virtual Audio buffer and return the newly created buffer. The data cast starts offset bytes from the start of bs. The resulting audio buffer contains length samples of mono data.
For example, suppose bs is bitstream containing data from a wave audio file. The bitstream is determined to have a a 44 byte header followed by 16-bit stereo data at 8 kHz. To get an audio buffer containing the first second of audio data, you would use
audio = BitstreamCastToAudio8(bs, 44, 16000);since the audio data is 44 bytes into bs, and we want to cast 16000 samples (8000 for the left channel, 8000 for the right channel).
It is the responsibility of the caller to maintain the integrity of the data in bs and to free the virtual audio buffer returned by this call when it is no longer needed.
audio_8_cast_to_bitstream audio
audio_16_cast_to_bitstream audio
Cast the Audio buffer audio as a virtual BitStream and return a handle to the BitStream.
audio_get_num_of_samples audio
audio_get_start_offset audio
Returns the start offset or number of samples in audio. The start offset is 0 if audio is a physical buffer, or the offset into the parent physical buffer if audio is a virtual buffer.
audio_8_chunk_abs_sum audio chunksize
audio_16_chunk_abs_sum audio chunksize
Compute the sum of the absolute values of each group of chunkSize samples in audio. For example, if chunkSize is 10, then this function computes the sum of the absolute values of each chunk of 10 samples. This function is useful for locating silent sections of an Audio buffer. The values computed are returned in a Tcl list.
audio_8_max_abs audio
audio_16_max_abs audio
Returns the maximum absolute value of any sample in the audio buffer audio. This function is useful in combination with audiomap_16to16_init_volume (or audiomap_8to8_init_volume) to normalize the samples in an audio buffer.
Last updated : Saturday, November 14, 1998, 07:50 PM