Bug report: Predictive loading / MIDI

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
Alessio
Miko-Class Veteran
Posts: 576
Joined: Fri May 07, 2004 9:40 am
Completed: GO! Magical Boy (2006), Angelic Orbs (soundtrack)
Projects: Cyberlin (in progress)
Location: Finland
Contact:

Bug report: Predictive loading / MIDI

#1 Post by Alessio »

Started some more serious scripting on the weekend and came up with the following issues (either bugs or then the "stupid user syndrome"...):

Predictive image loading might have a (very minor) problem: If a script has statement $ renpy.quit() and less than 10 command lines follow, the game breaks off saying it can't predict the loading. If you attach 10+ dummy lines to the script, it works.

Every time a new midi file starts playing, the MS Windows soundcard mixer is initialized (panning full left/full volume). Not on the midi channels themselves, but really at OS level. Is there maybe some pygame function initializing this by default? I'd rather let the players keep their mixer settings of course, but if that's not possible, at least the panning should be dead center. No idea if it's a general problem or only in Win2000.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
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:

#2 Post by PyTom »

I have been unable to reproduce either problem using trival variants of the test game that I've been using. If you could email me over a game directory that demonstrates the problem, it would help me to go in and make a fix.

Also, the traceback.txt could also help.

Thanks.

Alessio
Miko-Class Veteran
Posts: 576
Joined: Fri May 07, 2004 9:40 am
Completed: GO! Magical Boy (2006), Angelic Orbs (soundtrack)
Projects: Cyberlin (in progress)
Location: Finland
Contact:

#3 Post by Alessio »

OK, I'll do that. I'm on a tight working schedule during the week, but I'll make an example and post it here as soon as I manage. Cheers!

User avatar
PyTom
Ren'Py Creator
Posts: 16088
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 »

Okay, thanks to Alessio, I've tracked down the bug in predictive image loading. It only manifests when config.debug is True, but it will affect every script where that is the case. I'm somewhat embarassed that my testing didn't catch this one.

I have a fix, which will go into the next version of Ren'Py when I get around to releasing it. In the meantime, the bug can be worked around by making:

Code: Select all

return
The last line of every script file. (Or just don't set config.debug to True.)

Alessio
Miko-Class Veteran
Posts: 576
Joined: Fri May 07, 2004 9:40 am
Completed: GO! Magical Boy (2006), Angelic Orbs (soundtrack)
Projects: Cyberlin (in progress)
Location: Finland
Contact:

#5 Post by Alessio »

That was quick! Cheers! (No need to be embarrassed -- haven't caught any other bug yet, that's impressive.)

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

#6 Post by Tage »

Unfortunately, I have the same MIDI problem. =| Also, unfortunately, there really isn't much one can report on a problem like this. I am running "Windows XP Professional: SP2" with an "ESS Solo-1 PCI AudioDrive" sound card.

What I have figured out is...

If I set MIDI playback in my sound card's properties to be handled by the sound card's driver, the problem does not come up. The problem arises when I set "Microsoft GS Wavetable SW Synth" to handle the the MIDI playback.

Also, after music starts playing and the problem arises, I have set it back to center in speakers, but when it repeated because I had it on a loop, it set it back to left speaker...

Whether those are helpful or not... beats me, lol.

Naraku
Newbie
Posts: 20
Joined: Mon Nov 15, 2004 3:27 pm
Contact:

#7 Post by Naraku »

I am guessing that might be an OS problem.
Said problem does not show up on Windows ME.

Alessio
Miko-Class Veteran
Posts: 576
Joined: Fri May 07, 2004 9:40 am
Completed: GO! Magical Boy (2006), Angelic Orbs (soundtrack)
Projects: Cyberlin (in progress)
Location: Finland
Contact:

#8 Post by Alessio »

I'm running Win2000 SP4 on a Dell Latitude, which has a built-in Microsoft/Roland Sound Canvas Wavetable Synth. That's the only available option in MIDI playback in my sound card's properties, no way to switch it.

Just odd that no other program using MIDI runs into this problem. I don't think it's a RenPy issue, it's probably more Python-related.

Naraku
Newbie
Posts: 20
Joined: Mon Nov 15, 2004 3:27 pm
Contact:

#9 Post by Naraku »

Sounds like you got a bad deal.
You might want to invest in a Soundblaster sound card
be carefull though putting it in, only handle the card by
its edges and make sure the computer is unpluged
when you work on it, dont forget to make sure you
have no static electricity, one spark can ruin a computer.
Gently install the card with a front to back rocking motion
never force the card, if it doesn't fit it doesn't go in that
slot, and lastly dont forget to remove the old sound card
if there is one. Some mainboards like the one I am useing
have built in sound, in which case the computer should
automaticly disable the built in sound when the new
sound card is detected.

Alessio
Miko-Class Veteran
Posts: 576
Joined: Fri May 07, 2004 9:40 am
Completed: GO! Magical Boy (2006), Angelic Orbs (soundtrack)
Projects: Cyberlin (in progress)
Location: Finland
Contact:

#10 Post by Alessio »

Thanks Naraku - but actually I have a full-fledged MIDI studio at home with a dedicated PC, so on-board MIDI is not an issue really. :-) The MIDI problems I described occur on my laptop.

I'm not worried about myself. What I am worried about is that people who play my game may run into the same problem, and that is definitely a big minus in the gaming experience (full volume panned hard left is not fun with headphones, I can assure you...).

So it seems we should avoid MIDI sound, since it may be problematic on some systems. Pity, MIDI files are really small and flexible, really good for long background music.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
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 »

If I can get some volunteers who have the bug and are willing to run some test scripts to help me fix it, I'll try having another go at squashing this bug.

Until then, the current OfficialBestPractice (tm) is to use mp3 music where possible. Of course, it would be nice if I did this in the demo.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
PyTom
Ren'Py Creator
Posts: 16088
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:

#12 Post by PyTom »

Okay, the first experiment for fixing the midi bug is to upgrade SDL_mixer, and hope that that fixes it. Your mission, should you choose to accept it:

1) Confirm you still have the midi playing bug.

2) Download the new version of SDL_mixer from:

http://www.libsdl.org/projects/SDL_mixe ... -win32.zip

3) Unzip that file, to reveal SDL_mixer.dll

4) Copy that file into the lib directory of Ren'Py 4.4. You may want to make a backup copy of the SDL_mixer.dll that's already in that directory.

5) Play the demo, with music. Did the problem go away? I'm guessing this can't hurt, much.

If you could report the results, I'd appreciate it.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

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

#13 Post by Tage »

It ALMOST completely fixed the problem. The sound no longer pans to the left speaker, BUT the sound still blasts to full MIDI volume. And again, it only happens when MIDIs are being handled by the Microsoft GS Wavetable SW Synth...but that probably won't help since it's obviously outside of your hands to fix...At least it doesn't pan to the left anymore, blasting to full MIDI volume is a lot easier to bare with.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
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:

#14 Post by PyTom »

Well, fixing the panning problem is nice. Now to see if I can figure out where the volume is being set by SDL_mixer, and if there's a way I can avoid/control that.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
PyTom
Ren'Py Creator
Posts: 16088
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:

#15 Post by PyTom »

Hm... I've tracked the bug down to a bug in SDL_mixer, which is kinda caused by the way sound works on windows. The problem comes in when SDL_mixer tries to set a volume for a midi file. It's setting the windows mixer directly (to the default of full blast), rather than scaling it to the user's settings.

It's somewhat annoying, since I don't have good access to the user's old midi volume. But hey, since when was life easy?

The good news is I can now reproduce the bug on my (virtual) windows box.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]