Can we play sound loop when textbox is showing text?

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
YuanlinLi
Regular
Posts: 109
Joined: Sat Aug 04, 2018 8:42 pm
Location: Hong Kong
Contact:

Can we play sound loop when textbox is showing text?

#1 Post by YuanlinLi »

Once text is fully showed, stop sound effect.
stay hungry,stay foolish.

User avatar
jeffster
Miko-Class Veteran
Posts: 888
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Can we play sound loop when textbox is showing text?

#2 Post by jeffster »

Yes, but maybe 99% of people don't like "teletype" text.
In general, dialog phrases should be shown instantly.

"Slow typing" makes sense only in rare particular cases, as a kind of special effect.

With that in mind, one of the ways to do that is:

Code: Select all

label reveal_inscription:
    play sound "bubbles.opus" loop
    slow "This is the phrase accompanied by looping sound.{nw}"
    stop sound
    extend ""
(1) You start playing sound (in a loop)
(2) You show dialog with {nw} at the end. It means not wait for the user input but immediately go on further.
(3) Then you stop sound and use "extend" to finish the dialog interaction. See
https://renpy.org/doc/html/dialogue.htm ... characters

Audio (play, stop) see
https://renpy.org/doc/html/audio.html#play-statement
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1198
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Can we play sound loop when textbox is showing text?

#3 Post by m_from_space »

jeffster wrote: Sun Mar 03, 2024 4:15 am "Slow typing" makes sense only in rare particular cases, as a kind of special effect.
Not sure why you would say that. Instant text gives a very different feel than typed text. I prefer typed text - as long as we're not talking about some kind of phone vn using a messenger app.
Li yuanlin wrote: Sat Mar 02, 2024 1:05 pm Once text is fully showed, stop sound effect.
You can simply use the "all character callback" event.

Code: Select all

init python:
    def sound_callback_for_all(event, interact=True, **kwargs):
        if not interact:
            return
        if event == "begin":
            # let's use the "audio" channel, so other music isn't stopped
            renpy.music.play("audio/mysound.ogg", channel="audio", loop=True)
        elif event == "slow_done":
            renpy.music.stop(channel="audio")
        return
       
define config.all_character_callbacks = [sound_callback_for_all]

User avatar
jeffster
Miko-Class Veteran
Posts: 888
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Can we play sound loop when textbox is showing text?

#4 Post by jeffster »

m_from_space wrote: Sun Mar 03, 2024 5:38 am
jeffster wrote: Sun Mar 03, 2024 4:15 am "Slow typing" makes sense only in rare particular cases, as a kind of special effect.
Not sure why you would say that. Instant text gives a very different feel than typed text. I prefer typed text
Because I want to receive and process the text, instantly, rather than feel its process of appearance.

There are other elements to give the perception feel: the text meaning and wording, the visual and audio contents etc.
I prefer typed text
If you conduct a poll, I bet that vast majority would prefer the ability to see the text instantly, rather than waiting for it to come. To me that would be hindering and distracting from my smooth perception process.
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1198
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Can we play sound loop when textbox is showing text?

#5 Post by m_from_space »

jeffster wrote: Mon Mar 04, 2024 9:18 amIf you conduct a poll, I bet that vast majority would prefer the ability to see the text instantly, rather than waiting for it to come. To me that would be hindering and distracting from my smooth perception process.
There is difference between "waiting for a text to come" (meaning the cps value is too low, meaning you're reading faster than the text appears) and a cps that's suitable for your reading speed. So of course there should always be an option to alter cps. Not sure about the outcome of a poll, but I guess there are many people out there who don't even bother reading, because they want to get to the nude parts of some eroge or they don't have the attention span. I mean it's the age of TikTok.

User avatar
jeffster
Miko-Class Veteran
Posts: 888
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Can we play sound loop when textbox is showing text?

#6 Post by jeffster »

m_from_space wrote: Mon Mar 04, 2024 4:02 pm
jeffster wrote: Mon Mar 04, 2024 9:18 amIf you conduct a poll, I bet that vast majority would prefer the ability to see the text instantly, rather than waiting for it to come. To me that would be hindering and distracting from my smooth perception process.
There is difference between "waiting for a text to come" (meaning the cps value is too low, meaning you're reading faster than the text appears) and a cps that's suitable for your reading speed. So of course there should always be an option to alter cps. Not sure about the outcome of a poll, but I guess there are many people out there who don't even bother reading, because they want to get to the nude parts of some eroge or they don't have the attention span. I mean it's the age of TikTok.
Reading process is actually not just getting first letter, then the second letter... It's more complex than that and involves recognition of whole words. As an expeirment, it was proven that people often don't notice if two or more symbols swapped positions in a word.
So yeah, thank you for the compliment, but indeed I read fast and have little tolerance for impediments, especially introduced artificially. And whatever you call this age, the amount of information I need to read (or sometimes just skim through) creates a habit of reading fast.
That's how we modern kids do nowadays. :-)
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1198
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Can we play sound loop when textbox is showing text?

#7 Post by m_from_space »

jeffster wrote: Tue Mar 05, 2024 6:07 am Reading process is actually not just getting first letter, then the second letter... It's more complex than that and involves recognition of whole words. As an expeirment, it was proven that people often don't notice if two or more symbols swapped positions in a word.
Yeah, in fact you can actually scramble all letters between a word's first and last letter and people will be able to read it. Reading is like recognizing faces: you don't have to think about it. Unless you encounter a new word or a foreign language.

User avatar
jeffster
Miko-Class Veteran
Posts: 888
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Can we play sound loop when textbox is showing text?

#8 Post by jeffster »

m_from_space wrote: Tue Mar 05, 2024 1:30 pm
jeffster wrote: Tue Mar 05, 2024 6:07 am Reading process is actually not just getting first letter, then the second letter... It's more complex than that and involves recognition of whole words. As an expeirment, it was proven that people often don't notice if two or more symbols swapped positions in a word.
Yeah, in fact you can actually scramble all letters between a word's first and last letter and people will be able to read it. Reading is like recognizing faces: you don't have to think about it. Unless you encounter a new word or a foreign language.
Yeah, and you can understand why, if symbols appear one by one, it can be almost irritating, even if relatively fast. (But slow enough to need a sound loop of variable length)...
And even if whole words appear one by one, I can feel it as some impediment, because normally looking at text we see the structure, placement of words of various lengths; short words might be recognized even before we read long ones... I mean, I didn't do a scientific research on that (hence can't say with 100% certainty), but that's how I feel. For comfortable reading I want the whole chunk of text, and no distraction from moving line of visibility etc. The artsy experience can be created by other visual elements: UI, scene etc.
People are different, it's just my view on the topic and why I think that probably the majority wouldn't enjoy much text-delay effects. It's like with fancy fonts: often the more exotic and impressive it is, the harder it is to read in actual text (longer than just trademark or something)...
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1198
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Can we play sound loop when textbox is showing text?

#9 Post by m_from_space »

jeffster wrote: Tue Mar 05, 2024 7:28 pm People are different, it's just my view on the topic and why I think that probably the majority wouldn't enjoy much text-delay effects. It's like with fancy fonts: often the more exotic and impressive it is, the harder it is to read in actual text (longer than just trademark or something)...
Whatever your opinion, if you have not yet played it, you still might enjoy the game "Pentiment", in which script and written out text in different styles playes a huge role: https://store.steampowered.com/app/1205520/Pentiment/

Post Reply

Who is online

Users browsing this forum: No registered users