Ren'Py Universal Player - A Improved Music Room Screen

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
GanstaKingofSA
Newbie
Posts: 4
Joined: Mon May 10, 2021 1:33 pm
Github: GanstaKingofSA
Contact:

Ren'Py Universal Player - A Improved Music Room Screen

#1 Post by GanstaKingofSA » Tue May 11, 2021 2:45 pm

Hi everyone!

I released this a bit ago on the Ren'Py Discord, but never had the chance to post it here so here it is! I'm proud to present to you all Ren'Py Universal Player!
Ren'Py Universal Player is a improved music room that allows users to play your projects' soundtrack outside of the game's story along with any other music the user would add to a track specific folder.

Features:
  • MP3 and OGG Playback from a folder, RPA, and APK!
Sadly I don't have a Mac to test iOS but if anyone does want to do so, you are free to do so and give feedback!
  • Metadata support for tracks.
  • Music Player controls.
  • Dynamic Font Scaling for Titles (somewhat).
  • Sorting support.
and more to come!
Ren'Py Universal Player's UI code in screens.rpy and gui.rpy is based off the Ren'Py auto-generated template. You will have to adjust this code to fit your projects' layout.
Not all song names will be able to be read by the default font, especially Japanese. Songs with a UTF-8 cover (common in iTunes) will default to a generic player cover art due to limitations.
Image
Additional screenshots can be seen here.

Download

Installation
1. Drop all the contents in this ZIP file to your projects' game folder.
2. Open screens.rpy and add this line somewhere after line 292 under the screen navigation(): block.

Code: Select all

textbutton _("Music Room") action [ShowMenu("music_room"), Stop('music', fadeout=2.0), If(preferences.get_volume("music") == 0.0, true=SetVariable("ost.music_muted", True), false=SetMute('music', True)), Function(ost.refresh_list)]
3. Open options.rpy and add this line after line 160 under the init python: block.

Code: Select all

build.classify("game/RPASongMetadata.json", "all")
4. (Optional) Add some music to the track folder.
5. Run your project and enter the Music Room!

Q/A
Q1: How do I manually define a song?
A1: manualtracks.rpy has a small template to define songs manually if you need to do so. You have the following options to define these tracks.
  • name | Name of Track
  • full_name | Full Name of Track
  • path | Path to the file from the game folder
  • priority | Priortization of track on the list.
  • author | Artist
  • description | Track description, comments, etc.
  • cover_art | Path to the track's cover art (JPG/PNG Only)
Q2: How do I priortize a song higher than another?
A2: Enable the numbered list icon in the music room and set the song priority by a value. 0 is the highest priority you can make a song be while 1, 2, etc. will be prioritzed lower in the list. i.e. 0 > 1 > 2 > ...
You may also enable this by setting organizePriority to True within ost.py.
Q3: How do I organize the list alphabetically?
A3: Enable the AZ icon in the music room or set organizeAZ to <u>True</u> within ost.py.
Q4: Why is there a python-packages folder in the ZIP file?
A4: This folder stores the python files that handle the functions of the music room player and the metadata of songs sideloaded or included in the game.
Q5: How do I add metadata info?
A5: Right-click your song, Select Properties, go to Details, and fill the blank boxes you can. Alternatively, use MusicBee or a similar music player, or MusicBrainz Picard and find your song. Refer to this for more information.
Last edited by GanstaKingofSA on Sat May 22, 2021 9:03 am, edited 2 times in total.

User avatar
Moshibit
Regular
Posts: 42
Joined: Wed Oct 16, 2019 1:58 pm
Location: Mexico
Contact:

Re: Ren'Py Universal Player - A Improved Music Room Screen

#2 Post by Moshibit » Wed May 12, 2021 3:08 pm

This is really useful. Good work, thanks.

GanstaKingofSA
Newbie
Posts: 4
Joined: Mon May 10, 2021 1:33 pm
Github: GanstaKingofSA
Contact:

Re: Ren'Py Universal Player - A Improved Music Room Screen

#3 Post by GanstaKingofSA » Tue May 18, 2021 1:38 pm

Moshibit wrote:
Wed May 12, 2021 3:08 pm
This is really useful. Good work, thanks.
Thanks! I hope to some this would be useful to expand their projects with new content. I know some people will ask, why make this if Ren'Py has it's own music room and TBH I was planning to code it in though might take a bit to import most stuff that I did in this code to it like forward and back 5 seconds, time bar adjustments, clock, etc. I am just used to this format cause I have done it in another project that uses the same code here.

GanstaKingofSA
Newbie
Posts: 4
Joined: Mon May 10, 2021 1:33 pm
Github: GanstaKingofSA
Contact:

Re: Ren'Py Universal Player - A Improved Music Room Screen

#4 Post by GanstaKingofSA » Sat May 22, 2021 8:59 am

So I just realized I derped a bit with the install instructions here compared to my actual documentation so I have updated most of it just now to reflect that. Sorry if many of y'all were trying to figure out, how to even enter it in the first place!

In good news, (even though I should probably post this more? IDK) 1.3 is out on Github for those wanting or have a existing copy to update it to that version.

User avatar
henne
Newbie
Posts: 7
Joined: Tue May 25, 2021 6:10 am
Contact:

Re: Ren'Py Universal Player - A Improved Music Room Screen

#5 Post by henne » Tue May 25, 2021 6:20 am

I tried it out for a bit, it's pretty cool :)

Maybe I am a bit stupid but what would I need to change so that it only shows songs that were already heard during the game?

GanstaKingofSA
Newbie
Posts: 4
Joined: Mon May 10, 2021 1:33 pm
Github: GanstaKingofSA
Contact:

Re: Ren'Py Universal Player - A Improved Music Room Screen

#6 Post by GanstaKingofSA » Thu May 27, 2021 12:58 pm

henne wrote:
Tue May 25, 2021 6:20 am
I tried it out for a bit, it's pretty cool :)

Maybe I am a bit stupid but what would I need to change so that it only shows songs that were already heard during the game?
I never coded any functionality to lock out songs from the player depending on playthrough though I think I can do it depending on how I code the whole check if the song will be open to the player or no.

Post Reply

Who is online

Users browsing this forum: Miph