Crackling in mp3 background music

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
User avatar
Tage
Regular
Posts: 194
Joined: Mon Nov 01, 2004 2:18 am
Location: Memphis, TN
Contact:

Crackling in mp3 background music

#1 Post by Tage » Wed Jan 05, 2005 5:34 am

I doubt this is fixable. Whenever I use fullscreen or switch to another window while the game is in window mode, the music starts to crackle. When I turn music off and then back on, it is still crackling. When I switch it back to window mode from fullscreen mode, it still crackles forcing me to reopen the game.

And if it helps...my computer specs are:
Windows XP Pro: SP2
1.1GHz processor
1GB of RAM
NVidia GeForce DDR 32MB
ESS AudioDrive (don't know what specs to list with audio card, if any o.o;)
DirectX 9.0c (if it's important)

I know the probability of this being fixed on your end is low, but hey, doesn't hurt to ask huh? lol

RedSlash
Veteran
Posts: 351
Joined: Sun Oct 31, 2004 12:48 am
Location: Canada
Contact:

#2 Post by RedSlash » Wed Jan 05, 2005 6:59 am

Happens to me too but I think SDL_mixer is at fault (don't take my word on this one). My own game uses SDL_mixer and it does the same thing as well but only on the Windows platform.

User avatar
Tage
Regular
Posts: 194
Joined: Mon Nov 01, 2004 2:18 am
Location: Memphis, TN
Contact:

#3 Post by Tage » Wed Jan 05, 2005 7:49 am

Ah, thought so P= At least it doesn't crackle in window mode under normal circumstances. :D

User avatar
PyTom
Ren'Py Creator
Posts: 15497
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#4 Post by PyTom » Wed Jan 05, 2005 11:50 am

More and more, I'm starting to think SDL_mixer isn't my favorite library. It's behind many of the problems Ren'Py has. OTOH, I've yet to find another cross-platform music library. But I'll look again.

:-(

If people could look at the CPU graph and let me know if that's associated with the crackling, I'd appreciate it. Also, if you could try using vorbis music too, then that would be nice as well.

User avatar
Tage
Regular
Posts: 194
Joined: Mon Nov 01, 2004 2:18 am
Location: Memphis, TN
Contact:

#5 Post by Tage » Wed Jan 05, 2005 8:26 pm

I'm not sure what you meant by graph, but I'll assume you meant the CPU usage percent? Well, I checked it in window mode and fullscreen mode and they both didn't use more than 7% of the CPU. And for vorbis...that's .ogg format right? If it is, it crackles as well. =/

User avatar
PyTom
Ren'Py Creator
Posts: 15497
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#6 Post by PyTom » Wed Jan 05, 2005 10:13 pm

I tried repeating this on my real windows box, and couldn't.

If you set the screen preferences to fullscreen, quit out, and start the program up again (so that it starts up fullscreen), does it still crackle?

Also, did you replace the SDL_music dll, like I mentioned in the other thread?

User avatar
Tage
Regular
Posts: 194
Joined: Mon Nov 01, 2004 2:18 am
Location: Memphis, TN
Contact:

#7 Post by Tage » Wed Jan 05, 2005 11:54 pm

PyTom wrote:If you set the screen preferences to fullscreen, quit out, and start the program up again (so that it starts up fullscreen), does it still crackle?

Also, did you replace the SDL_music dll, like I mentioned in the other thread?
Yes to both =/

RedSlash
Veteran
Posts: 351
Joined: Sun Oct 31, 2004 12:48 am
Location: Canada
Contact:

#8 Post by RedSlash » Thu Jan 06, 2005 5:59 am

PyTom:
It happens usually when there is a sudden peak of CPU usage, usually switching windows or other stuff. Sometimes it happens on startup. It is also possible that the audio buffer size needs to be increased. AFAIK, PyGame defaults the buffer size to 1024, but it is recommended to use a buffer size of 4096 for music playing according to SDL_mixer docs.

Tage:
Not using the direct sound driver seemed to help for me (though it didn't solve all the problems). Try this:

Create run_game_test.bat with this code:

Code: Select all

set SDL_AUDIODRIVER=waveout
run_game.exe
Run run_game_test.bat to see if there's any difference.

User avatar
PyTom
Ren'Py Creator
Posts: 15497
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#9 Post by PyTom » Thu Jan 06, 2005 11:31 am

Okay, I will increase the size of the SDL_mixer buffer, in order to try to stop this problem.

I'm now considering cutting a test release of Ren'Py a day or two before my game goes to beta testing, with a final release at the same time, more or less.

metalica
Newbie
Posts: 21
Joined: Wed Jan 05, 2005 1:29 pm
Contact:

#10 Post by metalica » Thu Jan 06, 2005 4:49 pm

yep, I have the same problem, though its not that bad, you can still listen to the music pretty well

User avatar
PyTom
Ren'Py Creator
Posts: 15497
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#11 Post by PyTom » Thu Jan 06, 2005 9:56 pm

Does the pre-release found at:

http://www.bishoujo.us/tmp/renpy-4.4.1.zip

help?

User avatar
Tage
Regular
Posts: 194
Joined: Mon Nov 01, 2004 2:18 am
Location: Memphis, TN
Contact:

#12 Post by Tage » Thu Jan 06, 2005 10:22 pm

I can hear it without crackling! Works well so far.

Edit: Testing with different music formats now...

Edit2: Drat, well...good news, it works very well with .ogg format. Bad news...can't hear mp3's at all.

Edit3: console.exe says this when it tries to play mp3's

Code: Select all

Error while trying to play music: Module format not recognized

User avatar
PyTom
Ren'Py Creator
Posts: 15497
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#13 Post by PyTom » Thu Jan 06, 2005 10:45 pm

Grr... I wonder if the SDL_music library I used is linked with mp3 support at all. Well, there's always ogg, and the midi playback should also be superior. Hopefully, this can hold us over until I can get around to making a proper release.

At least this one doesn't crackle as much... I'm getting closer, hopefully.

User avatar
Tage
Regular
Posts: 194
Joined: Mon Nov 01, 2004 2:18 am
Location: Memphis, TN
Contact:

#14 Post by Tage » Thu Jan 06, 2005 10:49 pm

Definitely, the crackling music was my only problem with your engine! And it's almost completely fixed! (fixed for me, since I'm fine with with using .ogg format, lol) Thanks! I appreciate all your hard work!

metalica
Newbie
Posts: 21
Joined: Wed Jan 05, 2005 1:29 pm
Contact:

#15 Post by metalica » Fri Jan 07, 2005 4:04 am

.ogg format? What tool can I use to convert wav,mp3, etc to that format? Thanx :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot]