Page 1 of 1

Spreading an audio file across several lines

Posted: Thu Dec 08, 2022 1:45 am
by Kaji
One of the stories in my current project is about someone with a ridiculously long name. While later on it gets stated all at once as part of the gag, when the name first appears in its full form we've got a bit of buildup with the name displayed in segments that get attached to the displayed text with each line.

For example:

Code: Select all

voice "full_name.ogg"
e "[segment1]"
e "[segment1][segment2]"
e "[segment1][segment2][segment3]"
e "[segment1][segment2][segment3][segment4]"
While playing it as a sound effect *could* achieve this effect, that has a couple of drawbacks:
  • It probably won't play well with translation
  • It puts voice in the SFX channel, meaning it plays with volumes
  • The line might end up overlapping the next actual voice segment if the user skips through the relevant lines
Is there a way to achieve this? I *could* break it up into separate files for each segment during that part if absolutely necessary, but I feel that'd really take away from the effect and energy of the performance...

Re: Spreading an audio file across several lines

Posted: Thu Dec 08, 2022 11:28 pm
by Imperf3kt
I can't offer you a solution for the audio file off the top of my head, but for your text, you should really consider using extend
https://www.renpy.org/doc/html/dialogue ... characters
As a bonus, you could play audio in between each section of dialogue in the same way you outlined in your opening post

Re: Spreading an audio file across several lines

Posted: Fri Dec 09, 2022 4:45 pm
by Tess
There's a python module named Pydub (https://pypi.org/project/pydub/) that allows you to manipulate audio in a number of different ways.

I looked online to find tutorials for splitting audio and didn't find anything that obviously does what you want it to do, but I still think it could be a good place to start experimenting.

Re: Spreading an audio file across several lines

Posted: Fri Dec 09, 2022 7:22 pm
by Kaji
Thank you both for the ideas! The extend keyword is particularly helpful—allowed me to do a *lot* to simplify that bit of the script. Will take a look at that dub module as well!