Automatic directories for audio in Ren'Py

  1. # No code yet, may add later

This is an idea I had for Ren'Py, which saves visual novel developers from having to type out a complete path for any music, sound or voice files they want to play in their project. If implemented, it will make for less cluttered project directories and less redundancy in play and queue statements.

config.audio_add_channel_dir = False | True
When True, Ren'Py will automatically prepend the name of the audio channel being used to the names of any sound files in a play or queue statement. For example, play music "foo.ogg" will play music/foo.ogg on channel music. False will cause Ren'Py to act as it historically has.
config.audio_base_dir = Null | "value"
When set, Ren'Py will prepend the value to the name of any sound files in a play or queue statement, before a channel name if audio_add_channel_dir is on. For example, with audio_base_dir set to audio, play music "foo.ogg" will play audio/music/foo.ogg if audio_add_channel_dir is True, or audio/foo.ogg if False.

As it is, it is possible to get this behaviour out of Ren'Py right now via the user-defined statements capability; however, it will require alternate statement names as you cannot remove or redefine play or queue through the renpy.statements interface (AFAIK). You can edit common/00statements.rpy (where the statements are defined) but at the risk of losing your work with the next release of Ren'Py.

What's missing:

  • Absolute naming. There should be a way to opt out of this scheme for particular files, that is, have Ren'Py not append directory names when you don't want it to. I would suggest starting the string containing the sound file's name with the directory separator (i.e. "/") and have Ren'Py avoid the magic when it's caught. play music "/foo.ogg" would play foo.ogg regardless of audio_add_channel_dir and audio_base_dir settings.
  • Voice language support. I don't even bother with voicing, so I can't answer this one. But it's something to think about, all the same.