Optimizing music?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Karrion
Regular
Posts: 59
Joined: Fri Jan 18, 2019 8:33 pm
Projects: Murder on the Marine Express
Organization: 1564 Studio
itch: 1564-studio
Contact:

Optimizing music?

#1 Post by Karrion » Sun May 09, 2021 2:33 pm

Right now the music of our project is like 90% of the size of it. I know there is a thread for optimizing images and was very useful for reducing the size of those, but couldn't find a similar thread for music. One of the problems we have is that we have to have multiple loops in the music files due to now being able to have seamless loops (we don't know how to use audacity or similar, out composer uses Maestro to compose). Is there an easy way to solve this?
1564 Studio, an indie studio dedicated to developing mystery VNs!
Follow us on Twitter for updates on our projects!

Image

Check out our current project, with a demo out now!

Image

User avatar
emz911
Regular
Posts: 88
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: Optimizing music?

#2 Post by emz911 » Sun May 09, 2021 3:21 pm

First advice would be to convert all your audio into .ogg format.
For the loops, it sounds like you are manually looping several songs into one file, which is not recommended at all because that would create huge file sizes. I’d say separate all of them, have a single file for a single song, and play/loop them within your Renpy scripts. For a single song:

Code: Select all

play music "songname.ogg"
And that would loop the song forever by default, until you tell it to stop.
You can also make music fade in or out to make good transitions:

Code: Select all

play music "songname.ogg" fadeout 2.0 fadein 2.0
If you want different songs to automatically play one after another, do:

Code: Select all

 play music [ "a.ogg", "b.ogg" ] fadeout 1.0 fadein 1.0
Maybe even use the queue function for more control. Everything is documented here: https://www.renpy.org/doc/html/audio.html

User avatar
Karrion
Regular
Posts: 59
Joined: Fri Jan 18, 2019 8:33 pm
Projects: Murder on the Marine Express
Organization: 1564 Studio
itch: 1564-studio
Contact:

Re: Optimizing music?

#3 Post by Karrion » Sun May 09, 2021 3:28 pm

We tried using fadeins and fadeouts and all kinds of control but it always leaves like a half second of silence. I tried with tighten in the channel settings and the like to no avail. What I saw is that the best way to produce seamless loops is using sound programs like Audacity, Fruit Loops, and the like, but no tutorial for people with no idea. Also, we are already using .ogg.
1564 Studio, an indie studio dedicated to developing mystery VNs!
Follow us on Twitter for updates on our projects!

Image

Check out our current project, with a demo out now!

Image

User avatar
emz911
Regular
Posts: 88
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: Optimizing music?

#4 Post by emz911 » Sun May 09, 2021 4:56 pm

I think the seconds of silence are from your original soundtracks, try trimming the beginning and end of them so that they immediately play and end.
You can also look up "crossfade," there are a couple forums that talk about this, which might be what you want, though a bit more complicated than what I had:
viewtopic.php?t=45204
viewtopic.php?t=42418

User avatar
qirien
Miko-Class Veteran
Posts: 527
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

Re: Optimizing music?

#5 Post by qirien » Mon May 10, 2021 11:50 am

When you export your OGG files, you can choose the quality with a slider. Lower quality will not sound quite as good, but will be a smaller file size.
Finished games:
Image
Image
Image
In progress: Our Personal Space 2: Space to Grow

Post Reply

Who is online

Users browsing this forum: Google [Bot]