Getting audio to work?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: Getting audio to work?

Post by Petunien » Thu Mar 29, 2012 11:57 am

If you renamed it easily how baconhawka7x said, try to convert the original .mp3 to .ogg with Super 2012 or another audio converter programm your choice.

I'm also a beginner, but if you want to set the audio function in a extern .lua file try it like this:

audio.lua:

Code: Select all

function playMusic()
       music = love.audio.newSource("hurricane.ogg")
       love.audio.setVolume(1.0)
       love.audio.play(music)
end
main.lua:

Code: Select all

require "audio"

function love.load()
       playMusic()
end

This will start the "playMusic" function in the audio.lua when the game starts.
Please correct me, if this is wrong or there are better solutions.
Last edited by Petunien on Thu Mar 29, 2012 2:54 pm, edited 1 time in total.
"Docendo discimus" - Lucius Annaeus Seneca

User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Getting audio to work?

Post by tentus » Thu Mar 29, 2012 2:42 pm

I keep seeing this in this thread:

Code: Select all

require "audio.lua"
This is wrong and will not work in 0.8.0.

The right way to require files is thus:

Code: Select all

require "audio"
Kurosuke needs beta testers

User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: Getting audio to work?

Post by Petunien » Thu Mar 29, 2012 3:06 pm

I changed it, thanks.
Some amendments in 0.8.0 are still unfamiliar. :)

@Thread creator

If you don't have experience with coding, these links will maybe help you to get familiar with lua:

http://www.lua.org/manual/5.1/
http://lua.lickert.net/index_en.html
http://www.youtube.com/user/DevHQLesson ... ?query=lua
http://lua.gts-stolberg.de/en/index.php

That helped me too.
:)
Last edited by Petunien on Thu Mar 29, 2012 3:56 pm, edited 1 time in total.
"Docendo discimus" - Lucius Annaeus Seneca

User avatar
Nixola
Inner party member
Posts: 1942
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Getting audio to work?

Post by Nixola » Thu Mar 29, 2012 3:51 pm

As far as I know, LÖVE still uses Lua 5.1, so the first link is http://www.lua.org/manual/5.1/
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics

User avatar
rokit boy
Party member
Posts: 198
Joined: Wed Jan 18, 2012 7:40 pm

Re: Getting audio to work?

Post by rokit boy » Thu Mar 29, 2012 7:47 pm

I think it would be easier if you used an audiolib
u wot m8

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 21 guests