All Functions Modules Pages
sound

Functions

SOUND sound.load (STRING path)
 Loads a sound for playing it later. More...
 
NIL sound.play (SOUND snd)
 Play a sound object in specified channel (a free channel). More...
 
NIL sound.play (SOUND snd, NUMBER channel)
 Play a sound object in specified channel. More...
 
NIL sound.loop (SOUND snd)
 Apply/Remove the effect loop to an object type sound. More...
 
BOOLEAN sound.looping (SOUND snd)
 It allows to know whether a type this sound in loop mode. More...
 
NIL sound.pause (SOUND snd)
 Pause/Resume a sound object. More...
 
NIL sound.pause (SOUND snd, NUMBER mode)
 Pause/Resume a sound object. More...
 
BOOLEAN sound.playing (SOUND snd)
 It allows to know if a sound is playing. More...
 
NIL sound.stop (SOUND snd)
 Stop a sound object. More...
 
BOOLEAN sound.endstream (SOUND snd)
 It allows to know if a sound is finished. More...
 
NUMBER sound.vol (SOUND snd)
 It allows to know the volume of a sound. More...
 
NIL sound.vol (SOUND snd, NUMBER percentage)
 A sound volume allows to set. More...
 
TABLE sound.getid3 (STRING path)
 Get ID3 info (only MP3 files) More...
 
BOOLEAN sound.extractcover (STRING mp3, STRING path)
 Extract the image (cover) from a mp3 file. More...
 
TABLE sound.vis (SOUND snd)
 Internal interface to display waveform. More...
 

Detailed Description

Sound functions.

Function Documentation

SOUND sound.load ( STRING  path)

Loads a sound for playing it later.

Parameters
pathPath of the file to load(mp3, s3m, bgm or wav).
Returns
A Sound object, ready to be played.
NIL sound.play ( SOUND  snd)

Play a sound object in specified channel (a free channel).

Parameters
sndA sound object.
Returns
Nothing.
NIL sound.play ( SOUND  snd,
NUMBER  channel 
)

Play a sound object in specified channel.

Parameters
sndA sound object.
channelChannel where the object will be played(8 channels numbered from 1 to 8).
Returns
Nothing.
NIL sound.loop ( SOUND  snd)

Apply/Remove the effect loop to an object type sound.

Parameters
sndA sound object.
Note
If you have the effect loop removes it, otherwise applies it.
Returns
Nothing.
BOOLEAN sound.looping ( SOUND  snd)

It allows to know whether a type this sound in loop mode.

Parameters
sndA sound object.
Returns
true if it has the effect, false otherwise.
NIL sound.pause ( SOUND  snd)

Pause/Resume a sound object.

Parameters
sndA sound object.
Returns
Nothing.
NIL sound.pause ( SOUND  snd,
NUMBER  mode 
)

Pause/Resume a sound object.

Parameters
sndA sound object.
modePause mode:
  • -1 if sound object is in pause it will resume, if not in pause, it will.
  • 0 Resume the sound object if it is in pause.
  • 1 Pause the sound object if it is playing.
Returns
Nothing.
BOOLEAN sound.playing ( SOUND  snd)

It allows to know if a sound is playing.

Parameters
sndA sound object.
Returns
true, If the sound object is in State "play", otherwise returns false.
NIL sound.stop ( SOUND  snd)

Stop a sound object.

Parameters
sndA sound object.
Returns
Nothing.
BOOLEAN sound.endstream ( SOUND  snd)

It allows to know if a sound is finished.

Parameters
sndA sound object.
Note
The completed state, applies if I just sound or if a stop is made.
Returns
true, If the sound object is in State "Finalized", otherwise returns false.
NUMBER sound.vol ( SOUND  snd)

It allows to know the volume of a sound.

Parameters
sndA sound object.
Returns
A number with a value of 0 - 100% of the volume of the sound.
NIL sound.vol ( SOUND  snd,
NUMBER  percentage 
)

A sound volume allows to set.

Parameters
sndA sound object.
percentageA number with a value of 0 - 100%
Returns
Nothing.
TABLE sound.getid3 ( STRING  path)

Get ID3 info (only MP3 files)

Parameters
pathPath to the MP3 file.
Returns
A table with this fields:
  • title (STRING).
  • artist (STRING).
  • album (STRING).
  • year (STRING).
  • genre (STRING).
  • comment (STRING).
  • track (NUMBER).
  • version (STRING).
  • cover (IMAGE).
BOOLEAN sound.extractcover ( STRING  mp3,
STRING  path 
)

Extract the image (cover) from a mp3 file.

Parameters
mp3Path to the MP3 file.
pathThe Path where is going to extract the "cover" image.
Returns
True if the imagen extract correctly, False if does not extract correctly.
TABLE sound.vis ( SOUND  snd)

Internal interface to display waveform.

Parameters
sndAn object type sound.
Returns
A table of 256 numeric fields with the values, of the waveform at that moment.