iPhone App Directory

Pixilang version 1.2 now with sound synthesis

Thanks to Alex Zolotov (NightRadio) for this update on Pixilang. As far as I can remember the previous version could play XM and MOD format music, but the latest version adds a range of sound synthesis options as well.

Here's the details of the sound and music functions in 1.2. Full documentation is available at the Pixilang site.

load_music (filename) - load music in XM or MOD format
music_volume (volume) - set music volume (from 0 to 255)

send_sound (sound_pixi,freq,channels,loop) - send sound_pixi (pixi-container with some piece of sound) to global sound buffer. freq - sampling frequency of selected piece of sound. channels - number of channels (1 - mono, 2 - stereo). loop - remove selected piece of sound from global sound buffer after playing or not? If loop = 1, then selected piece of sound will be playing infinitely. Return value of this command is the ID of selected piece of sound in the glabal sound buffer. send_sound_to (sound_id,sound_pixi,freq,channels,loop) - the same as previous command, but position (buffer_id) in the global sound buffer setting manually.

sound_id = send_sound( some_sound, 44100, 2, 0 )
send_sound_to( sound_id, new_sound, 44100, 2, 0 ) //Overwrite some_sound with new_sound
get_sound_status (sound_id) - get current playing position in selected sound.

sound_id = send_sound(sound,44100,2,0)
position = get_sound_status( sound_id )
sound_volume (volume) - set sound volume (from 0 to 256)

Examples. Creation of 8-bit sound:
snd = new_string( 256 ) //Sound size is 256 samples
//Amplitude in 8bit sound is a value from -127 to 127
send_sound( snd, 44100, 1, 1 )

Creation of 32-bit sound:
snd = new_array( 256 )
//Amplitude in 32bit sound is a value from -32767 to 32767
send_sound( snd, 44100, 1, 1 )

No comments: