Problem with playing audio files

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
rmn_rmn
Prole
Posts: 21
Joined: Thu Jul 08, 2010 3:04 am

Problem with playing audio files

Post by rmn_rmn »

Hello to everyone! Would you be so kind to clarify some strange case with playing audio: when I use "static", e.g.

Code: Select all

src1=love.audio.newSource("sample.ogg","static")
love.audio.play(src1)
things work well, but without "static" it plays just fraction of a second and stops playing. My guess is that some process should be killed after closing the program, but I'm not sure. Song's length is about 5 min, quality standard, and I've tried to load .mp3 sample, the same story - with "static" ok, but otherwise mute.

Regards,
Roman.
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Problem with playing audio files

Post by bmelts »

Hm. Does this happen with every OGG/MP3 you try, or just particular ones? Does it happen consistently (each time you try to run the program), or does it seem random whether it works or not with a given file? If you have a file that causes the problem consistently, do both OGG and MP3 versions have the problem (and can you upload it somewhere so we can look at it)? What OS are you on/hardware are you running?

For reference, if you're not using "static", then what LÖVE does is it streams the file from your hard drive and only keeps a small part of it in memory at any one time. It's possible there's something awry with the streaming process, or something related to it; it'd be cool if you could create a bug report with the information requested above so we'll have something to reference.
rmn_rmn
Prole
Posts: 21
Joined: Thu Jul 08, 2010 3:04 am

Re: Problem with playing audio files

Post by rmn_rmn »

anjo wrote:Hm. Does this happen with every OGG/MP3 you try, or just particular ones? Does it happen consistently (each time you try to run the program), or does it seem random whether it works or not with a given file? If you have a file that causes the problem consistently, do both OGG and MP3 versions have the problem (and can you upload it somewhere so we can look at it)? What OS are you on/hardware are you running?
Thanks for your attention. Actually, I've just tried it again and it ran smoothly...But when I interrupted the thread by closing the window of my program and started it again the same bug happened. Then I loaded new song and it played successfully two times before new stuck. I tried 4 tracks with different extensions with nearly the same results: stuck-->change song-->playing-->trying to play the same song again-->stuck. At first glance I don't see the pattern of error. I guess the default system cleaner (I use Ubuntu 10.04 on my laptop) doesn't clean the pipeline. And after this first launch the pipeline is full and cannot accept new thread, I think. I've recently written my small mp3 player in GTK+/Ruby and had some problems with decoders and other technical stuff, but I think authors of love.audio used MIME for auto-plugging.
Whole script is below.

Code: Select all

src1=love.audio.newSource("sample.ogg")
love.audio.play(src1)
--I wanted to bind Up and Down keys with volume,
--and this part of code worked successfully supposed
--the song was playing 
vol=1
function love.keypressed(key,unicode)
 if key == 'up' then
 vol=vol+0.1
 src1:setVolume(vol)
 elseif key == 'down' then
 vol=vol-0.1
 src1:setVolume(vol)
 end
end
After closing the window I get in terminal:

Code: Select all

AL lib: ALc.c:1818: alcCloseDevice(): deleting 32 Buffer(s)
Regards,
Roman.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Problem with playing audio files

Post by nevon »

I have more or less the same problem, also running Ubuntu 10.04 and love 0.6.2. Streaming sounds can either stop playing, "hang" and repeat the same second over and over again, or make funny (ear damaging) noise.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Problem with playing audio files

Post by Robin »

Same here, Xubuntu 9.10 (I know, I should upgrade...) and all versions of LÖVE that I can remember. It mostly sounds like static. Sometimes (very rarely) it plays just fine.
Help us help you: attach a .love.
rmn_rmn
Prole
Posts: 21
Joined: Thu Jul 08, 2010 3:04 am

Re: Problem with playing audio files

Post by rmn_rmn »

Don't you suffer from this? I'm new to Lua and LOVE in particular, but the stuff I've seen here seems much better than Rubygame and friends which I tried before. And do you usually use "static"? I think as far as LOVE is an open-source I'll choose time to have a look at its audio scripts.
By the way, I faced another strange bug today earlier - I had an error connected with "invalid description". I guess there must be some info about track, otherwise LOVE rises an error. I changed track to another one and the error disappeared)
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Problem with playing audio files

Post by nevon »

rmn_rmn wrote:do you usually use "static"?
That depends. For shorter sounds, like shots, hits, thuds, etc. you'd usually use static. But for larger sounds like music or other background tracks, you'd use streaming.
Jimun
Prole
Posts: 1
Joined: Fri Jul 09, 2010 10:24 pm

Re: Problem with playing audio files

Post by Jimun »

Hello, I'm having audio problems which I believe are the same problem being described here and would like to explain my experiences with the matter here in hopes that it will make finding the source of the problem easier.

I've been working on a game in LOVE for the past few months now, and when I was making it in LOVE 0.6.1, everything was fine. But since upgrading to 0.6.2 I've noticed some strangeness with the sound.

The problem is usually most noticable when playing a Module format song in the background. Often times certain channels of the song just won't play. Sometimes when a sound effect is played it sounds like some of the music channels will pop into existance. When playing an Ogg-Vorbis song, there usually isn't any problems, but occasionally the song will cut out after about a half second and there will be no music until the song is changed. The problem doesn't appear to be specific to streaming. I changed my music loading code to use 'static' as an experiment and all this accomplished was making the loading times of the songs very long. The sound problems remained, at least with the module files as far as I could tell. The ogg music cutout is kind of random and rare for me, so I couldn't easily test if that occured on static.

The sound effects used in my game all use static, and most of them are short .wav files. The sound effects usually play fine, but sometimes there's extra clicking or noise at the start or end of the sound... sometimes it sounds like a tiny split-second chunk of whatever music was last playing in the background, but I could be wrong about this. On rare occasions one of the sound effects will cut out, and that Source won't play again for a few seconds. I notice this in particular with a repeating sound I have. The source should be stopped and started over and over again to make the repeating sound, but for some reason it goes silent for a period of time. It's actually a series of two alternating sounds. One stops the other when it plays. And during this cutout time, only one of the two sounds plays.

Finally, the problem doesn't appear to be limited to one platform. I can personally vouch for it occuring on both Linux (Arch Linux on a 2.6.33-ARCH kernel), and on Windows (Windows XP Pro, Service Pack 3). And a friend of mine reports noticing sound issues on Mac OSX. (I'm unsure what version he has. Either Leopard or Snow Leopard).

In general the problems are usually minor, but annoying, and I notice it most often with the instruments cutting out on module files. If I change the song being played several times it's easy to notice how sometimes the song sounds different each time.

I hope this helps in some way. Let me know if there's anything further I can do to help.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], kov_serg and 9 guests