Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Open request for edge/loadman et al  (Read 4945 times)

0 Members and 1 Guest are viewing this topic.

buks

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 238
  • Last login:January 28, 2011, 06:43:25 pm
  • Squash the Sno-Bees !
    • Arcade Machine Construction
Open request for edge/loadman et al
« on: June 22, 2007, 10:59:44 am »
Loadman/Edge

I must say the LedWiz plugin you guys wrote was the main reason I switched from MAMEWah (still an excellent frontend by the way) to MaLa. It works like a dream - I'm amazed at how fast it can switch the lit buttons for each game as you scroll through the list. The previous solution I had was MAMEWah, PowerMaeme and a 3rd part tool written by someone on these boards (apologies I have forgotten your name !). Basically it worked but there were 30 second pauses between loading then unloading each game. A right pain !

I really like the way your plugin lets you create a button config then save it either as a general, emulator or game specific config. Its a simple idea that just plain works - looks great too. Plus I don't have to remember what button config I setup for the Sega Megadrive everytime I play - and it makes it easier when friends are round - "What buttons do I use - oh the lit ones" :)

So, onto my request - how easy/hard would it be to create a "sound to light" / "leds dancing to music" function for this plugin ? I know Randy put something together a while back but decided not to release it as it was basically written for his setup and would take a total rewrite to make it "generic". Also Game-Ex has one built in but I cant get it to work - all the leds light up but thats it - no flashing or nothing.

I know nothing about how these things but what would be cool was if you could select a button(s) for the bass (so I'd select the trackball that has RGB leds) and then other buttons for treble (?) at different frequencies. Not sure if that makes sense or not - basically the trackball would be thumping random colours and the buttons to the left would be picking up certain sounds while the buttons on the other side would be doing something else.....

Hope my ramblings make sense - they don't always.

Buks

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 11:22:04 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Open request for edge/loadman et al
« Reply #1 on: June 22, 2007, 12:39:57 pm »
I can chime in for them until they read this.  It wouldn't be hard at all, it'd just be hard to get it working well. 

Let me explain that one. The best way to do beat detection is to either open the sound file in question twice, and "read" one of them to determine the beats or to "record" the mixer channel of your pc and analize that.  If you do the first one then you are limited by what you can do as it has to be a sound the app is making and only one sound at a time can be read.  If you do the latter then every sound is analized, even system sounds, and thus you don't have a lot of control over it. 

In either case, it requires the direct reading and manipulation of memory, not to mention reading a very large amount of data quickly and on-the-fly.  Even after all of that, you have to normalize the data and convert it into something useful, which could potentially get quite complicated. Modern pcs can do this, but it eats up a lot of resources.  Apps like winamp and wmp often hit 100% of the processor when a visualiztion is used and that has less to do with the rendering and more to do with beat detection.  Of course when you start another app this number goes down (because the thread is of low priority) but the visualization suffers. 

I've experimented with it before.  It's very fun to do and you can get some decent results, I just don't know if you'd want to put it in a fe though as high-end fes need a lot of resources for timing-critical animations.  I'm not so sure it'd be a good idea for mame either.   

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Open request for edge/loadman et al
« Reply #2 on: June 22, 2007, 06:40:26 pm »
Thanks for the kind works about the Plug-in. Don't forget SWINDUS was a major player in it's development too.  Edge and I have built on that.

I would not rule 'Disco Leds' out in the future..  But It's not easy or simple. HeadKaze did send me some code.

If it a 'must have' for you give HeadKaze's GameEx plug-in another try. I know it does work as I beta tested a bit for him prior to him owning a Led-Wiz. At the time I remember it being reliant I the Wav volume level being set very low (Nearly zero)

 

edge

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 370
  • Last login:May 08, 2025, 09:08:47 am
  • AttractMode and GroovyArcade rock!
Re: Open request for edge/loadman et al
« Reply #3 on: June 22, 2007, 09:36:21 pm »
buks - thank you for the positive feedback on our plugin.  glad to hear you are having fun with it.

beat detection / musical lights would be a great feature.  i know headkaze and howard have discussed various options in the past.  loadman was playing around with it as well.  not sure what we'd be able to do.  i'll read up on the past posts and take a look. :)

Buddabing

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1845
  • Last login:February 12, 2015, 02:51:45 pm
  • I'm a llama!
Re: Open request for edge/loadman et al
« Reply #4 on: June 23, 2007, 12:40:23 am »
It can be done.

First, the sound in question has to be captured, either from the microphone or from a file. This can be done via the DirectSound API, or OpenAL, or whatever.

Then you have to divide the audible frequency spectrum (usually 20 hertz to 20 KHz or so) into ranges, and then do some kind of analysis on the capture buffer so that you get a set of values for each sample in time, each member of that set representing the amplitude of the sound at that frequency range.

Finally, depending on what is contained in the set of ranges, light up the LEDs corresponding to the set.

I haven't dug into any of the APIs, but I'm guessing that you don't have to work out all the fast Fourier transform math yourself.

EDIT: Link to C++ program which does what I've described.
« Last Edit: June 23, 2007, 12:48:13 am by Buddabing »
I have changed my nickname to "Cakemeister". Please do not PM the Buddabing account because I do not check it anymore.

Please read the wiki!

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Open request for edge/loadman et al
« Reply #5 on: June 23, 2007, 05:41:17 am »
It can be done.

First, the sound in question has to be captured, either from the microphone or from a file. This can be done via the DirectSound API, or OpenAL, or whatever.

Then you have to divide the audible frequency spectrum (usually 20 hertz to 20 KHz or so) into ranges, and then do some kind of analysis on the capture buffer so that you get a set of values for each sample in time, each member of that set representing the amplitude of the sound at that frequency range.

Finally, depending on what is contained in the set of ranges, light up the LEDs corresponding to the set.

I haven't dug into any of the APIs, but I'm guessing that you don't have to work out all the fast Fourier transform math yourself.

EDIT: Link to C++ program which does what I've described.


Interesting....  Hmm Maybee I make a C++ dll and have it called my the delphi plugin.. hmm
[Pondering Mode on]

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Open request for edge/loadman et al
« Reply #6 on: June 24, 2007, 11:31:37 am »
I never did get my plugin working exactly the way I wanted it to. It looked okay, but not as good as how Randy had his going. There is some bug in my beat detection code and I think it's because the article I read about it is wrong also. I was actually working on the next version of beat detection code so that each LED was actually assigned it's own frequency band, so your CP buttons infact become a sort of spectrum analyser. I have the code, but got frustrated with it. It does work, just some of the maths involved was causing me issues. I might go back to that, as I will be doing an update to my plugin soon.

The way I did it was to use DirectSound and read the audio into a buffer, then break the sound up using an FFT library. Then analyse each frequency band over time and at a certain threashold a beat is detected. I then used a colour spectrum to represent the sound level of the beat.

Like loadman said I sent him the code, but it's not in Delphi so he may need to do a bit of research to figure out how he should go about it in Delphi. Also he's right about my plugin, you have to experiment with your volume control app to get the levels right. I think you can test it in the Plugin setup and mess with volumes there until you get a nice level.

buks

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 238
  • Last login:January 28, 2011, 06:43:25 pm
  • Squash the Sno-Bees !
    • Arcade Machine Construction
Re: Open request for edge/loadman et al
« Reply #7 on: June 24, 2007, 06:23:26 pm »
Woah ! Didn't expect this many replies. From some of the board "luminaries" too !

I'm no coder so I can't comment on the coding aspects (I used to be a COBOL programmer back in the early 90's though - stock control anyone ?) but it does sound possible from some of the comments.

I probably didn't mention it in my first post but I was meaning for the leds to dance in the jukebox - or in the screensaver too. I'm happy for the correct buttons to stay lit within mame as I nearly always forget what buttons to press - so no dancy lights within a game.

loadman/edge - I love the led attract modes so much I often turn the arcade machine on and just leave it in the menu - just to watch the eye candy (its better with the room lights off too). How sad is that then eh ?

Headkaze - I'll try gameex again and see if I can fiddle with that volume settings.

Cheers guys - much appreciate the feedback and exchange of ideas.

Buks

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Open request for edge/loadman et al
« Reply #8 on: June 24, 2007, 06:49:03 pm »
loadman/edge - I love the led attract modes so much I often turn the arcade machine on and just leave it in the menu - just to watch the eye candy (its better with the room lights off too). How sad is that then eh ?

Nothing sad about that, I do the same thing. It creates a nice atmostphere, you can have it playing the jukebox and have the arcade sounds playing while the Mame screensaver plays video game attract modes. Not to mention the mesmerizing flashy buttons :)

I'm no coder so I can't comment on the coding aspects (I used to be a COBOL programmer back in the early 90's though - stock control anyone ?) but it does sound possible from some of the comments.

I did a bit of COBOL back in the days. Pretty horrible language really ;)

Headkaze - I'll try gameex again and see if I can fiddle with that volume settings.

I wouldn't change my FE just for the "dance with music" LED feature of my plugin. Personally I have that particular attract mode switched off on my cab. Plasma effect is definately cool though ;)

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 11:22:04 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Open request for edge/loadman et al
« Reply #9 on: June 25, 2007, 10:20:18 pm »
Well I can add some simple "beat hooking" to mame hooker eventually (like the pixel hooking I'll be adding).  Like hk though, my problem has always been with the math.... I can get it working pretty well, but I'm such a perfectionist on that sort of thing it drives me mad that it isn't quite right.