BGM loop suggestion

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
OdysseyStudio
Regular
Posts: 94
Joined: Wed Oct 20, 2010 12:34 am
Location: Spokane, WA
Contact:

BGM loop suggestion

#1 Post by OdysseyStudio »

I've been Playing Clannad, which was on of the games that got me to want to create my own Visual Novels, for the past few weeks, and I noticed how Key loops their BGM music by overlapping or by cross-fading the audio files to make it sound like a loop. I did a little playing around with one of the BGM audio file in Audacity to see if my theory was correct and it is. So, I was wondering if Ren Py' audio code could do the same thing, by overlaping or cross-fading music to make it sound looped. And if not could it be done with Ren Py'. The advantage of this is that if you would not have to make a separate introduction music file, and queue you main BGM loop music in all the time. Plus less music files to keep track of as well, making progammers a bit more happy. ^^

I have and example Audio clip form the clannad game to show what I mean. You'll need Audacity to read the file but that could help illustrate what I am talking about.
BGM09A.zip
(16.94 MiB) Downloaded 70 times
Last edited by OdysseyStudio on Sun Jan 09, 2011 11:50 am, edited 1 time in total.
The artist's world is limitless. It can be found anywhere, far from where he lives or a few feet away. It is always on his doorstep.
--Paul Strand

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: BGM loop suggestion

#2 Post by Aleema »

I'd die of happiness if this could be done. I've been doing it manually in my own audio editor, and I have to sacrifice a good opening to the song sometimes to get that overlap endless feeling. Not sure about Clannad, never played it, but I figured this out on my own: take the file you want to loop, chop off the ending or beginning, move it to the opposite end and either fade it in or out. Instant seaming background sound. For music, it takes a bit more attention to the individual songs.

yummy
Miko-Class Veteran
Posts: 733
Joined: Fri Jul 07, 2006 9:58 pm
Projects: Suna to Majo
Location: France
Contact:

Re: BGM loop suggestion

#3 Post by yummy »

Yup, usually, the workaround is to chop your file into multiple parts, one being the intro, then the looping parts which will loop endlessly.
The other workaround would be to put two audio files, playing on different sound channels, with blank fillers in between.

IceD
Veteran
Posts: 433
Joined: Sun Feb 01, 2009 6:15 pm
Contact:

Re: BGM loop suggestion

#4 Post by IceD »

yummy wrote:Yup, usually, the workaround is to chop your file into multiple parts, one being the intro, then the looping parts which will loop endlessly.
The other workaround would be to put two audio files, playing on different sound channels, with blank fillers in between.
Actually, I remember playing few visual novels that had elaborate soundtracks, than didn't seem to be your usual one-piece files. After meedling a bit with the game's archieves you could see them as a whole bunch of small chunks that are then played and manually sequenced within the game code in a proper order. It's just a matter of a clever music composition and using such parts in this kind of way would be possible as it is now in Ren'Py without any problems. Many games use such music playing systems, because it enables to create a more atmospheric feeling and allows the music to change dynamically in-game using various variables.

The other way would be to program a code in Python that would manage to split the music file into parts (by looking up to the time), and then replay them. I'm sure this would be somehow possible with a bit of external coding.

As far as I can remember, most of the tracker music formats, such as .mod, .it, .xm and .s3m uses a clever way to play the music. While the normal files are digitally-encoded sound files, tracked music files are composed of bits called sound samples and instruments that are split over different tracks and music patterns along with tempo, notes and effects that tell the sequencer how to play them. Then, everything is played via the so-known master list. It was quite interesting, because you could leave some options that told the sequencer to replay some of the patterns few times before the music would progress, or even add some additional ones after the song ends, allowing the whole file to be practically a bunch of few music pieces tied together with same samples (allowing to create rearrangements). Many older games (such as Unreal) used those formats because of that (they were also small in filesize and didn't need a lot of processing power.

On the other side, it would be interesting to see a plugin for Ren'Py that would allow to play mod's and manage some of their basic functions, but I remember PyTom said once that it would be propably too much work to get it running, and the results would be impractical compared to using modern file formats, such as .ogg or .mp3. The downside to tracked music is that most of them sound quite synthetic (most of them run on 8bit file samples) and there's a limit on how much patterns and loops you can use. While it is possible to create high quality music on screamtracker or even protracker, those programs are plain old and would have to use some really HQ music samples, which are quite big (600kb-1,2mb, 1,5 mb filesizes) and make everything nonsense (these music types were created mainly for the purpose of having quite long music pieces that are small in filesize). People were able to squeze a decent sounding 3:45-5 minute long music into 300-600kb, while the same file encoded as a sound in an .mp3 or .ogg would have a filesize of at least 3-5 megabytes in 128 kbps and having a higher quality even doubles their filesize. Anyway, it's good when you want to have an real retro-feel to your game (almost every old game, starting from C64 had simple tracked music, it was only after modern PC's were born enabling to use a more rich and powerful sound encoding.

Those that are interested in tracking music nowadays with good results, can take a look at Madtracker. It's the most modern and powerful music tracker and while the basics of it's working principles remain the same as his older counterparts, it can use high quality sound samples and instruments and make use of VST plugins, enabling the composer to create music no different in quality from those created on other kinds of music sequencers. It's a good beggining to those, who want to start with music composing.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: BGM loop suggestion

#5 Post by PyTom »

We actually supported .mod for quite some time. Years, at least. Nobody used that support in well over 100 games. When I rewrote the sound code, I switched to using ffmpeg directly, which eliminated mod playback support in favor of adding support for more modern video formats.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
OdysseyStudio
Regular
Posts: 94
Joined: Wed Oct 20, 2010 12:34 am
Location: Spokane, WA
Contact:

Re: BGM loop suggestion

#6 Post by OdysseyStudio »

yummy wrote:Yup, usually, the workaround is to chop your file into multiple parts, one being the intro, then the looping parts which will loop endlessly.
The other workaround would be to put two audio files, playing on different sound channels, with blank fillers in between.
These are good workarounds, but thats what I want to avoid. It just basically putting pointless blank files or intro files into the game. I'm thinking on the behalf of those music composer such as some from companies such as KEY whom have the skill to basically intertwine the introduction of those loop pieces into each other to create a seamless BGM music loop for any games. I'm just suggesting to just add a cross-fade keyword into the Audio division of the Ren Py'. One, it will help transition from one music piece to another or if you are looping it, having it cross-fade the ending with the intro again to create a seamless loop. Two, it will give the music composer more freedom to create his music by like what key dose, making the introduction actually fit in towards the end of the piece of loop music(look at the file I posted to understand what I mean). Three, it help with the programmer (like me) cause he won't have to worry with intro gose to which piece of music loop or having to do the workaround as the suggestions earlier, so less files to worry about. And Finally, Four, I think PyTom would like if some company whom makes Visual Novels, such as key, would feel comfortable to using Ren Py' as the game engine for their Novel. With it having compatibility with four OS platforms such as Mac, Linux, Windows, and now, Android it would definitely give it's some leeway. And also it being able to being localized into may languages helps. Plus with the Major Gaming consoles being somewhat compatible with Linux, or Windows this would definitely give it a chance for one day, one company, would take this 6-7 year project, that PyTom and others put into this to become a worthy Visual Novel game engine to be reckoned with.
The artist's world is limitless. It can be found anywhere, far from where he lives or a few feet away. It is always on his doorstep.
--Paul Strand

Post Reply

Who is online

Users browsing this forum: No registered users