PlaySound

From OxeyeWiki

Jump to: navigation, search

audio.playSound(soundFilename [, volume [, pan [, modulation]]])

Plays an audio file.

Parameter Expected Type Description
soundFilename A string The name of the audio file, relative to the source folder. The name is case sensitive on Mac OS X.
volume A number Volume of the played audio file, maximum is 1.
pan A number Stereo panning of the sound, from -1 (left) to 0 (center) to 1 (right). Only works with mono channel sounds.
modulation A number How pitch shifted the sound should be. Original pitch is 1.
Returns

Returns nothing.

Daisymoon Audio Lib

Example

   audio.playSound("victory.ogg")

   -- a high pitched scream from the left
   audio.playSound("scream.wav", 1, -1, 2)

   local bomb = {x = 100, y = 100}
   local you = {x = 0, y = 0}
   local distance = math.sqrt(math.pow((bomb.x-you.x),2)+math.pow((bomb.y-you.y),2))
   audio.playSound("boom.wav", distance/100, (bomb.x-you.x)/100 , 1) 
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox