This tutorial shows how to play a looping voice bleep while Ren’Py reveals dialogue text.
Add the bleep sound
Add a bleep audio file in your game directory. For example:
game/audio/bleep.ogg
Create a dedicated audio channel
Register a custom channel in your .rpy script:
# game/script.rpy
init python:
BLEEP_CHANNEL = "bleep"
renpy.music.register_channel(BLEEP_CHANNEL, mixer="voice", loop=True)
Setting the voice mixer means the bleep follows the game’s voice-volume setting.
Enabling loop makes the sound repeat until the channel is stopped.
Using a separate channel is useful because the bleep will not interfere with background music, sound effects, or actual voice clips.
Create the dialogue callback
Add a callback function:
def voice_callback(event, **kwargs):
if event == "show_done":
renpy.music.play("audio/bleep.ogg", channel=BLEEP_CHANNEL)
elif event in ("slow_done", "end"):
renpy.music.stop(channel=BLEEP_CHANNEL, fadeout=0.2)
The callback receives events from the dialogue system:
show_donestarts the looping bleep.slow_donestops it after the text has finished appearing.endstops the bleep if the dialogue interaction ends (skipped/interrupted).
The fadeout gives the sound a smooth fade instead of cutting it off abruptly.
Attach the callback to a character
Define a character using the callback:
define e = Character("Eileen", callback=voice_callback)
Now your bleep should play:
label start:
e "This dialogue uses a looping bleep while the text appears."
e "The bleep stops when the line is complete."
return
Play a sound when dialogue is dismissed
Optionally, you can play a sound when the dialogue is dismissed:
def dismiss_callback():
renpy.sound.play("audio/click.ogg")
return True
config.say_allow_dismiss = dismiss_callback
Script
Here’s the full script:
# game/script.rpy
init python:
BLEEP_CHANNEL = "bleep"
renpy.music.register_channel(BLEEP_CHANNEL, mixer="voice", loop=True)
def voice_callback(event, **kwargs):
if event == "show_done":
renpy.music.play("audio/bleep.ogg", channel=BLEEP_CHANNEL)
elif event in ("slow_done", "end"):
renpy.music.stop(channel=BLEEP_CHANNEL, fadeout=0.2)
def dismiss_callback():
renpy.sound.play("audio/click.ogg")
return True
config.say_allow_dismiss = dismiss_callback
define e = Character("Eileen", callback=voice_callback)