Spreading an audio file across several lines

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
Kaji
Regular
Posts: 87
Joined: Thu Nov 17, 2022 10:17 pm
Github: Kaji01
Discord: Kaji#7767
Contact:

Spreading an audio file across several lines

#1 Post 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...

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Spreading an audio file across several lines

#2 Post 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
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Tess
Regular
Posts: 58
Joined: Thu Aug 04, 2022 3:43 pm
Projects: The Songbird Guild
Organization: Yurisoft
Github: wainwt2
Discord: Tess#7782
Contact:

Re: Spreading an audio file across several lines

#3 Post 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.

User avatar
Kaji
Regular
Posts: 87
Joined: Thu Nov 17, 2022 10:17 pm
Github: Kaji01
Discord: Kaji#7767
Contact:

Re: Spreading an audio file across several lines

#4 Post 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!

Post Reply

Who is online

Users browsing this forum: Google [Bot]