AudioSample

The BlitzMax audiosample module contains commands to create and load audio samples to be used with the BlitzMax audio module.
Mono and stereo 8 and 16 bit samples are supported.

Function reference

CreateAudioSample:TAudioSample( length,hertz,format )   Create an audio sample

Returns: An audio sample object

length is the number of samples to allocate for the sample. hertz is the frequency in samples per second (hz) the audio sample will be played. format should be one of:

FormatDescription
SF_MONO8Mono unsigned 8 bit
SF_MONO16LEMono signed 16 bit little endian
SF_MONO16BEMono signed 16 bit big endian
SF_STEREO8Stereo unsigned 8 bit
SF_STEREO16LEStereo signed 16 bit little endian
SF_STEREO16BEStereo signed 16 bit big endian

Example:

' createaudiosample.bmx

Local sample:TAudioSample=CreateAudioSample( 32,11025,SF_MONO8 )
For Local k=0 Until 32
        sample.samples[k]=Sin(k*360/32)*127.5+127.5
Next
Local sound:TSound=LoadSound( sample,True )
PlaySound sound
Input

CreateStaticAudioSample:TAudioSample( samples:Byte Ptr,length,hertz,format )   Create an audio sample with existing data

Returns: An audio sample object that references an existing block of memory

The memory referenced by a static audio sample is not released when the audio sample is deleted. format should be one of:

FormatDescription
SF_MONO8Mono unsigned 8 bit
SF_MONO16LEMono signed 16 bit little endian
SF_MONO16BEMono signed 16 bit big endian
SF_STEREO8Stereo unsigned 8 bit
SF_STEREO16LEStereo signed 16 bit little endian
SF_STEREO16BEStereo signed 16 bit big endian



LoadAudioSample:TAudioSample( url:Object )   Load an audio sample

Returns: An audio sample object


Module Information

Modulebrl.audiosample
Version 1.02
Author Mark Sibly
License Blitz Shared Source Code
Copyright Blitz Research Ltd
Modserver BRL