Author Topic: A plugin to be able to use foobar2000 / AIMP VU-meters  (Read 28916 times)

BoringName

  • Sr. Member
  • ****
  • Posts: 916
Did someone have progress on interpreting those files? Any links or knowledge on that is welcome for me.

Based on the image Hiccup linked in this post -
https://getmusicbee.com/forum/index.php?topic=23394.msg186730#msg186730

It looks like they are just a texture atlas. Instead of having each image saved in a separate file, they are all tiled together and saved in one big file. With OpenGL you would use gltexsubimage and specify the coordinates of subsection (tile) of the atlas you wanted to use.

You would want a formula that specifies the coordinates based on a value and a way to create a smooth transition (the algorithm Steven referenced) to transition from one value to the next so the needle appears to move instead just jumping to the new value.

I don't know if this helps but this is the formula that controls the animation of my coverflow plugin when a new cover is selected. There is a bit more to it than this but this is the guts of it. dx is the difference between the currently displayed cover (current) and the cover the animation is switching to (selected). This is run every frame and creates a fast moving animation that slows down as it gets closer to the selected album. The animSpeed value determines how quick it transitions. I use 15.  You would want to use different values but I think the method would be similar.
Code
double dx = selected - current;
if (Math.Abs(dx) > 0.002)
{
    current += (float)(dx / Plugin.SavedSettings.animSpeed);
}
else
{
    current = selected;
}
// insert your code here that grabs the atlas subimage based on the value of current.
//"selected" would be the VU value that "current" is transitioning to.

Edit: Actually looking at the samples, you want something that gets to the target value quickly when the meter is going up but transitions slower when it's going down or falling back to zero. Either way I think the formula above is a good starting point.
Last Edit: August 06, 2024, 04:14:17 AM by BoringName

hiccup

  • Hero Member
  • *****
  • Posts: 9135
Hi hiccup.

I wanted to give you an answer to your request here.

So I have the technical ability to at least give it a try, as far as the my CEN plugin covers the most aspects you ask for. So that's a yes.
What stops me are two things - time (as always) and the strange bin image files. Did someone have progress on interpreting those files? Any links or knowledge on that is welcome for me.
Hey! That's great kamen!
I won't get my hopes up yet, since I can imagine this is something that will be very time-consuming, and far from straightforward. (if even technically possible)
Me having no coding capabilities I probably won't be able to provide much useful help with this.
But I should still have lots of files on my computer that I used for testing and trying to figure out how this VU meter magic happens for the foobar2000 plugin.
So I should be able to provide you with some relevant files and stuff that I extracted (of which I only have a faint guess of how they work exactly)
I'll refresh my memory on that, and see what I can come up with.

Ah, OK!  Since the subject is being actively discussed now it deserves to be its own "New Topic" under the Visualisers child board, not an over-entended "Wishlist" entry.  Kamen (or hiccup) I would urge you to create that New Topic name and I hope it takes off this time, it was almost there too!  It would be great to have this.
While I understand your reasoning, I'm a bit in two minds about this.
The topic it is in is the Wishlist board, and until now it is just that, a wish.
And it can be discussed here further perfectly as far as I am concerned.
My interpretation is that the Visualisers board is more intended for available visualisers.

A better board for this kind of stuff could be the Developers board?
I'm slightly reluctant to add a second topic about pretty much the same while this one already contains so much info on the matter
But then again it might be good to have a fresh topic in 'Developers', with a start post that contains relevant information for coders from this thread (and perhaps some links to files and sources) to start things off.
For now I'll give that a thought and await opinions.
Last Edit: August 06, 2024, 08:00:48 AM by hiccup

BoringName

  • Sr. Member
  • ****
  • Posts: 916
Just to add some more info here after looking into this a bit.

I think hiccup is right about the "bin" files containing more than images. I'd be interested to know how you extracted the images from the file. I believe they will also contain configuration information for the specific VU meter.

As previously mentioned, it looks like they just have a full set of images with the needle at all different points and it's set to display whatever image fits the current VU value.

An author of a VU meter for AIMP has done it a different way. If you download one of their skins like this one Pandemic Analog Meter

It just contains a few images with the needle as a separate file, so they would just draw the background, manipulate the angle/position of the  needle based on the current VU values and draw that over the top. The zip also includes an ini file that specifies settings for that particular skin. eg) angles and pivot point for the needle etc...

I think the AIMP method is a much better way to go. It would be a lot easier for people to make their own skins.

I'm still finishing up some things on my other plugin but I'll have a play around with this when I find some time. No promises.

kamen

  • Jr. Member
  • **
  • Posts: 105
BoringName and hiccup, thank you for the fast replys.

I actually thought the bin-approach to be the easier, but the mysterious format is a stopper for me.
On the other side I also had a look at AIMP's aproach, which couldn't be simpler. However the actual implementation in AIMP is far from smooth, but hopefully can be bettered.

So I tend to think more on the AIMP's side just to try the code that I already have.

As you both noted: no promises and no high hopes is the right approach here ;)

BoringName

  • Sr. Member
  • ****
  • Posts: 916
Some more info here on the foobar plugin, not sure it really helps but it can't hurt.
An editor for making bin files for the plugin - Vu Editor
Forum thread with a tutorial of sorts - VU Meter tutorial

That second link is a russian site so you will need to translate it.

I had a bit of a google for source code for those things but couldn't find any. The original author hasn't posted in that forum since 2013 either.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34989
if you decide to use the bin files and have difficulty understanding the format of the files, i might be able to help. I did manage to get the graphics for one working but just not the actual music data feed values to make the pin behave like an analogue VU meter (analogue meters have their own distinct behaviour)

aktor

  • Sr. Member
  • ****
  • Posts: 336
Digital vu meters are also cool. A vertical version of the current MB's embedded one would be fantastic

hiccup

  • Hero Member
  • *****
  • Posts: 9135
Digital vu meters are also cool. A vertical version of the current MB's embedded one would be fantastic
This topic is about the wish for a plugin that allows for using the VU meters that are available for foobar2000 and AIMP.

Your request is for a new feature within MusicBee.
That should be a separate wishlist item.

edit:
I see you already posted a wish for that before. So you could bump your own request.
Last Edit: August 07, 2024, 05:08:02 PM by hiccup

BoringName

  • Sr. Member
  • ****
  • Posts: 916
So I've done the first step here with AIMP skins. The meter can be added to a panel and they load up and display, you can also switch between skins with a context menu.

But pretty sure that is the easy part as the needle doesn't move yet. It looks like there is nothing in the Musicbee api about volume units. I assume I have to query the audio device or something directly?

I had a brief look at the bin files the other day but buggered if I could figure out how to get the images from them so you will have to share that at some point. I'll worry about that after I've figured out how to get the volume units and see if I can get the needle moving satisfactorily. If I can get that working, adding the bin file images should be pretty easy.

sveakul

  • Hero Member
  • *****
  • Posts: 3285
BoringName: have you tried yet the "VU Editor" tool that you posted about earlier, which contains an analog VU meter editor with GUI along with broken-down component samples?

While designed for the foo_vis_vumeter component it may be helpful to you in cracking bin files, adjusting meters, etc.  The instructions inside the zip's text file are in Russian but I was able to translate the whole thing pretty well in Google Translate to English (past the word limit for DeepL)--would post the translation here if I could.  Again, it's attached to the post linked here:  https://hydrogenaud.io/index.php/topic,116124.0.html

Would be nice to see meter development, even digital, take off in MusicBee as it has in Foobar.

Last Edit: August 20, 2024, 07:29:06 AM by sveakul

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I did look at the editor but it didn't help much. The bin files can be compressed or not. The compressed versions can be extracted with 7zip but I haven't got any further than that. Ran it through PhotoRec and that found nothing.

I believe the editor just takes some image files for the background, needle etc... and then creates the bin file which contains 1024 copies (frames) of the vumeter, each one with the needle in a different position so there is enough images to span the full movement of the needle based on whatever settings you specified in the editor.

When that plugin is loaded into the vumeter it just displays whatever frame matches the current VU values but also has a bit of magic in there to transition the frames and move the needle the way it does.

It's all for nothing if I can't figure out the "bit of magic" part to get the animation looking correct so I will focus on that first. Getting the images from the bin files can come later.

hiccup

  • Hero Member
  • *****
  • Posts: 9135
I had a brief look at the bin files the other day but buggered if I could figure out how to get the images from them so you will have to share that at some point.
I had to dig deep to recall and figure out again how to extract these bins, but here it is:

You need the VUEditor.exe and bin file from an existing VU meter, and then create a shortcut for the VUEditor.exe



For the properties of the shortcut, for 'Target:' set:

- the location of the .exe. and the bin file
- the name of the .bin file
- the location where you want to extract the bin files to

in this format:
"E:\VUEditor\bin files\VUEditor.exe" "Accuphase1.bin" E:\VUEditor\extracted bin\Frames1\ E:\VUEditor\extracted bin\Frames2\

edit:
This exact example won't actually work. The command pane will open briefly and closes immediately without extracting anything.
I ran into this problem years ago, and I pulled out lots of hair before figuring out the cause:
Make sure that the path to where the extracted files go does not contain any spaces!

So something like this will work:
"E:\VUEditor\bin files\VUEditor.exe" "Accuphase1.bin" E:\VUEditor\extracted_bin\Frames1\ E:\VUEditor\extracted_bin\Frames2\

(if I recall correctly, frames 1 and 2 are for left and right channels, if so defined by the creator of the VU meter. But left and right can also be contained in a single .bin file)

Here is a link to the files as used in the screenshot, and an archive containing an already extracted bin:
https://www.dropbox.com/scl/fo/1lvuup1psdyrtlox91ppf/AO6qcZgRWiuF4PALQbE2uyM?rlkey=egauv3kzry5c0br3lelq8ie7o&dl=0
 
Last Edit: August 20, 2024, 06:02:09 PM by hiccup

BoringName

  • Sr. Member
  • ****
  • Posts: 916
Thanks for that. I can see now those instructions are on the last page of the russian thread.

Unfortunately when it unpacks it's not compressing the images so it turns a 1mb file into a folder full of BMP's that take up 300mb.....

Anyway, worse case scenario, if I can't figure out how to access that info on the fly, I will have a method of converting them into something I can use.

With VUEditor and ffmpeg, I'm pretty sure I could setup a batch file to convert a bin file into a texture atlas file (just a combined image file with all the frames in it.)

But I need to get that needle moving first.

hiccup

  • Hero Member
  • *****
  • Posts: 9135
But I need to get that needle moving first.
Yeah, that's kind of important ;-)

It's only now that I realised that the guys at Aimp have been doing things quite differently.
Since the VU's looked the same as the foobar2000 ones, I thought the principle was the same. But it's not.
It looks like the AIMP versions were all created by extracting the original foobar2000 ones, and then creating an Aimp version for them?
What do you think?

If you get stuck with the foobar2000 implementation, and the AIMP results are the same (functional and fluent wise) that could be another path to follow?


edit:
You probably already found this topic too, just sharing the link to make sure:
https://foobar2000-ru.translate.goog/forum/viewtopic.php?t=4061&_x_tr_sl=ru&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp

It is a discussion about the development of the foobar2000 plugin. Perhaps it contains some useful information.
Last Edit: August 21, 2024, 06:44:12 AM by hiccup

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I've read a bit of that thread already. I think I get how it all works. Just nothing there on decoding the bin files unfortunately.

Yes, the AIMP is a bit different. No third party app (VUEditor.exe) required to make a skin. just create the image files and specify the angle parameters for the needle. I've already got most of that one nutted out.

I haven't looked at a lot of samples for the AIMP skins but I don't think there is anything there regarding lamps whereas the VUEditor lets you specify a lamp that lights up as well as the needle.

I can see advantages/disadvantages to both methods. I don't think I'll have too much trouble supporting both, it's just the bin files might need some conversion done first.

I've currently got a working VUMeter with the needle flicking around that looks extremely promising. The needle isn't pointing at the right values because I haven't bothered with the parameters for that yet but it's a decent start.