In another .rpy file, I have a dictionary that maps character names (the string that is used for the cb_name parameter when defining a Character) to the path of their respective bleep files, which looks something like this:
## name_callback in game/00auto-highlight.rpy uses this dictionary ## to determine what bleeps to use per character define bleeps_dict = {"ss" : "audio/bleep023.ogg", "vl" : "audio/bleep003.ogg", "ap" : "audio/bleep006.ogg"}
And in 00auto-highlight.rpy, I tweaked the name_callback function to look like this (please note that I defined a separate audio channel just for text bleeps):
def name_callback(event, interact=True, name=None, **kwargs): global speaking_char if event == "begin": speaking_char = name ## text bleeps if name in bleeps_dict: if event == "show": renpy.music.play(bleeps_dict[name], channel="bleeps", loop=True) elif event == "slow_done" or event == "end": renpy.music.stop(channel="bleeps", fadeout=1.0)
If there is a character who shouldn't use bleeps (I defined a separate Character object for my MC's thoughts, for example), then the "if name in bleeps_dict" line above can be changed to something like:
if name in bleeps_dict and name != "name_of_silent_character":
If there are several character who don't speak, it might be easier to define a list of names of silent characters and then use "...and name not in silent_characters".
I think this is all I needed to do. If you have any issues, please feel free to let me know!! ♡
(Also I'm really sorry if the code formatting above is a bit nasty to read with the indentations)