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: 8
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.
  • Music unlock support.
and more to come!
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 some 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"), Function(ost.get_music_channel_info), Stop('music', fadeout=2.0), Function(ost.refresh_list)]
3. (Optional) Add some music to the track folder.
4. 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)
  • unlocked | Allows a song to be shown to the player or not.
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 Sun Jul 11, 2021 10:43 pm, edited 3 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: 8
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: 8
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: 8
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.

szebi444
Newbie
Posts: 3
Joined: Sat Jun 26, 2021 12:07 pm
Contact:

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

#7 Post by szebi444 » Tue Jun 29, 2021 11:58 am

It works! Thank you! Also, may i ask if i free to use this option with the player on commercial goals? (like Patreon) (I'm still newbie, sorry if it's a common question! >w<)

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

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

#8 Post by GanstaKingofSA » Tue Jun 29, 2021 1:33 pm

I'm totally fine with it being used commercially. Really it's a use it whatever you want. It's mainly a template designed to customize and have in your projects.

szebi444
Newbie
Posts: 3
Joined: Sat Jun 26, 2021 12:07 pm
Contact:

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

#9 Post by szebi444 » Tue Jun 29, 2021 2:10 pm

Thank you for the answer, now i edit this like the 4th time, but in progress, in ren'py's launch project (simulation you know~) it's not working. By curiosity, i made a build and installed the game on my phone and it's actually do work, but once, i mean i got a crash and the music is disappeared from the room. Geez. Maybe it's a bug?

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

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

#10 Post by GanstaKingofSA » Tue Jun 29, 2021 5:36 pm

Hmm...is this in Ren'Py 7.4.6? I assumed you pasted everything into the game folder of your project and made a button for the menu. I can see to it but last I tested this it should work fine.

szebi444
Newbie
Posts: 3
Joined: Sat Jun 26, 2021 12:07 pm
Contact:

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

#11 Post by szebi444 » Wed Jun 30, 2021 2:36 pm

It's Ren'Py 7.4.4. Should i update? :D

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

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

#12 Post by GanstaKingofSA » Sat Jul 10, 2021 7:37 pm

szebi444 wrote:
Wed Jun 30, 2021 2:36 pm
It's Ren'Py 7.4.4. Should i update? :D
Sorry for the delay. I just took a look at the code as of late and can see there is a bug where the music will not load in along with some image album errors. This is being addressed now and should be up as 1.5 in a few hours or a day.

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

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

#13 Post by GanstaKingofSA » Sun Jul 11, 2021 10:40 pm

Version 1.5 of the player is now out which addresses some bugs in 1.4 that I have missed or forgot to add to itself. The new update can be downloaded from here: https://github.com/GanstaKingofSA/RenPy ... leases/1.5

negascott245
Newbie
Posts: 3
Joined: Wed Jul 14, 2021 12:55 pm
Contact:

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

#14 Post by negascott245 » Fri Jul 16, 2021 2:41 am

I’m new to coding but I placed the music room coding beneath the game menu coding line 292and I still get an error.

Post Reply

Who is online

Users browsing this forum: No registered users