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.
-
NekoNutchi
- Regular
- Posts: 34
- Joined: Fri Aug 16, 2013 9:37 am
- Completed: Reverse Metamorphosis (NaNo2014)
-
Contact:
#1
Post
by NekoNutchi » Sun Feb 02, 2014 11:33 am
Hello, i've been looking around for some posts on this; how do you make two (or more) sound files play at the same time?
I've tried putting them on different channels (music and sound respectively) and to list both of them in the play music statement like so:
Code: Select all
play music [ "file1.mp3", "file2.mp3" ]
But alas, only one file can be heard in playthrough.
Is there a way to do it using customized channels?
Last edited by
NekoNutchi on Wed Feb 05, 2014 1:36 pm, edited 1 time in total.
-
Crazy Li
- Regular
- Posts: 113
- Joined: Fri Jan 03, 2014 3:35 pm
-
Contact:
#2
Post
by Crazy Li » Sun Feb 02, 2014 12:05 pm
I'm pretty sure the play statement only takes one file. This would probably work if you did two lines one right after another to play and used a different channel for each. Never tried it myself though because I haven't had a reason to yet.
Do note that the sound channel doesn't loop though so if you wanted looping sound on a channel that isn't music, you might need to create your own custom channel for it.
-
NekoNutchi
- Regular
- Posts: 34
- Joined: Fri Aug 16, 2013 9:37 am
- Completed: Reverse Metamorphosis (NaNo2014)
-
Contact:
#3
Post
by NekoNutchi » Sun Feb 02, 2014 12:11 pm
Well, i did try to put them on different channels like this:
Code: Select all
play sound("file1.mp3")
play music("file2.mp3")
which didn't produce the effect i wanted.
Don't need looping for this btw, so at least that won't be a problem.
-
Keinart
- Regular
- Posts: 133
- Joined: Sun May 13, 2012 8:28 pm
- Completed: One Thousand Lies
- Projects: Lotus Reverie
- Organization: Keinart Lobre
- Tumblr: keinart
- itch: keinart
- Location: Spain
-
Contact:
#4
Post
by Keinart » Sun Feb 02, 2014 12:56 pm
With "the effect i wanted" you mean the music one was looping and the sound played only once? You can always add noloop statement in music to fix that
Although I think you will probably need to create a new channel with
renpy.music.register_channel and then give it the same properties as sound, then play them at the same time.
-
NekoNutchi
- Regular
- Posts: 34
- Joined: Fri Aug 16, 2013 9:37 am
- Completed: Reverse Metamorphosis (NaNo2014)
-
Contact:
#5
Post
by NekoNutchi » Sun Feb 02, 2014 1:10 pm
Keinart wrote:With "the effect i wanted" you mean the music one was looping and the sound played only once?
Yes, except i don't necessarily need the music file to be looping. Playing both the soundeffects and the music file once would be fine, as long as they play at the same time.
-
Keinart
- Regular
- Posts: 133
- Joined: Sun May 13, 2012 8:28 pm
- Completed: One Thousand Lies
- Projects: Lotus Reverie
- Organization: Keinart Lobre
- Tumblr: keinart
- itch: keinart
- Location: Spain
-
Contact:
#6
Post
by Keinart » Mon Feb 03, 2014 1:25 pm
Then I think it should work if you create a new channel and just call it "sound2" or something like that. Using renpy.music.register_channel in options.rpy and giving it the same properties as sound should be ok, then just use them together as you did before
Code: Select all
play sound("file1.mp3")
play sound2("file2.mp3")
I never created a new channel tho, so I don't know if there's maybe some trick or something weird to know creating one.
-
Crazy Li
- Regular
- Posts: 113
- Joined: Fri Jan 03, 2014 3:35 pm
-
Contact:
#7
Post
by Crazy Li » Mon Feb 03, 2014 2:49 pm
NekoNutchi wrote:Well, i did try to put them on different channels like this:
Code: Select all
play sound("file1.mp3")
play music("file2.mp3")
which didn't produce the effect i wanted.
Don't need looping for this btw, so at least that won't be a problem.
What effect DID it produce? Did the first start before the second one?
A cheap trick around this would be to edit your first file to add in some silent space before it plays that ends up pushing it back however long it is before the second one starts. I didn't expect renpy to have that much of a processing delay between the playing of two audio files though...
If you make it more clear what you wanted and what you got instead, I can give better solutions.
-
NekoNutchi
- Regular
- Posts: 34
- Joined: Fri Aug 16, 2013 9:37 am
- Completed: Reverse Metamorphosis (NaNo2014)
-
Contact:
#8
Post
by NekoNutchi » Wed Feb 05, 2014 1:35 pm
Keinart wrote:Then I think it should work if you create a new channel and just call it "sound2" or something like that. Using renpy.music.register_channel in options.rpy and giving it the same properties as sound should be ok, then just use them together as you did before
Code: Select all
play sound("file1.mp3")
play sound2("file2.mp3")
I never created a new channel tho, so I don't know if there's maybe some trick or something weird to know creating one.
Creating a new channel worked! Thank you for the help.
Users browsing this forum: No registered users