Audio Files Won't Play

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
ReinPy
Newbie
Posts: 7
Joined: Tue Apr 10, 2018 11:20 pm
Contact:

Audio Files Won't Play

#1 Post by ReinPy »

Hi! For some reason, I can't get any audio files to play. Ren'Py says that it can't find the file I'm trying to use. I've tried defining the sound file, but that did not work. I have all file extensions visible (though for some reason my audio file extensions won't appear) and the audio file is in my game directory folder. It's an "mp3" type.
Here is the code I'm using:

Code: Select all

 define sound.gentlewaves = ("gentlewaves") 
scene bg ocean sun:
     zoom .5
play sound "gentlewaves" 


I don't know if this information will be of any additional help, but I downloaded the sound from FreeSound.org.
I apologize if this sounds like a stupid question. I'm very new to both programming and Ren'Py.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2402
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Audio Files Won't Play

#2 Post by Ocelot »

This is not how you play sounds.
https://www.renpy.org/doc/html/audio.html
1.) define sound.gentlewaves technically sets gentlewaves property of sound object. Not what you want. define like this: define gentlewaves = ...
2.) ("gentlewaves") is a 1-element tuple containing one string. Not what you want, drop parentheses.
3.) play sound "gentlewaves" plays file "gentlewaves", not sound gentlewaves. Even if it what you want, your file is missing an extention. Are you sure that you have set all extentions to visible? Are executables shown as having .exe extention? Do text documents have .txt extention?
< < insert Rick Cook quote here > >

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

Re: Audio Files Won't Play

#3 Post by kivik »

What Ocelot said (ninja edit).

According to the documentation, you can define audio namesplace like this: (with audio. in front of your own namespace).

Code: Select all

define audio.gentlewaves = "gentlewaves.mp3"
scene bg ocean sun:
     zoom .5
play sound gentlewaves # no quotes if using namespace
If your file extensions are visible but you can't see the .mp3 extension on your file, you may have accidentally not saved the file with an extension (it can happen with some software) or accidentally deleted it - just edit the filename and add .mp3 back if that's the case.

ReinPy
Newbie
Posts: 7
Joined: Tue Apr 10, 2018 11:20 pm
Contact:

Re: Audio Files Won't Play

#4 Post by ReinPy »

Ocelot wrote: Thu May 31, 2018 1:49 pm This is not how you play sounds.
https://www.renpy.org/doc/html/audio.html
1.) define sound.gentlewaves technically sets gentlewaves property of sound object. Not what you want. define like this: define gentlewaves = ...
2.) ("gentlewaves") is a 1-element tuple containing one string. Not what you want, drop parentheses.
3.) play sound "gentlewaves" plays file "gentlewaves", not sound gentlewaves. Even if it what you want, your file is missing an extention. Are you sure that you have set all extentions to visible? Are executables shown as having .exe extention? Do text documents have .txt extention?
Thank you for answering! I fixed the problem with the file extension not showing. I copied the code you gave, but it still can't find the file. I've made sure the spelling in the script is the same as the actual file name, but nothing seems to be working.

ReinPy
Newbie
Posts: 7
Joined: Tue Apr 10, 2018 11:20 pm
Contact:

Re: Audio Files Won't Play

#5 Post by ReinPy »

kivik wrote: Thu May 31, 2018 1:53 pm What Ocelot said (ninja edit).

According to the documentation, you can define audio namesplace like this: (with audio. in front of your own namespace).

Code: Select all

define audio.gentlewaves = "gentlewaves.mp3"
scene bg ocean sun:
     zoom .5
play sound gentlewaves # no quotes if using namespace
If your file extensions are visible but you can't see the .mp3 extension on your file, you may have accidentally not saved the file with an extension (it can happen with some software) or accidentally deleted it - just edit the filename and add .mp3 back if that's the case.
Thank you! Editing the name fixed the file extension issue, but Ren'Py still can't find the audio file. I even copied and pasted the name of the file to make sure it's correct.

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

Re: Audio Files Won't Play

#6 Post by kivik »

Just to check, are your music files in the game/ folder or did you put them inside a subfolder?

ReinPy
Newbie
Posts: 7
Joined: Tue Apr 10, 2018 11:20 pm
Contact:

Re: Audio Files Won't Play

#7 Post by ReinPy »

kivik wrote: Fri Jun 01, 2018 7:26 pm Just to check, are your music files in the game/ folder or did you put them inside a subfolder?
I added them to the images folder.

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

Re: Audio Files Won't Play

#8 Post by kivik »

That may be the problem? Have you tried putting them in the game/ folder? I don't know whether you get error messages if an audio file is not found, so maybe renpy just can't find the audio files and skipped them instead of showing an error!

ReinPy
Newbie
Posts: 7
Joined: Tue Apr 10, 2018 11:20 pm
Contact:

Re: Audio Files Won't Play

#9 Post by ReinPy »

kivik wrote: Wed Jun 06, 2018 12:59 pm That may be the problem? Have you tried putting them in the game/ folder? I don't know whether you get error messages if an audio file is not found, so maybe renpy just can't find the audio files and skipped them instead of showing an error!
I placed them in the game folder instead and it works now :D I'll put all of my audio files in my game folder from now on. Thanks so much for your help!

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

Re: Audio Files Won't Play

#10 Post by kivik »

ReinPy wrote: Wed Jun 13, 2018 11:24 pm I placed them in the game folder instead and it works now :D I'll put all of my audio files in my game folder from now on. Thanks so much for your help!
You can also put them in a sound folder (for ease of organisation), but make sure you add the sound folder to your file references, e.g.

Code: Select all

define audio.gentlewaves = ("sound/gentlewaves.ogg")

Post Reply

Who is online

Users browsing this forum: No registered users