When implementing text bleeps by using character callbacks, is there a way to use voice instead of sound or music?

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
Njjeppson
Newbie
Posts: 8
Joined: Tue Jun 30, 2020 4:29 pm
Contact:

When implementing text bleeps by using character callbacks, is there a way to use voice instead of sound or music?

#1 Post by Njjeppson » Fri Nov 06, 2020 11:32 am

Text bleeps are a great feature, but they're a huge pain when it comes to the volume mixer. I would love for them to be able to use the voice channel so that their volume can be adjusted seperately from the music and sounds, but I can't figure out how to set them to do that. I'm using the code displayed here:
https://www.renpy.org/dev-doc/html/char ... backs.html

Code: Select all

init python:
    def beepy_voice(event, interact=True, **kwargs):
        if not interact:
            return

        if event == "show_done":
            renpy.sound.play("beeps.ogg")
        elif event == "slow_done":
            renpy.sound.stop()

define pike = Character("Christopher Pike", callback=beepy_voice)

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: When implementing text bleeps by using character callbacks, is there a way to use voice instead of sound or music?

#2 Post by gas » Fri Nov 06, 2020 12:31 pm

Specify the channel in the function.
renpy.sound.play("blablabla.wav", channel = "voice")
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

Njjeppson
Newbie
Posts: 8
Joined: Tue Jun 30, 2020 4:29 pm
Contact:

Re: When implementing text bleeps by using character callbacks, is there a way to use voice instead of sound or music?

#3 Post by Njjeppson » Fri Nov 06, 2020 1:05 pm

gas wrote:
Fri Nov 06, 2020 12:31 pm
Specify the channel in the function.
renpy.sound.play("blablabla.wav", channel = "voice")
Just tried it. No errors show up, which is a good sign, but now the text bleeps aren't playing anymore. It's just silent. Is there anything else I should change to fix this?

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: When implementing text bleeps by using character callbacks, is there a way to use voice instead of sound or music?

#4 Post by gas » Fri Nov 06, 2020 1:22 pm

so, try
renpy.voice("balbalbla.wav")
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

Njjeppson
Newbie
Posts: 8
Joined: Tue Jun 30, 2020 4:29 pm
Contact:

Re: When implementing text bleeps by using character callbacks, is there a way to use voice instead of sound or music?

#5 Post by Njjeppson » Fri Nov 06, 2020 2:41 pm

gas wrote:
Fri Nov 06, 2020 1:22 pm
so, try
renpy.voice("balbalbla.wav")
When I try that I'm given an error:
"AttributeError: 'module' object has no attribute 'voice'"

User avatar
RicharDann
Veteran
Posts: 284
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: When implementing text bleeps by using character callbacks, is there a way to use voice instead of sound or music?

#6 Post by RicharDann » Fri Nov 06, 2020 3:34 pm

I'm unable to test this out right now, but you could try creating a new channel.

Code: Select all

init python: 
    # add this line before beepy_voice function
    renpy.music.register_channel(name='beeps', mixer='voice')
And in the function use

Code: Select all

renpy.sound.play("beeps.ogg", channel='beeps')
https://www.renpy.org/doc/html/audio.ht ... er_channel
The most important step is always the next one.

Njjeppson
Newbie
Posts: 8
Joined: Tue Jun 30, 2020 4:29 pm
Contact:

Re: When implementing text bleeps by using character callbacks, is there a way to use voice instead of sound or music?

#7 Post by Njjeppson » Fri Nov 06, 2020 3:54 pm

RicharDann wrote:
Fri Nov 06, 2020 3:34 pm
I'm unable to test this out right now, but you could try creating a new channel.

Code: Select all

init python: 
    # add this line before beepy_voice function
    renpy.music.register_channel(name='beeps', mixer='voice')
And in the function use

Code: Select all

renpy.sound.play("beeps.ogg", channel='beeps')
https://www.renpy.org/doc/html/audio.ht ... er_channel
It works! The only problem is that now the beeping doesn't stop when the text is finished typing. It just keeps going.

Edit: Nevermind, fixed it by changing the "renpy.sound.stop()" code to say "renpy.sound.stop(channel='beeps')". Thanks!

Post Reply

Who is online

Users browsing this forum: Bing [Bot]