[solved] Declaring Sounds

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
User avatar
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

[solved] Declaring Sounds

#1 Post by rinrin » Thu Mar 14, 2013 9:51 am

Can sounds be declared (like images are)?

Since

Code: Select all

image imagename = "location/of/image.png"
lets you work with "imagename" from then on, I thought something like

Code: Select all

sound soundname = "location/of/sound.ogg"
would work in a similar way, but it doesn't. Is there a way to do something like that? Having to use full file paths everywhere is getting very impractical.
Last edited by rinrin on Thu Mar 14, 2013 1:09 pm, edited 1 time in total.

User avatar
DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Declaring Sounds

#2 Post by DragoonHP » Thu Mar 14, 2013 10:27 am

You can do something like this:

Code: Select all

define soundName = "path to sound file"
or

Code: Select all

$ soundName = "path to sound file"

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Declaring Sounds

#3 Post by nyaatrap » Thu Mar 14, 2013 10:58 am

http://www.renpy.org/doc/html/other.htm ... er_channel
When you redefine music and sound channel, then you can add file_prefix="bgm/" and file_suffix=".ogg"

User avatar
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

Re: Declaring Sounds

#4 Post by rinrin » Thu Mar 14, 2013 1:08 pm

Thank you!

Code: Select all

define soundName = "path to sound file"
worked!

Code: Select all

$ soundName = "path to sound file"
didn't (not sure why).

Anyway, problem solved.

User avatar
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

Re: Declaring Sounds

#5 Post by rinrin » Thu Mar 14, 2013 1:10 pm

nyaatrap wrote:http://www.renpy.org/doc/html/other.htm ... er_channel
When you redefine music and sound channel, then you can add file_prefix="bgm/" and file_suffix=".ogg"
That's an interesting idea! I might try that next.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]