renpy music won't play!! [SOLVED]

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.
Post Reply
Message
Author
roachflower
Newbie
Posts: 7
Joined: Sat Mar 11, 2023 6:51 am
Contact:

renpy music won't play!! [SOLVED]

#1 Post by roachflower »

I've put the music in the correct file, and have done the correct way to play music "audio/musicfile.mp3", to the point where Renpy used to recognise it and it worked just fine! Now, for some reason, it's having problems and saying it can't find my music file.
"OS error: Couldn't find the file 'audio/bgm_bachelorlearns.mp3'
Any idea if this is glitch or something off with my code?

these are the strings of code renpy has a problem with: play music "audio/bgm_bachelorlearns.mp3"
play music "audio/spookyviolin.mp3"
play music "audio/whitenoise.mp3" fadein 1.0

audio for other ones works as well following the exact same code. one that works is : play sound "audio/breathing.mp3"

aaa dont know what to do. bit confused

FOR FUTURE REFERENCE JUST IN CASE:
Check if songs are corrupted and can be playable in other music players
Attachments
Screenshot 2023-03-11 at 12.52.34.png
Last edited by roachflower on Tue Mar 14, 2023 6:00 am, edited 1 time in total.

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1023
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: renpy music won't play!!

#2 Post by m_from_space »

Renpy automatically detects all audio files inside the "audio" folder and stores them inside the audio-object. So when playing files you can simply do:

Code: Select all

play music spookyviolin

# or

play sound whitenoise
I'm not sure why some files play and others create an error though. You sure there is no typo inside the filename?

roachflower
Newbie
Posts: 7
Joined: Sat Mar 11, 2023 6:51 am
Contact:

Re: renpy music won't play!!

#3 Post by roachflower »

Hi! First of all, thanks so much for replying. Unfortunately, this did not work.
I tried changing the file name to see if it would work, to something simple, so I renamed it, 'intro.mp3'.
I tried
play music intro.mp3
play music audio/intro.mp3
play music intro
and all the same variations with quotations marks, so play music "intro" and so on.
All of them show the same message, (OSerror: couldn't find file) except for one attempt, that wrote "Nameerror: name 'intro' not defined" which I think has to do with lack of quotation marks, but i don't know.
Sorry for being a timesucker, but I'm genuinely stumped. I don't know if this is a computer problem, or if I need to like reinstall renpy or something, but I am just so confused!!

roachflower
Newbie
Posts: 7
Joined: Sat Mar 11, 2023 6:51 am
Contact:

Re: renpy music won't play!!

#4 Post by roachflower »

I even tried replacing said file, but now no sound works. life is pain

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1023
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: renpy music won't play!!

#5 Post by m_from_space »

This sounds odd.

Make sure:

1) the files are actually inside the "myproject/game/audio" folder (sorry for even mentioning that again!)
2) you have read access for those files (like they are not only accessible by root or admin or something)

Could you provide one of those files here? I could check if my project detects them. xD

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

Re: renpy music won't play!!

#6 Post by rayminator »

try converting the mp3 files to ogg

roachflower
Newbie
Posts: 7
Joined: Sat Mar 11, 2023 6:51 am
Contact:

Re: renpy music won't play!!

#7 Post by roachflower »

Okay, so since I messaged I found out why that 'intro.mp3' wasn't specifically playing (something to do with icloud) but there's still music that doesn't play for no reason.
How do I check read access?! And sure, I can send a rain mp3, but I don't know how to do that, haha.

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1023
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: renpy music won't play!!

#8 Post by m_from_space »

roachflower wrote: Sun Mar 12, 2023 2:43 pm Okay, so since I messaged I found out why that 'intro.mp3' wasn't specifically playing (something to do with icloud) but there's still music that doesn't play for no reason.
How do I check read access?! And sure, I can send a rain mp3, but I don't know how to do that, haha.
When replying here, you can add an attachment below the buttons next to "Options".

Normally files should have read access, I just added this to be sure. If other programs can play them, you should be save.

roachflower
Newbie
Posts: 7
Joined: Sat Mar 11, 2023 6:51 am
Contact:

Re: renpy music won't play!!

#9 Post by roachflower »

Okay, it's not letting me attach anything, but holy shit.
I tried playing all of the problematic sound files and to my HORROR they all do not play. No idea why not, but they just cannot be played by usual players. Looks like I'll have to replace a lot of sounds I thought were fine.
Thank you so much for continuing to reply (and for helping me figure out how to use these forums, lol.)

The last question I have for you because you seem very Knowledgeable is that my game cannot recognise my "main_menu.png" in the gui, so I can't access my load screens in game. Any reason behind this?

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

Re: renpy music won't play!!

#10 Post by rayminator »

roachflower wrote: Mon Mar 13, 2023 5:08 am Okay, it's not letting me attach anything, but holy shit.
I tried playing all of the problematic sound files and to my HORROR they all do not play. No idea why not, but they just cannot be played by usual players. Looks like I'll have to replace a lot of sounds I thought were fine.
Thank you so much for continuing to reply (and for helping me figure out how to use these forums, lol.)
what properly happened is that your music files got corrupted somehow due to power outages or bad hard drive or bad sector on the drive
roachflower wrote: Mon Mar 13, 2023 5:08 am The last question I have for you because you seem very Knowledgeable is that my game cannot recognise my "main_menu.png" in the gui, so I can't access my load screens in game. Any reason behind this?
have you changed anything in screens.rpy if so can you provide your changes

this is what the code should look like

Code: Select all

style main_menu_frame:
    xsize 420
    yfill True

    background "gui/overlay/main_menu.png"
can you go to gui/overlay and find main_menu.png and open it in any photo edit to see if it opens up?

or

it could be the reason what I said about your hard drive or file is corrupted

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

Re: renpy music won't play!!

#11 Post by Imperf3kt »

Do you hide file extensions, or are they shown?
I've seen people often accidentally name files things like "mysong.mp3.mp3"
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

roachflower
Newbie
Posts: 7
Joined: Sat Mar 11, 2023 6:51 am
Contact:

Re: renpy music won't play!!

#12 Post by roachflower »

rayminator wrote: Mon Mar 13, 2023 9:44 am have you changed anything in screens.rpy if so can you provide your changes

this is what the code should look like

Code: Select all

style main_menu_frame:
    xsize 420
    yfill True

    background "gui/overlay/main_menu.png"
can you go to gui/overlay and find main_menu.png and open it in any photo edit to see if it opens up?

or

it could be the reason what I said about your hard drive or file is corrupted
THANK YOU SO MUCH OH MY GOD?!?
I had never opened screens.rpy, so the default was
# background "gui/main_menu.png/"
Which I thought was weird, so i then deleted the hashtag and replaced it with your code. THEN I got an error message that the game_menu couldn't be found. I put the dots together and found out that for some bizarre reason the code was changed to just "/game_menu.png" which meant it couldn't find it.

No idea why it turned out like that, I hadn't ever opened screens.rpy. Thank you so much! I'm a newbie programmer so I'm still learning why the program does what it does.

Thanks for everyone's time and help, my problems are now SOLVED to completion!!!

roachflower
Newbie
Posts: 7
Joined: Sat Mar 11, 2023 6:51 am
Contact:

Re: renpy music won't play!!

#13 Post by roachflower »

Imperf3kt wrote: Mon Mar 13, 2023 6:40 pm Do you hide file extensions, or are they shown?
I've seen people often accidentally name files things like "mysong.mp3.mp3"
Thanks for replying! My songs ended up being corrupted and unplayable, but I'll look out for this next time.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], jadeon12