Creating channels for musci/sound

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
inohatake14
Regular
Posts: 73
Joined: Sun Jul 24, 2011 4:35 pm
Projects: Stained with Magic
Location: TX
Contact:

Creating channels for musci/sound

#1 Post by inohatake14 »

Okay so I really need help creating/ defining channels to play music and sound. Everywhere I looked simply states that I must make them but now how... I'm really confused on where to place everything as well and how to play the sound/ music when I have set up a channel. Also you can set up shortcuts with sound/music file names kind of like you can for character names and dialogue right? I'm sorry I'm such a noob, I have really tried to refrain myself from pestering you guys but- >.< Oh one last question... The one song I was able to play (either because it didn't need a channel or somehow I copied the channel stuff from the FAQ) was supposed to be only for the main menu, but it plays through the whole story! I really have no clue as to why it would do that. :/ Help is greatly appreciated! ;^;
-Needs to buy a tablet :( - Also if you specialize in backgrounds and take requests and/or want to partner up on a project, hit me up! ;)

Image

Image

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Creating channels for musci/sound

#2 Post by PyTom »

The standard channels (music and sound) exist by default. So you can just do:

Code: Select all

play sound "rooster.ogg"
play music "morning.ogg"
and that will work (if the files exist).

More channels can be defined, but at this point, it doesn't seem like that's what you want.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Creating channels for musci/sound

#3 Post by Alex »

The one song I was able to play (either because it didn't need a channel or somehow I copied the channel stuff from the FAQ) was supposed to be only for the main menu, but it plays through the whole story! I really have no clue as to why it would do that. :/
I suppose, that this happend 'cause you didn't stop it.

in "options.rpy"

Code: Select all

    config.main_menu_music = "main_menu_theme.ogg"
in your scrypt:

Code: Select all

label start:
    stop music
    play music "my_game_music.ogg"

User avatar
inohatake14
Regular
Posts: 73
Joined: Sun Jul 24, 2011 4:35 pm
Projects: Stained with Magic
Location: TX
Contact:

Re: Creating channels for musci/sound

#4 Post by inohatake14 »

Actually that is exactly what I tri
ed when it said I needed a channel. :/ Does that mean my files don't exist? I mean they work and they are in my game directory... Is there somewhere else they should be? It just says I have to make a channel first....
-Needs to buy a tablet :( - Also if you specialize in backgrounds and take requests and/or want to partner up on a project, hit me up! ;)

Image

Image

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Creating channels for musci/sound

#5 Post by Alex »

Mmm, it's hard-to-impossible to say smth about it without seeing the code example...

User avatar
inohatake14
Regular
Posts: 73
Joined: Sun Jul 24, 2011 4:35 pm
Projects: Stained with Magic
Location: TX
Contact:

Re: Creating channels for musci/sound

#6 Post by inohatake14 »

Right well I took out the main menu theme now so no problems there... I got the first 'music' to play but it still says everything else is undefined.

here is the full traceback;

I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/script.rpy", line 158, in script
play music quirkyidea.mp3
File "renpy-6.12.0-mainline/common/00statements.rpy", line 130, in python
File "game/script.rpy", line 158, in python
play music quirkyidea.mp3
NameError: name 'quirkyidea' is not defined

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

Full traceback:
File "C:\Users\mariah\Downloads\otome\renpy-6.12.1\renpy\execution.py", line 261, in run
File "C:\Users\mariah\Downloads\otome\renpy-6.12.1\renpy\ast.py", line 1400, in execute
File "C:\Users\mariah\Downloads\otome\renpy-6.12.1\renpy\ast.py", line 1413, in call
File "C:\Users\mariah\Downloads\otome\renpy-6.12.1\renpy\statements.py", line 92, in call
File "renpy-6.12.0-mainline/common/00statements.rpy", line 130, in execute_play_music
File "C:\Users\mariah\Downloads\otome\renpy-6.12.1\renpy\python.py", line 1011, in py_eval
File "game/script.rpy", line 158, in <module>
NameError: name 'quirkyidea' is not defined

Windows-post2008Server-6.1.7601-SP1
Ren'Py 6.12.1.1520
A Ren'Py Game 0.0
-Needs to buy a tablet :( - Also if you specialize in backgrounds and take requests and/or want to partner up on a project, hit me up! ;)

Image

Image

User avatar
inohatake14
Regular
Posts: 73
Joined: Sun Jul 24, 2011 4:35 pm
Projects: Stained with Magic
Location: TX
Contact:

Re: Creating channels for musci/sound

#7 Post by inohatake14 »

and here is the script so far;

# You can place the script of your game in this file.

# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"

# Declare characters used by this game.
define e = Character('Eve', color="#FE2E64")# adam's mistress, dancer
define e1 = Character('Tactless Woman', color="#FE2E64")#^

define g = Character('Gabriel', color="#FAFAFA") #archangel

define k = Character('Kat Shikoukishin', color="#FFBF00") #cat, money grabbing

define m = Character('Mariah Kumorikei', color="#0000FF") # maybe mirai, actress
define girl = Character('Girl', color="#0000FF")#^

define p = Character('Patch Namida', color="#688A08") #ragged sew guy
define p1 = Character('Hollow boy', color="#688A08") #^

define b = Character('Byron Bishou', color="#FF4000") #some land owner maybe?

define y = Character('Yajuu Satsugaisha', color="#0B4C5F") #beast

define h = Character('Hiyaku Shinyuu', color="#01DF3A") #best friend
define boy =Character('Boy', color="#01DF3A") #^

define rt = Character('Reimei Futago', color="#6A0888") #twin twilight

define mt = Character('Mayonaka Futago', color="#0B3861") #twin midnight

define a = Character('Adam', color="#FF0000") #ring leader

define v = Character('Venus', color="#F781D8")#some woman, acrobat

define gam = Character('Gambit Soubashi', color="#8904B1") #gambler man
define gam1 = Character('Gambit', color="#8904B1")#^
define rugged = Character('Rugged Man', color="#8904B1")#^^

define t = Character('Trinity', color="#00FFBF") #woman, jester

define pup = Character('Pinocchio', color="#210B61") #puppet

define gep = Character('Geppeto', color="#0B0B61") #puppet master
#maybe add rozencrantz and guildenstern, romeo and juilet characters later...oh and a robot/cyborg thing...and militia...

define ban = Character('Banshee', color="#BDBDBD")

define j = Character('Judas', color="#B40431") #fallen priest
define j1 = Character('Priest', color="#B40431")#^

define dr = Character('Dr. Cyrus Stein', color="#58ACFA")#doctor
define dr1 = Character('Doctor', color="#58ACFA")#^

define gre = Character('Gretel', color="#DF7401")



image bg ware = "warehouse.png"

# The game starts here.


label start:

scene bg ware
play music "Spring Thaw.mp3"

"Ugh... Where am I? My heads hurts, I can't remember anything..."

rugged "Here they are doctor."
rugged "I'm not sure what happened. The boy was trembling when I found him, and the girl was unconscious and both were in a pool of blood."
rugged "I don't think they were physically harmed though."

dr1 "Alright I'll take a look."

"Wait... A boy? Maybe he knows why I'm here."

dr1 "You. Boy. You can walk right? Come over here so I can get a good look at you."#he does
dr1"These prosthetic limbs don't work as good as yours."
dr1 "Hmm... No physical injuries. Vitals are normal... Tell me boy, do you remember what happened to you?"

boy "..."

dr1 "I believe I asked you a question."

boy "..."

dr1 "you'll do well to respect your elder's wishes boy. Now what is your name? I KNOW you remember that much."

boy "... Hiyaku. Hiyaku Shinyuu"

dr1 "Good. Now quit cowering like a little girl, I'm not going to hurt you as long as you behave."
dr1 "Judging from your reactions I'd say you remember perfectly what happened, we aren't enemies so it might be to your advantage to tell us-"


h "I DON'T REMEMBER ANYTHING!!!"

gam "Why you little-"

dr1 "Settle down Gambit, it isn't our place to hurt them, you go give Adam a brief of the situation. Tell him I'll fill in the details after I examine the girl."

gam1 "Got it."#exit gambit

#girl goes to dr

dr1 "As you were boy. I'm finished with you."

h "..." #returns to spot on floor

dr1 "Good girl, you are a quick learner aren't you?"

girl "I'm Mariah Kumorikei. I'm sorry my head is pounding, I have no recollection of what happened."

dr1 "Hmm... Maybe your memory got repressed from the shock, given the pool of blood you were found in I'm sure it wasn't a pretty situation."
dr1 "I'm Doctor Cyrus Stein and I am in charge of taking care of everyone in these parts."

m "These parts? Where are we?"

dr "Hmm... I think I'll leave that explanation up to Adam. As for your memory recovery, I think it should return naturally if you hang around Hiyaku. He seems to have an idea of what happened."
dr "I think it might take time for him to talk about it, but by then you will probably remember yourself."

"I really don't remember anything... Hiyaku?"
"A friend of mine?"
"Family?"
"Maybe we were strangers who just happened to be in the same place at the same time..."

dr "Everything else appears to be fine, now if you'll excuse me I must be somewhere else."

m "Wait, who's-" #door closes
m "He's gone... Guess I'll just have to be patient."

"Well this place may not be something people normally reside in, but it isn't much worse than my house was."
"I could go for a nap right now"

h "Are you okay?"

m "Are you talking to me?"

h "No the walls."

m "You really are crazy then?"

h "Of course I'm talking to you, it's my fault that-" #pauses
h "You really don't remember anything?"

m "No. I don't suppose you'll tell me?"

h "You are better off not knowing. At any rate I'm sorry." #rolls over to end conversation

m "Whatever. Curiosity killed the cat I guess."

scene
#Charcters: Adam, Eve, Judas, Gambit, Doctor Stein.... location outside carnival, circus tent area.

gam "Well Adam what do you want us to do with them?"
gam "Think they come from good families? Maybe we can hold em hostage for a ransom!"

play music quirkyidea.mp3
with fade

a "I want to keep them."

e1 "But Adam baby we almost got rid of the priest, and then the creepy old fart and the filthy leech show up~"
e1 "Now you are telling me we are going to have to babysit a couple of spoiled runts?"
e1 "Will we ever get to pick up where we left off?"

j1 "Eve should you really say that in front of a priest?"

e "Judas, calling you a priest is like calling a wolf a lamb."

j "Coming from you that has a lot of meaning. Are thou not the snake itself?"

e "Ugh!" #grunt sfx here

gam "Would you two knock it off, some people have things to do later!"

e "You mean waste away all of your money playing at the casino and pass out drunk in some alley when you go bankrupt?"

a "Eve quit your nagging, men are talking here."

e "Oh Adam..."

dr "Now then, if it is your wish to keep them-"

a "I want the boy to stay with the rest of you, and treat him fairly- I'm sure he has a major part in all of this."

dr "A major role? Blood and murder are just that. What should these children's petty problems concern us? Blood is an everyday part of our lives here."

j "The path to enlightment is forged through pain, and for our drab routine lives would it not be a source of entertainment?"

a "Right. Now as for the girl, I want her to stay with me."

dr "What?"

gam "Huh?"

j "That is... so indecent." #<--- "so indecent" in tiny text

e "NO You have GOT to be kidding!"
e "Am I not enough anymore Adam?"
e "Now you'll even resort to children before returning to me?"

a "Does anyone have a problem?"

e "..."

j "..."

gam "..."

dr "..."

a "Good. I'm sure she is the one we need to be wary of and I am the leader am I not?"
a "Can't make much profit if my performers get hurt."
a "Now go inform everyone and let's all meet at dinner."

scene bg ware

"How long have I been asleep? That boy... Hiyaku is gone. I guess he is probably just adjusting to things."
#stomach growls
"I wonder how long it has been since I ate?"
#enter Adam
a "Hungry?"

m "oh you heard that huh? Umm who are you?"

a "I'm Adam, I'm in charge around here."

m "I'm Mariah. Honestly I have no idea what is going on here and there are a bunch of things I-"
#stomach growls

a "I'll answer all of your questions later, for now you need to eat."

menu:
"Follow him" :
jump choice1_follow

"Politely refuse" :
jump choice1_decline

label choice1_follow :

$ menu_flag = True


"Adam huh? Well I've never been one to try and hold doubts over people, I'll follow him for now."

jump choice1_done

label choice1_decline :

$ menu_flag = False

m "Oh I couldn't possibly, I'll just wait until everyone else is eating. I don't want to be anymore of a burden than I already am."

jump choice1_done

label choice1_done :

if menu_flag :

a "Our cook may be a bit hard to handle but she does her job well, I'm sure you'll be satisfied."
m "I assure you I'm not picky!"
a "Are you impling you are a glutton?" #smirks
a "That isn't very ladylike of you"
m "Am I obliged to be ladylike?"
a "Ah of course not, plenty of people stay unmarried these days."
m "Hmph, I'll have you know that I CHOOSE to stay single, much less complications that way." #adam laughs
scene
a "Hey Gretel. This is Mariah and she'll be staying with the troupe for awhile."
gre "Adam didn't I tell you a million times that I hate being called Gretel? Call me Candy!"
#stomach growls
a "I won't it sounds like a stripper name."
gre "why? It has the same meaning as my real name but -" #angry
#stomach growls
gre "Gah! I can't think over that girl's stomach!"
a "Then make her some food WOMAN."
gre "You are such an ogre, men cook too ya know?"
a "Alright I suppose you don't need that paycheck then."
gre "I get it!"
#she leaves to kitchen
m "Well aren't you popular with the ladies?"
a "Hah I only attract the annoying ones, besides Gretel is like a sister to me. She has been here ever since I started up the buisness."
else :

a "Suit yourself. Don't regret it later." #smirks
"Maybe I should look for Hiyaku. I wonder where he could have went?"
"Hmm? In his corner... There is a boy about my age. I wonder what he is doing?" #turn this into a menu later
m "Whatcha doing?"
p1 "... Moving the blankets.."
m "Huh? Is Hiyaku going somewhere?"
p1 "Yes."
"Does that mean I'll be by myself? I still have no idea what is going on."
p1 "...He'll be staying with the rest of us."
m "What about me?"
p1 "...You'll be staying with the master."
"Master? Does he mean Adam?"
m "I'm not quite sure i want to-"
p1 "The master's orders are absolute."
m "Umm but don't you think it is a bit strange?"
p1 "What is?"
"Well looking at him, I'm not sure if he finds anything strange."
m "Nevermind."
m "..."
p1 "..."
m "Umm do you work here?"
p1 "Everyone works here."
m "No- uh, I mean are you a servant?You called Adam 'master' earlier... What's your name?" # you called Adam... tiny text
p1 "I'm Patch Namida, I do the tailoring around here."
m "really? I can't sew to save my life! Nice to meet you Patch, I'm Mariah Kumorikei."
p "...Well I'm done here."
"Well he just doesn't waste a word does he? Well I guess I better find Hiyaku now."
scene
return
-Needs to buy a tablet :( - Also if you specialize in backgrounds and take requests and/or want to partner up on a project, hit me up! ;)

Image

Image

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Creating channels for musci/sound

#8 Post by Aleema »

Place your code in code tags, ino! It's at the top of the text box when making a post.

Your problem is:

Code: Select all

play music quirkyidea.mp3
with fade
First, you need to call your MP3 with quote marks. Second, you don't say "with fade" with sound tracks. You say "fadein" and then an amount of seconds.

Code: Select all

play music "quirkyidea.mp3" fadein 3.0

User avatar
inohatake14
Regular
Posts: 73
Joined: Sun Jul 24, 2011 4:35 pm
Projects: Stained with Magic
Location: TX
Contact:

Re: Creating channels for musci/sound

#9 Post by inohatake14 »

Oh ok thanks, and sorry- I was wondering how everyone did that! xD
-Needs to buy a tablet :( - Also if you specialize in backgrounds and take requests and/or want to partner up on a project, hit me up! ;)

Image

Image

User avatar
inohatake14
Regular
Posts: 73
Joined: Sun Jul 24, 2011 4:35 pm
Projects: Stained with Magic
Location: TX
Contact:

Re: Creating channels for musci/sound

#10 Post by inohatake14 »

>.< What about pausing music? I tried a couple of methods but... well here is the traceback

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 216: expected end of line.
pause music "quirkyidea.mp3"
^

Ren'Py Version: Ren'Py 6.12.1.1520


and when I tried to not label the song it said this;

I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/script.rpy", line 216, in script
pause music
File "renpy-6.12.0-mainline/common/00statements.rpy", line 440, in python
File "game/script.rpy", line 216, in python
pause music
NameError: name 'music' is not defined

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

Full traceback:
File "C:\Users\mariah\Downloads\otome\renpy-6.12.1\renpy\execution.py", line 261, in run
File "C:\Users\mariah\Downloads\otome\renpy-6.12.1\renpy\ast.py", line 1400, in execute
File "C:\Users\mariah\Downloads\otome\renpy-6.12.1\renpy\ast.py", line 1413, in call
File "C:\Users\mariah\Downloads\otome\renpy-6.12.1\renpy\statements.py", line 92, in call
File "renpy-6.12.0-mainline/common/00statements.rpy", line 440, in execute_pause
File "C:\Users\mariah\Downloads\otome\renpy-6.12.1\renpy\python.py", line 1011, in py_eval
File "game/script.rpy", line 216, in <module>
NameError: name 'music' is not defined

Windows-post2008Server-6.1.7601-SP1
Ren'Py 6.12.1.1520
A Ren'Py Game 0.0

Music not being defined is the problem i was having when I tried to play/ stop music on my other project when it kept telling me to make a channel. >.< Thanks and sorry >.<
-Needs to buy a tablet :( - Also if you specialize in backgrounds and take requests and/or want to partner up on a project, hit me up! ;)

Image

Image

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Creating channels for musci/sound

#11 Post by Aleema »

You can't pause music, sorry. Only start or stop it (or reduce its volume, but that's a more advanced code).
To stop music, you use the word "stop" instead of "play", if you don't know.

User avatar
inohatake14
Regular
Posts: 73
Joined: Sun Jul 24, 2011 4:35 pm
Projects: Stained with Magic
Location: TX
Contact:

Re: Creating channels for musci/sound

#12 Post by inohatake14 »

Darn :/ Well maybe someday huh? well can you pause something cause the word lights up? xD
-Needs to buy a tablet :( - Also if you specialize in backgrounds and take requests and/or want to partner up on a project, hit me up! ;)

Image

Image

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]