Layering music channels

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
Friendbot2000
Regular
Posts: 161
Joined: Tue Feb 15, 2011 8:00 pm
Projects: Mutagen : Journey to Haven's Landing
Contact:

Layering music channels

#1 Post by Friendbot2000 » Sat Apr 30, 2011 11:52 am

I am having a problem with putting multiple music channels into my VN. When I put multiple channels into the code and start up the VN to test it, my music will start skipping. I also have sound effects programmed in so maybe I am overloading the engine with too much audio output. I could potentially edit the audio all into one file, but I want to avoid doing that until I finish programming the entire game. After that I can go back and clean everything up. Is there anything I can do to fix this?
Visit my game development group's Facebook page : Timekeeper Games
Mutagen : Journey to Haven's Landing Facebook Page
Follow our Twitter feed too : TK Games

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

Re: Layering music channels

#2 Post by Aleema » Sat Apr 30, 2011 12:10 pm

How many channels? How are you declaring them?

Friendbot2000
Regular
Posts: 161
Joined: Tue Feb 15, 2011 8:00 pm
Projects: Mutagen : Journey to Haven's Landing
Contact:

Re: Layering music channels

#3 Post by Friendbot2000 » Sat Apr 30, 2011 12:19 pm

I am trying to layer 3 channels and I am using the format written in the new wiki. I would pull it up and copy and paste it here, but I am at work and posting from my phone.
Visit my game development group's Facebook page : Timekeeper Games
Mutagen : Journey to Haven's Landing Facebook Page
Follow our Twitter feed too : TK Games

Friendbot2000
Regular
Posts: 161
Joined: Tue Feb 15, 2011 8:00 pm
Projects: Mutagen : Journey to Haven's Landing
Contact:

Re: Layering music channels

#4 Post by Friendbot2000 » Sat Apr 30, 2011 3:08 pm

Aleema wrote:How many channels? How are you declaring them?
Ah I am finally home. Okay, here is my current code:

Code: Select all

init python:
    renpy.music.register_channel("hospital1", "sound", True)
    renpy.music.register_channel("hospital2", "sound", True)
    renpy.music.register_channel("hospital3", "sound", True)
label start:
    scene intro
          play hospital1 "sounds/hospital1.wav"
          play hospital2 "sounds/hospital2.wav"
          play hospital2 "sounds/hospital3.wav""
    return
That is the paraphrased version with all the irrelevant bits cut out of it. Do you have any suggestions?
Visit my game development group's Facebook page : Timekeeper Games
Mutagen : Journey to Haven's Landing Facebook Page
Follow our Twitter feed too : TK Games

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

Re: Layering music channels

#5 Post by Aleema » Sat Apr 30, 2011 3:38 pm

Here's an alternative method of playing multiple layers of sounds:

$ renpy.sound.play("sound.wav", channel = 0)
$ renpy.sound.play("sound2.wav", channel = 1)

(or renpy.music.play)

There are already multiple sound channels/layers that exist. I believe 0-1 is sound, the next several are for music, and a couple for voice. By that, I mean they'll show up on the sound/music/voice mixer, respectively. Try that method and see if it helps at all? If not, make sure the game itself isn't lagging (it's not hogging up all the system's resources).

Friendbot2000
Regular
Posts: 161
Joined: Tue Feb 15, 2011 8:00 pm
Projects: Mutagen : Journey to Haven's Landing
Contact:

Re: Layering music channels

#6 Post by Friendbot2000 » Sat Apr 30, 2011 3:48 pm

Thanks Aleema.

I think the problem could be that the game hogs too much system resources. Any suggestions on how to cut down on resource usage? I like the way my game is set up now and if there is a way to cut the resource cost and keep the content I want to utilize it.
Visit my game development group's Facebook page : Timekeeper Games
Mutagen : Journey to Haven's Landing Facebook Page
Follow our Twitter feed too : TK Games

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

Re: Layering music channels

#7 Post by Alex » Sat Apr 30, 2011 3:53 pm

renpy.music.register_channel("hospital1", "sound", True)
Try to change "sound" to "sfx"...
http://www.renpy.org/doc/html/other.htm ... er_channel

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

Re: Layering music channels

#8 Post by Aleema » Sat Apr 30, 2011 4:01 pm

Hmmm ... Do you know how much RAM you have? If it's too low, we probably can't help you. But then again, this is a show-text-with-a-picture program and it shouldn't be that inaccessible. I would definitely say that mixing all your sound layers into 1 will help when you're ready to do that. I'd also cut down on the amount of visuals you show at once, and take space-saving measures on pictures and music, since they're cache hogs. By "space saving", I mean, just be conscious if you need the absolute highest quality music, or if you really need the same base sprite over and over and over when you could just cut out the emotions and have just one body + many faces. Just things that lower the cost of the resources involved.

Friendbot2000
Regular
Posts: 161
Joined: Tue Feb 15, 2011 8:00 pm
Projects: Mutagen : Journey to Haven's Landing
Contact:

Re: Layering music channels

#9 Post by Friendbot2000 » Sat Apr 30, 2011 4:35 pm

Aleema wrote:Hmmm ... Do you know how much RAM you have? If it's too low, we probably can't help you. But then again, this is a show-text-with-a-picture program and it shouldn't be that inaccessible. I would definitely say that mixing all your sound layers into 1 will help when you're ready to do that. I'd also cut down on the amount of visuals you show at once, and take space-saving measures on pictures and music, since they're cache hogs. By "space saving", I mean, just be conscious if you need the absolute highest quality music, or if you really need the same base sprite over and over and over when you could just cut out the emotions and have just one body + many faces. Just things that lower the cost of the resources involved.
I have 4 GB of RAM on my Mac, but I am more worried about what OTHER people have. I don't want to model my game off of the specs on my computer, but on the specs of the average player. I don't want to alienate anybody with a game they can't play because they can't shell out for the hardware. Of course if you are playing with a Commodore 64 then I can't help you :P
Visit my game development group's Facebook page : Timekeeper Games
Mutagen : Journey to Haven's Landing Facebook Page
Follow our Twitter feed too : TK Games

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]