Jump to content



Photo
- - - - -

PinballY - Startup Audio (for Background Music)

pinbally startup adio music

  • Please log in to reply
2 replies to this topic

#1 Tesla

Tesla

    Pinball Fan

  • Silver Supporter
  • 1,556 posts
  • Location:Texas, USA

  • Flag: United States of America

  • Favorite Pinball: Star Trek - TNG

Posted 24 November 2025 - 12:29 AM

This actually works pretty good (as is) for a little background music while browsing in the Selector-Wheel (looking for a nice table to play).

http://mjrnet.org/pi...AudioVideo.html

 

Up till now, my cabinet has been (purposely) fairly quiet when in PinballY. My Browsing Wheel is just static images (and I like it that way). Less distractions while selecting a Table to play and it's obvious to family members that the Table isn't actually started yet. Attract-Mode is just (random) still-images of my tables (as desired). 

 

I just dropped-in a renamed copy of the file "Art of Noise - Paranoimia.mp3" and it started playing when PinballY starts-up. Nice!

It stops when you find a table and start-it. (perfect)

 

But too bad it doesn't start playing-again when you come back to the wheel (this audio-file or the next one in the folder).

 

I had envisioned background music while in Attract-Mode (invoked after a short-ish delay), but this works also.

 

So, is this feature also accessible with PinballY's JavaScript implementation?

If so ... if wonder if you try to change it's behavior (as described above) or do it more from scratch (using the function-calls at hand)? 

 

As far as "when" the music starts playing, I bet if you can do one (at PinballY start), you can easily do the other (at Attract-Mode start) or even both. <smile>


Edited by Tesla, 02 November 2026 - 07:09 PM.


#2 mjr

mjr

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 3,346 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Posted 25 November 2025 - 04:00 AM

That's an interesting idea to have a continuous background soundtrack.  You're right that it's not a native feature currently - I was envisioning the startup track as just a self-contained clip that would play when the program is first launched, and then end.

 

You probably could accomplish something like that with Javascript, although it would take a little experimenting to get all the details together.  I think the basic idea would be to create a drawing layer in the main window to contain the audio.  You wouldn't actually draw anything there - it would just be a transparent layer, effectively making it invisible.  But you'd use drawingLayer.loadVideo() to load your audio track.  (I **think** loadVideo will work fine with plain audio files, but I'd have to check.  If not, you could work around it by ffmpeg'ing the audio tracks into video container files, like .mp4.  It would be inelegant but I think workable.)

 

Then you'd use the "gamestarted" and "gameover" events to stop and start the audio tracks (stop background audio track on game started, start a new background audio track on game ended).


While you're at it, you could also respond to the "attractmodestart" and "attractmodeend" events in the same way, to play other audio tracks while in attract mode.



#3 Tesla

Tesla

    Pinball Fan

  • Silver Supporter
  • 1,556 posts
  • Location:Texas, USA

  • Flag: United States of America

  • Favorite Pinball: Star Trek - TNG

Posted 02 November 2026 - 08:07 PM

1. I was envisioning the startup track as just a self-contained clip that would play when the program is first launched, and then end.

 

2. You probably could accomplish something like that with Javascript, although it would take a little experimenting to get all the details together.  I think the basic idea would be to create a drawing layer in the main window to contain the audio.  You wouldn't actually draw anything there - it would just be a transparent layer, effectively making it invisible.  But you'd use drawingLayer.loadVideo() to load your audio track.  (I **think** loadVideo will work fine with plain audio files, but I'd have to check.  If not, you could work around it by ffmpeg'ing the audio tracks into video container files, like .mp4.  It would be inelegant but I think workable.)

 

Then you'd use the "gamestarted" and "gameover" events to stop and start the audio tracks (stop background audio track on game started, start a new background audio track on game ended).


While you're at it, you could also respond to the "attractmodestart" and "attractmodeend" events in the same way, to play other audio tracks while in attract mode.

 

This ended-up being a busy-time for me (personally) a year ago, so looks like I never finished-out this thread...

 

1. Acknowledged. Cool-idea, but it turned out to not really be what I was looking for, so turned it back off. But it did inspire me.

 

2. Thanks for the guidance and help back then ... getting started on my (first real) PinballY Javascript Add-on.

 

Before this, I had only written a tiny one ... a Pause-Menu-Mod.js to remove the Pinball-Y program Quit and computer Shut-Down menu-items (family idiot proofing). Ended-up being a good-introduction into the process back in 2024. It's documented here on the forum somewhere. 

 

The documentation for the Javascript API seems good, and there are plenty of examples around

http://mjrnet.org/pi...Javascript.html

 

I ended-up writing two scripts that run hidden in the PinballY background ... one for background-music while browsing the Table-Wheel and one for Attract-Mode (quiet screen-saver turned-into a bit of a jukebox). Each one has it's own mp3/ogg files, and each can be set to play them sequentially or randomly. They log what they do. I learnt some Javascript and wrote these on my office-computer and then finally deployed to my pinball-cabinet (pretty much as is). I started with something easy/small working and built-up from there. It was kinda hard at first, and I needed help with some of the advanced Functions ... but you have to start somewhere and learn-something if you want to do projects like this. I haven't really looked at or messed with them in all this time ... they just work and play my music files.

 

https://www.vpforums...=60045&p=558050

 

 


Edited by Tesla, 05 November 2026 - 07:10 PM.






Also tagged with one or more of these keywords: pinbally, startup adio, music