Making typing sounds compatible with automatic pauses
Posted: Sat Oct 22, 2022 9:06 pm
Hi everyone! So theres two codes ive found that im using rn, one is to make sounds when the text comes up on screen (think pheonix wright) and one is to create automatic pauses when theres commas and periods.
The only problem is the sound continues during pauses, which creates a weird effect. Obviously something needs to change... but i dont know what to do. any help is appreciated
The only problem is the sound continues during pauses, which creates a weird effect. Obviously something needs to change... but i dont know what to do. any help is appreciated
Code: Select all
# Text Sound system
init python:
def A1Voice(event, interact=True, **kwargs):
if not interact:
return
if event == "show_done":
renpy.sound.play("audio/A1.ogg",loop=True)
elif event == "slow_done":
renpy.sound.stop()
Code: Select all
#Text Speed system
init python:
def slow_punctuation(str_to_test):
str_to_test = str_to_test
return str_to_test.replace(
", ", ",{cps=3} {/cps}").replace(
"... ", "...{cps=1.3} {/cps}").replace(
". ", ".{cps=2} {/cps}").replace(
"! ", "!{cps=2} {/cps}").replace(
"? ", "?{cps=2} {/cps}").replace(
"St.{cps=2} {/cps}", "St. ").replace(
"Mr.{cps=2} {/cps}", "Mr. ").replace(
"Ms.{cps=2} {/cps}", "Ms. ").replace(
"Mx.{cps=2} {/cps}", "Mx. ").replace(
"Dr.{cps=2} {/cps}", "Dr. ")
config.say_menu_text_filter = slow_punctuation