I was looking through Clannad's(Which is a Visual Novel made by Visual Art's/Key)gameexe file's code and notice that they declare their music in this format:
# DSTRACK = 00000000 - 99999999 - 00269364 = "BGM01" = "BGM01"
# DSTRACK = 00000000 - 99999999 - 00297558 = "BGM02A" = "BGM02A"
# DSTRACK = 00000000 - 99999999 - 07612858 = "BGM02B" = "BGM02B"
# DSTRACK = 00000000 - 99999999 - 00000000 = "BGM02C" = "BGM02C"
# DSTRACK = 00000000 - 99999999 - 00165459 = "BGM03A" = "BGM03A"
In a manual someone made for the RealLive game Engine this is what it means
#CDTRACK = from - to - loop = "name"
Defines track name to be CD audio. from, to, and loop define the start, end, and position to return to when looping respectively; each is of the form track:m:s:ms, where track is a track on the CD, and m:s.ms defines a position in minutes, seconds, and milliseconds.
name is an arbitrary string, which is passed to music playback functions (described in 5.9.2) to operate on this track.
#DSTRACK = from - to - loop = "file" = "name"
Defines track name to be DirectSound audio, usually in the VisualArt's nwa format.
The track is taken from file; from, to, and loop define positions in that file, as in #CDTRACK, but in this case each is a single integer. (I'm not sure what the unit is.)
name has the same semantics as in #CDTRACK; it need not be related to file in any way. DirectSound music is played using the same functions as CD audio.
So with this setup you can have a music file that has an introduction in it with out creating a separate file to do so. Because it will loop back at the point to tell it to loop back to.'DSTRACK', which was the example code, uses an interger but we could set it up with using a timestamp(hh:mm:ss). Like this example:
#configure.renpycd = ("START", "FINISH", "LOOP_TO", "PATH/TO/FILE", "NAME"
configure.renpycd = ("00:00:00", "00:03:47", "00:00:04", "BGM/BGM01.ogg", "BGM01")
Then you could just treat like any other file like you would with images.
play music "BGM01"
Just an idea I had for future features that could help improve Ren Py' system. What do you guy think about it?