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.
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:
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.
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?
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.
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.
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.
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!
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 I'll put all of my audio files in my game folder from now on. Thanks so much for your help!
ReinPy wrote: ↑Wed Jun 13, 2018 11:24 pm
I placed them in the game folder instead and it works now 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.