A little problem regarding audio.

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.
Post Reply
User avatar
thegenius
Prole
Posts: 14
Joined: Sat Oct 01, 2011 1:25 am

A little problem regarding audio.

Post by thegenius »

I have this laser shooting spaceship, and a sound is supposed to play when the laser is fired. However, when there is only one source it only plays every few seconds. Making a new source every time in order to play it works, but it takes up a lot of memory. If anyone can provide a solution, I would be glad to hear it.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: A little problem regarding audio.

Post by TechnoCat »

thegenius wrote:I have this laser shooting spaceship, and a sound is supposed to play when the laser is fired. However, when there is only one source it only plays every few seconds. Making a new source every time in order to play it works, but it takes up a lot of memory. If anyone can provide a solution, I would be glad to hear it.
You can recycle old ones done playing right? http://love2d.org/wiki/TEsound
User avatar
thegenius
Prole
Posts: 14
Joined: Sat Oct 01, 2011 1:25 am

Re: A little problem regarding audio.

Post by thegenius »

TechnoCat wrote:
thegenius wrote:I have this laser shooting spaceship, and a sound is supposed to play when the laser is fired. However, when there is only one source it only plays every few seconds. Making a new source every time in order to play it works, but it takes up a lot of memory. If anyone can provide a solution, I would be glad to hear it.
You can recycle old ones done playing right? http://love2d.org/wiki/TEsound
I'm not sure I'd like to use an entire script to fix what seems to be a small problem. Is there any other way?
User avatar
Ensayia
Party member
Posts: 399
Joined: Sat Jun 12, 2010 7:57 pm

Re: A little problem regarding audio.

Post by Ensayia »

It's inherently the way the audio system works in LOVE. LOVE does not like to quickly start and stop audio sources, there is always a huge delay. The best way to do it is to create a new source every sound effect and have a way of clearing them all out when they are done playing, which frees up resources.

Taehl and I created TEsound to do just that. The current sound system is not very user friendly and the devs really have no intention of fixing it or writing a proper tutorial anytime soon.

EDIT: Retracting that statement.
Last edited by Ensayia on Mon Oct 03, 2011 5:38 am, edited 1 time in total.
User avatar
slime
Solid Snayke
Posts: 3160
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: A little problem regarding audio.

Post by slime »

There are a few filetype-specific issues with sounds in LÖVE 0.7.2. One of them is that .wav files have a few seconds of silence at the end of them. You can call

Code: Select all

source:stop()
source:play()
to manually restart the sound.

Ogg files are the best-supported currently AFAIK. Most of the sound issues can be avoided by using ogg files.

The real problem here is the lack of documentation on the love.audio portion of the wiki, someone should fix that. :P
User avatar
thegenius
Prole
Posts: 14
Joined: Sat Oct 01, 2011 1:25 am

Re: A little problem regarding audio.

Post by thegenius »

slime wrote:There are a few filetype-specific issues with sounds in LÖVE 0.7.2. One of them is that .wav files have a few seconds of silence at the end of them. You can call

Code: Select all

source:stop()
source:play()
to manually restart the sound.

Ogg files are the best-supported currently AFAIK. Most of the sound issues can be avoided by using ogg files.

The real problem here is the lack of documentation on the love.audio portion of the wiki, someone should fix that. :P
Thanks, using .ogg files now, they work much better.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest