Music starts randomly (?) playing

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
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Music starts randomly (?) playing

#1 Post by poorlyformed »

For reasons that will probably be obvious to some people but not to me, at a certain point in my game, music starts playing, and I cannot figure out why. It's the music I use for the Main Menu, and it's the only music I have in the game at this point.

Code: Select all

    scene alley night
    with wipeleft
    
    "It's still early enough in the summer that there's a chill to the air. You walk quickly to the alley where the recycling is kept."
    
    "You put the boxes in their proper bin and you're about to head back when you feel a prickle at the back of your neck."
    
    "Crickets had been chirping loudly when you came outside, but they're silent now."
    
    $ zeb ("up","normal","pressed")
    
    "You listen carefully, trying to shake off the unease, when a scraping noise comes from the end of the alley."
    
    "It sounds like something hard and heavy being slowly dragged across concrete."
    
    $ zeb ("up","wide","pressed")
    
    z "H-hello? Is someone there?"
    
    "As soon as you speak, you want to smack yourself. You've watched enough horror movies to know that was a dumb thing to do."
    
    "The noise stops, but before anything else can happen, you turn around and jog back inside."
It starts playing right when the text "It sounds like something hard and heavy..." comes up. Then every I time I click to the next part, it starts over. If I rewind to the line before, it stops, but as soon as I hit that line, it starts again.

I'm completely stumped. This is the only part in the game where it happens.
Image

Roids
Newbie
Posts: 8
Joined: Wed Apr 04, 2018 4:54 am
Contact:

Re: Music starts randomly (?) playing

#2 Post by Roids »

Did you stop the music in label start? Maybe it was on silent for a while and loop?

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: Music starts randomly (?) playing

#3 Post by poorlyformed »

Roids wrote: Thu Apr 05, 2018 8:10 pm Did you stop the music in label start? Maybe it was on silent for a while and loop?
Yeah, it's the first thing after the start label.
Image

Roids
Newbie
Posts: 8
Joined: Wed Apr 04, 2018 4:54 am
Contact:

Re: Music starts randomly (?) playing

#4 Post by Roids »

Have you reload the game? Shift+R?
How did you define and stop the music?

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: Music starts randomly (?) playing

#5 Post by poorlyformed »

I noticed it first when my sister played the game on her computer - I must've had the sound down far enough while testing that I never noticed (it's fairly quiet music.) I then tried it on my computer, both in the distribution build of it, and the working file through the Ren'Py program. Each time it starts at the same spot.

I have the song defined in options.rpy:

Code: Select all

define config.main_menu_music = "sounds/Monster-Stake-Out_Looping.mp3"
and then in script.rpy is where I stop it:

Code: Select all

label start:
    
    stop music
    
 
    scene lrb day with dissolve
Image

Roids
Newbie
Posts: 8
Joined: Wed Apr 04, 2018 4:54 am
Contact:

Re: Music starts randomly (?) playing

#6 Post by Roids »

Can you check to see if the music was still playing?

Something like:

Code: Select all

if (renpy.music.is_playing('music')): 
Then return True.

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: Music starts randomly (?) playing

#7 Post by poorlyformed »

I put the following code into the scene before the one where the music starts playing, and right before the music starts playing, and both times it indicated that it wasn't playing:

Code: Select all

if (renpy.music.is_playing('music')): 
        "Music is playing."
else:
        "Music is not playing."
Image

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Music starts randomly (?) playing

#8 Post by Imperf3kt »

Are you able to package a distribution others can check so you can tell if its a localised event, or something present in the engine/game itself.

Better would be to simply zip up the project folder.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: Music starts randomly (?) playing

#9 Post by poorlyformed »

Image

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: Music starts randomly (?) playing

#10 Post by poorlyformed »

I still can't figure out what is happening. I tried deleting the scene the music starts playing in, but then it just starts playing earlier.
Image

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: Music starts randomly (?) playing

#11 Post by poorlyformed »

ok, but then I renamed the music file that kept playing, and I got this:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 271, in script
    "It sounds like something hard and heavy being slowly dragged across concrete."
IOError: Couldn't find file 'sounds/Monster-Stake-Out_Looping.mp3'.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 271, in script
    "It sounds like something hard and heavy being slowly dragged across concrete."
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\ast.py", line 652, in execute
    renpy.exports.say(who, what, interact=self.interact, *args, **kwargs)
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\exports.py", line 1180, in say
    who(what, *args, **kwargs)
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\character.py", line 1016, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\character.py", line 817, in do_display
    **display_args)
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\character.py", line 566, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\ui.py", line 287, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\display\core.py", line 2635, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\display\core.py", line 3304, in interact_core
    renpy.audio.audio.periodic()
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\audio\audio.py", line 976, in periodic_thread_main
    periodic_pass()
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\audio\audio.py", line 920, in periodic_pass
    c.periodic()
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\audio\audio.py", line 409, in periodic
    topf = load(self.file_prefix + filename + self.file_suffix)
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\audio\audio.py", line 69, in load
    rv = renpy.loader.load(fn)
  File "D:\Program Files (x86)\renpy-6.99.13-sdk\renpy\loader.py", line 555, in load
    raise IOError("Couldn't find file '%s'." % name)
IOError: Couldn't find file 'sounds/Monster-Stake-Out_Looping.mp3'.

Windows-8-6.2.9200
Ren'Py 6.99.14.2.3333
Shadowburg 1.0
Mon Apr 09 21:00:46 2018
Image

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Music starts randomly (?) playing

#12 Post by rayminator »

try to delete the script.rpyc and delete persistent in renpy

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: Music starts randomly (?) playing

#13 Post by poorlyformed »

Didn't work. :(

also, when I hit 'Ignore' on the error screen, I get the same error message as above, only with the next line of script. eg, "File "game/script.rpy", line 271, in script", then "File "game/script.rpy", line 272, in script", then "File "game/script.rpy", line 273, in script", etc etc.
Image

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Music starts randomly (?) playing

#14 Post by kivik »

Can you show us the code on those lines?

I'm assuming the lines just have the narrator speaking, to which I have to ask - have you setup a callback for the narrator? Maybe the music is playing whenever the the narrator is speaking?

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Music starts randomly (?) playing

#15 Post by Imperf3kt »

You should share the game folder (or at least the script files) without building a distribution. I found the spot where the audio randomly starts, but I cannot really see why:

Code: Select all

    scene alley night
    with wipeleft
    
    "It's still early enough in the summer that there's a chill to the air. You walk quickly to the alley where the recycling is kept."
    
    "You put the boxes in their proper bin and you're about to head back when you feel a prickle at the back of your neck."
    
    "Crickets had been chirping loudly when you came outside, but they're silent now."
    
    $ zeb ("up","normal","pressed")
    
    "You listen carefully, trying to shake off the unease, when a scraping noise comes from the end of the alley."
    
    "It sounds like something hard and heavy being slowly dragged across concrete."
    
    $ zeb ("up","wide","pressed")
    
    z "H-hello? Is someone there?"
    
    "As soon as you speak, you want to smack yourself. You've watched enough horror movies to know that was a dumb thing to do."

I can't really read the script file in its current form, so I'd need the unbuilt copy.
In any case, I looked through what I could convert to a legible format and did find this:

Code: Select all

## Demo End
screen demo_end():
    python:
           renpy.music.play("sounds/Monster-Stake-Out_Looping.mp3", fadeout=1.0, fadein=1.0)
    imagemap:
        auto "bg/demo_end_%s.png"
        
        hotspot (1295, 517, 540, 54) action OpenURL("https://poorlyformed.itch.io/shadowburg")
        hotspot (955, 570, 415, 64) action OpenURL("https://poorlyformed.itch.io/shadowburg")
        
    imagebutton auto "gui/menus/nav_return_%s.png" xpos 1775 ypos 1018 action MainMenu(confirm=False)  alt _("Return")
Which you call on a couple of occasions, but I still can't really tell why this would affect anything.
What I find really odd is that the music starts playing from the beginning every time I advance the say window. There's a definite fade in and out though, so to start with I'd suggest commenting out or deleting that screen (demo_end) and see what happens.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Post Reply

Who is online

Users browsing this forum: Google [Bot]