Sound while text is scrolling

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
Riku
Regular
Posts: 28
Joined: Wed Feb 22, 2012 9:08 am
Location: Québec, Canada
Contact:

Sound while text is scrolling

#1 Post by Riku »

Hi! :mrgreen:

I'm using the callback fonction to play a sound when the text scrolling:
init python:
def callback(event, **kwargs):
if event == "show":
renpy.music.play("godawful-beeping-noise.ogg", channel="sound")
elif event == "slow_done" or event == "end":
renpy.music.stop(channel="sound")
I wonder if I can put it in the voice channel instead of sound. When I try to replace "sound" by voice, but it doesn't work, the sound simply not playing (I think it's because voice channel works differently).

Also, there is other issues: it
has some side effects. Pressing "H" during beeping will suspend "end" event. i.e. the beeping will continue. Same might happen if jumping into game menu by pressing ESC, or going backwards (rollback).

Thanks! :)

Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Re: Sound while text is scrolling

#2 Post by Levrex »

Why not just create another channel and play that thing on it?
http://www.renpy.org/wiki/renpy/doc/ref ... er_channel

As for the "other issues", i don't think it's possible to get rid of them with the current way of showing text. Wasted an hour trying to do so.
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

Riku
Regular
Posts: 28
Joined: Wed Feb 22, 2012 9:08 am
Location: Québec, Canada
Contact:

Re: Sound while text is scrolling

#3 Post by Riku »

Thank you for taking some of your time to help me! :mrgreen:

Well, it "seems" to work, but now I try to add the new channel in the preference menu, so we can disactivate the sound or put down the volume without influencing the order sound channel (that's my goal actually). So, I tried to put this below the other channel in the screen script:
frame:
style_group "pref"
has vbox

label _("Dialogue Sound")
bar value Preference("sound volume")

if config.sample_sound:
textbutton _("Test"):
action Play("Dialogue Sound", config.sample_sound)
style "soundtest_button"


But, doing it that way Dialogue Sound and sound are the same. I can't put down the Dialogue sound volume without put down the sound volume, they are linked.

I think it's because of this line:
bar value Preference("sound volume")
I tried to changed it, but it's up to no good and I don't know where this variable came from... :(

Can you help me again please? :)

Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Re: Sound while text is scrolling

#4 Post by Levrex »

Well, when registering a new channel, you can use one of the three mixers: "music", "sfx" and "voice".
To change their volume, change Preference for the bar — "music volume", "sound volume" and "voice volume" respectively for the aforementioned mixers. The register shall stay lowercase. I recommend using "voice" mixer, as that was your goal from the beginning.
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

Riku
Regular
Posts: 28
Joined: Wed Feb 22, 2012 9:08 am
Location: Québec, Canada
Contact:

Re: Sound while text is scrolling

#5 Post by Riku »

Oh yeah! You're right! :D

I feel kinda stupid to don't understood it by myself! XD

Its work perfectly now! Thanks a lot! :mrgreen:

Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Re: Sound while text is scrolling

#6 Post by Levrex »

Yep, and if your problem is solved, it would be nice to add something like [SOLVED] to theme's name (by editing the first post) so that the guys who want to help wouldn't mistakenly think this problem is still unanswered.

Hm, i guess i'll go make that advice my signature right now.
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Sound while text is scrolling

#7 Post by xavimat »

Riku, how do you define your character with the callback?

By the way. You don't need to define a new channel. Instead of renpy.music.play(cannel="sound"), you can use renpy.sound.play(...
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Riku
Regular
Posts: 28
Joined: Wed Feb 22, 2012 9:08 am
Location: Québec, Canada
Contact:

Re: Sound while text is scrolling

#8 Post by Riku »

xavimat wrote:Riku, how do you define your character with the callback?
define test = Character('test', color="#FFFFFF", callback=callback )

Easy as that! :D
By the way. You don't need to define a new channel. Instead of renpy.music.play(cannel="sound"), you can use renpy.sound.play(...
I don't really understand what do you mean... :?

I wanted to be able to ajusted the sound in the preferences menu independently from the other sounds...

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Sound while text is scrolling

#9 Post by xavimat »

Riku wrote:
xavimat wrote:Riku, how do you define your character with the callback?
define test = Character('test', color="#FFFFFF", callback=callback )

Easy as that! :D
Thanks, Riku! It works perfectly.
Riku wrote:
By the way. You don't need to define a new channel. Instead of renpy.music.play(cannel="sound"), you can use renpy.sound.play(...
I don't really understand what do you mean... :?

I wanted to be able to ajusted the sound in the preferences menu independently from the other sounds...
Sorry, my fault. I didn't understand well your first question.

I meant that, in your original solution, when you used the "sound" channel, you could use "renpy.sound.play("sound.ogg")", instead of the longer "renpy.music.play("sound.ogg", channel="sound")". Both work the same, but the first is shorter.

EDIT: sorry again. This function is obsolete. http://www.renpy.org/wiki/renpy/doc/ref ... sound.play
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Bing [Bot]