Voice audio versus the wait tag

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
HEXdidnt
Regular
Posts: 63
Joined: Tue Aug 11, 2020 1:25 pm
Projects: A Night at the Office, Embracing Christmas, The Masquerade Benefit
Deviantart: HEXdidnt
Location: Harrow, London, UK
Contact:

Voice audio versus the wait tag

#1 Post by HEXdidnt »

Just for the sake of my own amusement*, I've tried adding a voiceover to one of my projects. Recorded a set of audio clips on my phone, converted them from .M4A to .MP3, added them in to the game's script using voice ahead of each line of equivalent text, and it all works fine until it hits the wait tag.
For example:

Code: Select all

voice "narration001.mp3"
"Nothing can prepare you for... {w=0.75}my dramatic pause!"
The audio plays all the way through, but when the text hits that wait tag, it stops dead until the voice clip ends (far longer than three quarters of a second!), then waits the 0.75s before running through to the end as if nothing has happened.

My first instinct was to add an {nw} tag ahead of the wait tag, but that results in the {nw} triggering at the end of the text, so it immediately skips on to the next section of voice/text.

Surely there's a way to ensure the text plays out as intended, alongside the voiceover, regardless of these wait tags? Am I missing something blindingly obvious?

Tried searching the forum, but it keeps throwing up an error message for me today...

(* I say my own amusement... I demonstrated the voiceover to my GF late last night, and she didn't recognise that it was me because of the voice I'd put on. She then realised this was why I had asked about her dictating machine a few days ago)
Last edited by HEXdidnt on Thu Jan 25, 2024 5:06 am, edited 2 times in total.
As ever, dropping litter in the zen garden of your mind...

User avatar
HEXdidnt
Regular
Posts: 63
Joined: Tue Aug 11, 2020 1:25 pm
Projects: A Night at the Office, Embracing Christmas, The Masquerade Benefit
Deviantart: HEXdidnt
Location: Harrow, London, UK
Contact:

Re: Voice audio versus the wait tag

#2 Post by HEXdidnt »

Further to the above, having located information on voice sustain, I tried breaking the dialogue into two sections with an {nw} tag at the end of the first, followed by extend ahead of the next. No matter where I put the wait tag - before or after the break - the text grinds to a halt at that point, and only completes once the voice clip has ended, or if I manually force the matter with a click/keypress.

Stranger still, if I remove the wait tag entirely, and just have the {nw} tag between the two sections, the same thing happens.

However, if I remove the {nw} tag as well, thus requiring a click-to-continue, it works perfectly...

Is there a solution other than the obvious: editing the voice file into two parts, to play either side of the wait tag within the text?
As ever, dropping litter in the zen garden of your mind...


User avatar
HEXdidnt
Regular
Posts: 63
Joined: Tue Aug 11, 2020 1:25 pm
Projects: A Night at the Office, Embracing Christmas, The Masquerade Benefit
Deviantart: HEXdidnt
Location: Harrow, London, UK
Contact:

Re: Voice audio versus the wait tag

#4 Post by HEXdidnt »

jeffster wrote: Wed Oct 06, 2021 12:31 pm What about
https://www.renpy.org/doc/html/config.h ... _callbacks
...OK, yes, that appears to be exactly what I'm looking for, thank you, Jeffster!..

Do you happen to have any links to examples of how one makes use of this? Where it goes in the code? What the variables are?

The absolute absence of context is - consistently - the biggest stumbling block I have with the Ren'Py documentation. A search for this option on this forum yields your post, and one other, from 2006... which has gone unanswered. Elsewhere, I can see further confirmation that this option exists but, as yet, not how to make use of it.
As ever, dropping litter in the zen garden of your mind...

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Voice audio versus the wait tag

#5 Post by PyTom »

This feels like it's something I should be dealing with at the engine level.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

jeffster
Veteran
Posts: 409
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Voice audio versus the wait tag

#6 Post by jeffster »

Is there some merit in trying something like this:

Code: Select all

init python:
    config.say_sustain_callbacks.append(my_text_paused)

    def my_text_paused():
        # Try to play with various actions like:
        voice_sustain()
        # or maybe:
        renpy.music.set_pause(True, channel = 'voice')
        # in order to resume after the pause by some kind of timer?..
https://www.renpy.org/doc/html/audio.html

User avatar
HEXdidnt
Regular
Posts: 63
Joined: Tue Aug 11, 2020 1:25 pm
Projects: A Night at the Office, Embracing Christmas, The Masquerade Benefit
Deviantart: HEXdidnt
Location: Harrow, London, UK
Contact:

Re: Voice audio versus the wait tag

#7 Post by HEXdidnt »

PyTom wrote: Wed Oct 06, 2021 5:28 pm This feels like it's something I should be dealing with at the engine level.
It did strike me as a very odd issue, all things considered - if it can be added to your list, please, I'm sure I won't be the only one here who'd appreciate it!

jeffster wrote: Wed Oct 06, 2021 5:34 pm Is there some merit in trying something like this:
Will give that a try - thank you, Jeffster.
As ever, dropping litter in the zen garden of your mind...

User avatar
HEXdidnt
Regular
Posts: 63
Joined: Tue Aug 11, 2020 1:25 pm
Projects: A Night at the Office, Embracing Christmas, The Masquerade Benefit
Deviantart: HEXdidnt
Location: Harrow, London, UK
Contact:

Re: Voice audio versus the wait tag

#8 Post by HEXdidnt »

No luck with the code suggested by Jeffster, but I have found a kind of workaround. Where I originally had:

Code: Select all

voice "narration001.mp3"
"Nothing can prepare you for... {w=0.75}my dramatic pause!"
I've substituted the following:

Code: Select all

voice "narration001.mp3"
"Nothing can prepare you for{cps=2}... {/cps}my dramatic pause!"
It works a little differently - simply slowing the output of a few characters' worth of text rather than pausing it briefly at a set point - but it works. It looks alright with an ellipsis, but if I want a brief pause after a comma or a colon, that looks very weird. Not ideal, but it'll do for the time being.

The only instance where this doesn't work at all is where I break the text with a {nw} tag, so that I can change the character's expression mid-dialogue. At that point, the problem occurs as before: the text stops dead at the {nw} tag, the voice file carries on till its end, and only then does the sprite update and the text complete.
As ever, dropping litter in the zen garden of your mind...

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Voice audio versus the wait tag

#9 Post by PyTom »

This should be fixed as of Ren'Py 7.4.9.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
HEXdidnt
Regular
Posts: 63
Joined: Tue Aug 11, 2020 1:25 pm
Projects: A Night at the Office, Embracing Christmas, The Masquerade Benefit
Deviantart: HEXdidnt
Location: Harrow, London, UK
Contact:

Re: Voice audio versus the wait tag

#10 Post by HEXdidnt »

Coincidentally, I'd updated to 7.4.9.2142 during the day yesterday, ahead of my post. The issue appears to remain where text is paused with the {w} tag, and where I used the {nw} tag to make changes in a sprite mid-dialogue, followed by an extend to continue the text.

However, just this morning, I though to try with the {p} tag instead, and that is unaffected by this glitch: text display continues after the specified delay, just on a new line. Odd that it affects only one of these two functionally very similar tags.

EDIT: Also, out of sheer bloody-mindedness, I tried adding the voiceover using play sound instead of voice: the text displays exactly as intended, pausing for the specified period, then carrying on rather than waiting for the voiceover to finish.
As ever, dropping litter in the zen garden of your mind...

User avatar
HEXdidnt
Regular
Posts: 63
Joined: Tue Aug 11, 2020 1:25 pm
Projects: A Night at the Office, Embracing Christmas, The Masquerade Benefit
Deviantart: HEXdidnt
Location: Harrow, London, UK
Contact:

Re: Voice audio versus the wait tag

#11 Post by HEXdidnt »

Another, possibly related symptom:
I started removing the # from all the voice lines and switching to play sound wherever I'd added a {w} tag or broken a line for sprite animation purposes, and all that's now working smoothly.

But then there's a point where I show a bunch of new sprites after initiating one of the later voice lines... but the voiceover doesn't start until after the last of the sprites has appeared, even though the voice line is above the show lines in my code.

So I switched that one to play sound as well, and that does as expected now: the voiceover starts, the sprites start appearing, the text appears once all the sprites are present.

Something odd about the priorities, there?
As ever, dropping litter in the zen garden of your mind...

User avatar
HEXdidnt
Regular
Posts: 63
Joined: Tue Aug 11, 2020 1:25 pm
Projects: A Night at the Office, Embracing Christmas, The Masquerade Benefit
Deviantart: HEXdidnt
Location: Harrow, London, UK
Contact:

Re: [Solved] Voice audio versus the wait tag

#12 Post by HEXdidnt »

Following PyTom's announcement of 7.4.10, I've downloaded the latest release and retried with all the voice lines activated with voice rather than play sound, all the {w=...} and {nw} tags put back in, and it's all working as expected. Great stuff!
As ever, dropping litter in the zen garden of your mind...

User avatar
HEXdidnt
Regular
Posts: 63
Joined: Tue Aug 11, 2020 1:25 pm
Projects: A Night at the Office, Embracing Christmas, The Masquerade Benefit
Deviantart: HEXdidnt
Location: Harrow, London, UK
Contact:

Re: [Solved] Voice audio versus the wait tag

#13 Post by HEXdidnt »

PyTom wrote: Sun Oct 17, 2021 8:11 pm This should be fixed as of Ren'Py 7.4.9.
I've been experimenting with v8.1.3 today, and this issue has crept back in - anytime I break dialogue with a {nw} tag, then continue with extend, the text stops dead until the voice line finishes.

EDIT: As before, switching from voice to play sound fixes the issue.
EDIT 2: problem is also present in v7.6.3
Last edited by HEXdidnt on Wed Jan 24, 2024 6:01 pm, edited 1 time in total.
As ever, dropping litter in the zen garden of your mind...

User avatar
Andredron
Miko-Class Veteran
Posts: 719
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: [Solved] Voice audio versus the wait tag

#14 Post by Andredron »

I must have added a lot of headache to Mr. Python with my exact lip sync for the port of the novel sisters the last day of summer, viewtopic.php?t=65773 when before only nw was, (that then he had to modernize the tag nw=0.5 ) then the plugin rhubarb, and there were problems with the tag.....

Post Reply

Who is online

Users browsing this forum: Bing [Bot]