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.

Music:
load_music (filename) – load music in XM or MOD format
play_music
pause_music
stop_music
music_volume (volume) – set music volume (from 0 to 255)
get_music_pattern
get_music_position

Sound:
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.

Example:
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.

Example:
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 )

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s