Five seconds of delay between sound repeat (WAV format)

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
pekka
Party member
Posts: 206
Joined: Thu Jan 07, 2010 6:48 am
Location: Oulu, Finland
Contact:

Five seconds of delay between sound repeat (WAV format)

Post by pekka »

EDIT/SUMMARY: The delay happened with a WAV format file, but not with OGG. Use OGG. It is better.

Love 0.6.2 and the new beta both do this for me on Linux. I don't normally use the Audio module that much, since Löve is mainly a testbed of game ideas for me. I basically have a bunch of hacks lying around, but no complete games.

If I load a short WAV file as a static Source and try to play it, playing only works after a delay of approximately five seconds. For example, if I write a simple program to play the same sound every second, I only get to hear the sound after intervals of approximately five seconds. It seems the other play() calls are just ignored. This is not a property of the sound file, since I can play it with greater frequency in Audacity or with a Python SFML program I wrote to test it.

Anybody else suffering from this? Am I misusing the API? I am using 64-bit Ubuntu 10.04, and otherwise I have not issue with sound. I suppose it would be easiest for me to just ignore the problem, as I don't need reliable sound fx. For now :(

I have tried using ALSA instead of PulseAudio, as per these instructions, but it had no effect. I reinstalled PulseAudio afterwards, as it works well enough for me.

http://art.ubuntuforums.org/showthread. ... ost9202903

Here is the test program I am using. I won't give the sound file, but like I said, it works without delay elsewhere, and I tried several other sounds.

EDIT: The same thing happened in Windows on the same computer.

Code: Select all

sound = love.audio.newSource("Blooomp.wav", "static")

function love.keypressed(key)
	if key == 'q' then love.event.push('q') end
end

accum = 0
ticks = 0

function love.update(dt)
	accum = accum + dt
	if accum > 1.0 then
		accum = accum - 1.0
		ticks = ticks + 1
		love.audio.play(sound)
	end
end

function love.draw()
	love.graphics.print(tostring(ticks), 30, 30)
end
Last edited by pekka on Sun Sep 19, 2010 7:54 am, edited 3 times in total.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Five seconds of delay between sound repeat

Post by nevon »

I've heard about this before. The easiest solution would be to just use an ogg file instead of a wav.
pekka
Party member
Posts: 206
Joined: Thu Jan 07, 2010 6:48 am
Location: Oulu, Finland
Contact:

Re: Five seconds of delay between sound repeat

Post by pekka »

Right. I converted it to .ogg and it played every second. I didn't guess the pause was due to the file format...

It seems to also happen if I load the WAV as SoundData and then create a sound from it. So I suppose I'll have to remember not to use that format at all then. I'll edit the topic to mention the format next.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Five seconds of delay between sound repeat (WAV format)

Post by bartbes »

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], egoal and 74 guests