Author Topic: Display-Specific Music?  (Read 677 times)

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 34
    • View Profile
Display-Specific Music?
« on: July 06, 2017, 10:33:14 AM »
I'm still working on my cabinet, but I was curious to know whether some functionality I recently implemented would useful to others.

A couple of things I did:

1. Added a voice announcing which display is being shown (or which filter is being applied). So in my case, if the user is scrolling across different displays (like Platform, Shmup, Sports), a robotic voice tells the user what they are looking at. (Of course, this doesn't have to be a voice, it could be any unique sound.)

2. Added unique music for each display. So for example, my cabinet plays Conan music when you are browsing Hack & Slash games, and Top Gun with Shmups, so on.

I accomplished both these additions through hacks to the music plug-in.

I was wondering -- if this sounds like something others might use, I might spend some time making a proper plugin for this. Because as it stands now, it works, but it's not pretty.

Any feedback welcome... whether it's saying you would use this, or even just to say I am going about it all wrong.

jedione

  • Sr. Member
  • ****
  • Posts: 363
  • punktoe
    • View Profile
Re: Display-Specific Music?
« Reply #1 on: July 06, 2017, 07:34:37 PM »
this only makes you stronger...bro ill try it
so so when i switch to fighting games in the display layout,,it says
"lets get ready to rummble"  would be bad ass ...
just make it so u can edit the sounds from a file...

have addd...

« Last Edit: July 06, 2017, 07:41:52 PM by jedione »
help a friend....

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 34
    • View Profile
Re: Display-Specific Music?
« Reply #2 on: July 09, 2017, 10:30:24 PM »
Here's how it works in practice.

https://youtu.be/W-R37keZyRM

So in the genre-specific displays, the appropriate music plays. On my set-up if you look at All Games there is no theme music, the sound of the snap videos is played instead.

I also dumped the voice thing. It's technically doable, but it was unnecessary. Too much going on.
« Last Edit: July 10, 2017, 09:36:32 AM by YellowBirdAZ »

jedione

  • Sr. Member
  • ****
  • Posts: 363
  • punktoe
    • View Profile
Re: Display-Specific Music?
« Reply #3 on: July 14, 2017, 06:30:22 AM »
i love it,   can u share it...please..
top gun is sick..
help a friend....

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 34
    • View Profile
Re: Display-Specific Music?
« Reply #4 on: July 15, 2017, 01:18:10 AM »
OK, I attached the plug-in. Tried to make it presentable. There's not much in the way of comments, error handling or logging.

How to use:
  • Create a parent folder to hold your music (or ambient sounds). Mine is "Music".
  • Within that folder, create subfolders with names matching the displays for which you want music to play. For example, my "Music/Hack & Slash" folder contains all the music I want to play when users are browsing Hack & Slash games. If you don't want music for a display, don't make a folder for it.
  • Now enable the plugin in AttractMode and specify your parent folder as "Source Directory".

Ignore the other options for now. With this basic configuration you should get unique playlists for whichever displays you want to have music. Be aware there is no checking for illegal characters, so I guess if you put weird characters in your display names you might run into problems creating folders with matching names.

This isn't a jukebox, so although it's based on AudioMode (thanks to whoever wrote that) a lot of that functionality is stripped out. It just plays random music from the appropriate subfolder, and it restarts every time you leave and then return to whatever display the music is associated with.

I added the Alternate Source options in case someone wanted to offer a B-track. It works exactly the same. Just create a second parent folder, with subfolders named after whatever displays you want to play music. Then assign a key to toggle between the original music and the alternate music. This is optional, and hitting the toggle when no alternate source is defined will not do anything. As an example, I have "Music" as my original source, and I have "Music_Chiptunes" as an alternate set of music.

If you use the alternate source options, make sure in your attract.cfg file the value specified for "layout" under each "display" entry is exactly right. The values are case-sensitive. So in my case, I was getting weird behavior if layout was specified as "flavors" rather than the correct "Flavors". It caused the plug-in to reload and it messed up the toggling between the original and alternate music whenever I viewed a display with a misspecified layout.

Finally, in my set-up I have displays where I don't want music, but I want to hear the sound of the snap videos being shown. I also don't want the video sounds to play underneath music. I accomplished this outside of the DisplayMusic plugin. In my layout.nut, I used the video_flags (Vid.Default and Vid.NoAudio) to mute the videos for displays with music, and to play the video sounds in the display with no music.

For anyone who wants display-specific music, I hope this helps.






« Last Edit: July 15, 2017, 01:24:51 AM by YellowBirdAZ »

caminiti45

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Display-Specific Music?
« Reply #5 on: September 09, 2017, 04:29:11 PM »
YellowBirdAZ This is a fantastic plugin and exactly what I was looking for! I only have one minor issue and that is, in the theme I am using, it has the ability to add favorites and to switch between favorites or all. When doing any of these, the music starts all over again. Can you think of anything that I can do to keep the music playing while performing these actions? Thanks a bunch!
-Rob

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 34
    • View Profile
Re: Display-Specific Music?
« Reply #6 on: September 15, 2017, 04:08:36 PM »
Glad you like it!

I updated the plug-in since I first posted it. I am travelling so I can't really dig into it. I am pretty sure I did not address the issue you are speaking of, but it might be possible to catch the transition and prevent it from short-circuiting your display-specific music. Not sure when I can look at this, but I will.

It might be smarter to make the music change key off of something else, but again I will have to take a deeper look.

I completely toned my whole front-end down, now I just have 80s music for 80s games, 90s for 90s and electronic stuff for "retro-style" PC games like Broforce. Simpler is better.

caminiti45

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Display-Specific Music?
« Reply #7 on: September 15, 2017, 05:58:10 PM »
Thanks for looking into it. Ok, I feel stupid asking this, but this plugin worked perfectly in attract mode for windows, but once I put it on my raspberry pi, I cannot get the music to play. I am using the folder /home/pi/RetroPie/music/ and under the music folder is folders that match the display names with an .mp3 in each folder. plug in is enabled. I can get music to play using the audiomode plugin which I believe you said your plugin was based off of, so I'm at a total loss lol. Any suggestions?

calle81

  • Full Member
  • ***
  • Posts: 67
    • View Profile
Re: Display-Specific Music?
« Reply #8 on: October 14, 2017, 12:13:08 PM »
Hi, awesome! Can I stop the sound from looping? I'd like to have an announcement only

caminiti45

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Display-Specific Music?
« Reply #9 on: October 15, 2017, 04:45:13 PM »
YellowBirdAZ:
Are you using your display music plugin within windows or on a pie? Do you think it would be possible to build a display specific screensaver plugin with some modifications to your music plugin?
Thanks!

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 34
    • View Profile
Re: Display-Specific Music?
« Reply #10 on: October 24, 2017, 08:48:28 PM »
I only have one minor issue and that is, in the theme I am using, it has the ability to add favorites and to switch between favorites or all. When doing any of these, the music starts all over again. Can you think of anything that I can do to keep the music playing while performing these actions? Thanks a bunch!
-Rob

Rob, I don't know that I have this issue fixed yet, but it might be. I narrowed down which specific transitions should trigger music changes and which shouldn't. This was because I wanted the plug-in to start playing music during any intro video or layout, and to continue when the intro ends rather than abruptly changing. I am thinking some of these changes might also have addressed your issue. I will clean it up some more and post the updated plug-in... we can see if it helps, and if not we can figure out a fix.

Ok, I feel stupid asking this, but this plugin worked perfectly in attract mode for windows, but once I put it on my raspberry pi, I cannot get the music to play. I am using the folder /home/pi/RetroPie/music/ and under the music folder is folders that match the display names with an .mp3 in each folder. plug in is enabled. I can get music to play using the audiomode plugin which I believe you said your plugin was based off of, so I'm at a total loss lol. Any suggestions?

OK, just comparing AudioMode.nut (which works with RPI) and DisplayMusic.nut (which doesn't, apparently), the only significant difference I see is how music directories are accessed. I am thinking the syntax I used might not play well with Raspian Linux or whatever those things run.

Go into the DisplayMusic.nut file and try replacing all the instances of double back-slashes (like "\\") with single forward-slashes ("/"). There should only be a few.

Please let me know if that fixes the problem! I hope so, because I have no idea what else it could be.

Maybe you have funky display names that RPI doesn't like as folder names?

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 34
    • View Profile
Re: Display-Specific Music?
« Reply #11 on: October 24, 2017, 08:53:52 PM »
Hi, awesome! Can I stop the sound from looping? I'd like to have an announcement only

Calle, so you were using this plug-in just to play an announcement sound or message when you switch to different displays?

If so I have a better plug-in for that, but it is so cheeseball I didn't post it. It's called Announcer.nut and I use it to have a robot voice announce which display you are in. But you can use any sound file, could be a musical flourish, a voice, whatever.

It also announces filter changes within a display. So for example mine announces when you a filtering by 4-player, 3-player, 2-player or no filter.

If this sounds more like what you are looking for, I can send it to you. PM me.

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 34
    • View Profile
Re: Display-Specific Music?
« Reply #12 on: October 28, 2017, 12:22:56 AM »
Here is a newer version. Relatively cleaned up. I could do more, just don't know when I will, and this seems pretty robust.

Only thing is I can't test of Raspberry Pi, so anyone who tries it there -- can you let me know if this works for you?

Works the same... create subfolders of Music folder, with names matching your Displays. So if you have a display for "Run & Gun" games, the music you want to go with that display should be in a "Run & Gun" subfolder of Music. And so on.

If your AM starts with an Intro, the music for the pending Display will play. So if AM is going to default to the "90s Shooters" Display, and that Display has it's own subfolder of music, the music from that subfolder will play on start-up through the Intro, and will continue after the Intro ends or is skipped.

Display changes triggered by filtering will not affect the music play. (So in "80s Games" Display, if you filter by 1987, the music will continue to play as normal even if the list changes to show only 1987 games.)

Copy the 1secsilence.mp3 file to the Music folder. The plug-in uses that file to pad silence when you specify a StartDelay parameter value over zero. (It defaults to 2 seconds.) You would use this padding if you have other audible events associated with Display changes, so that the music and these other audio files don't play over each other. An example might a be a voice announcing the name of the Display you transitioned to. You would add silence to force the Display playlist to wait for the specified amount of time before starting to play over the voice.