Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: JScript Panel script discussion/help (Read 523855 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: JScript Panel script discussion/help

Reply #1676
Air Ken:  Thanks for your response to my question about the VU meter by posting links and images, but they do not answer my question.

My question is, why, if I have added a new JSP3 panel with the same script ""JSP3 64bit VU Meter" posted by ilovefb2k attached to his post at https://hydrogenaud.io/index.php/topic,110516.msg1048520.html#msg1048520 , I do not get a panel image that matches what he attached to the same post.

Instead, I get the first image I posted here:  https://hydrogenaud.io/index.php/topic,110516.msg1048794.html#msg1048794

Can anyone explain to me what I am missing?

Re: JScript Panel script discussion/help

Reply #1677
This post is a compilation of ilovefb2k's Script for the benefit of users who view it.
Reply #1672
Reply #1673
-----
I haven't received a clear answer here either, so I don't fully understand how to adjust the colors. I'll just have to play around with it and check it out myself.
https://hydrogenaud.io/index.php/topic,110516.msg1048559.html#msg1048559

Reply #1648
https://hydrogenaud.io/index.php/topic,110516.msg1048606.html#msg1048606

> Having said that, this 64-bit VU Meter is in no way comparable to foo_vis_vumeter but may be useful to some extent. That said, we can apply any colors, step number or create any VU Meter shape (bar, cycle, etc.) as we like - the sky is our limit.
> Not to mention its 64-bit capability, this approach may lead us to the FFmpeg framework (ffmpeg, ffprobe, ffplay) with a lot of features behind its ton of parameters.

I've looked into it myself but I don't understand it at all.
-----
> P/S. Can anyone shed me a light on how to stop this site from keeping me banning without reason. It is annoying that i have to go to some cafe to get access.

ilovefb2k needs help, does anyone know?
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, HIFIMAN ANANDA, Bowers & Wilkins P7, FiiO FT5, FiiO FT1 Pro, 水月雨 (MOONDROP) 空鳴 - VOID, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1678
To Anybody:  I am just looking for a clear, text reply to the following question:

"Why, if I have added a new JSP3 panel with the same script "JSP3 64bit VU Meter" posted by ilovefb2k attached to his post at https://hydrogenaud.io/index.php/topic,110516.msg1048520.html#msg1048520 , I do NOT get a panel image that matches what he attached to the same post.  Instead, I get the first image I posted here:  https://hydrogenaud.io/index.php/topic,110516.msg1048794.html#msg1048794."

Obviously, something more was required than just adding the supplied JSP3 script.

Re: JScript Panel script discussion/help

Reply #1679
To Anybody:  I am just looking for a clear, text reply to the following question:

"Why, if I have added a new JSP3 panel with the same script "JSP3 64bit VU Meter" posted by ilovefb2k attached to his post at https://hydrogenaud.io/index.php/topic,110516.msg1048520.html#msg1048520 , I do NOT get a panel image that matches what he attached to the same post.  Instead, I get the first image I posted here:  https://hydrogenaud.io/index.php/topic,110516.msg1048794.html#msg1048794."

Obviously, something more was required than just adding the supplied JSP3 script.


First the script is missing on_colours_changed()  function.

Code: [Select]
function on_colours_changed() {
update_colours();
window.Repaint();
}

So if you change the colours DUI or CUI in preferences they won't change until you reload the script.

As for your problem my guess is that somewhere in the script your colour selected for text is the same colour as the background.
Are you using DUI or CUI ?


Re: JScript Panel script discussion/help

Reply #1680
Hi Zeremy, good to see you back!  Thanks for giving me some real answers on this problem.  I am using DUI.  After reading your comments I'm almost sure my issue with no text is due to what you surmise about the text color in the script disappearing into my background color, as his shows in the image as being black with an off-white text.

I had thought whatever the color settings were in the script he posted would reflect what showed on my end, but if he started with using Foobar's "Dark Mode" which I am not (I use System - DUI) I guess an empty JSP3 panel would look black instead of white by default.

His script is rather hard for a novice to interpret as it is full of comment lines, variations for DUI/CUI, and what looks like pieces of script originally meant for SMP as well.  If you could just give me a place to start, I'm looking for basically what he posted as the image, with a black background, white text, and blue meter bars--especially if you could point me to where the color of the bar pieces themselves may be modified, and the line #'s affecting text & background color.  Once again, I'm referring to the script and the image he posted as attachments here:
https://hydrogenaud.io/index.php/topic,110516.msg1048520.html#msg1048520 .

Thank you for helping me sort this out!

Re: JScript Panel script discussion/help

Reply #1681
Hi Zeremy, good to see you back!  Thanks for giving me some real answers on this problem.  I am using DUI.  After reading your comments I'm almost sure my issue with no text is due to what you surmise about the text color in the script disappearing into my background color, as his shows in the image as being black with an off-white text.

I had thought whatever the color settings were in the script he posted would reflect what showed on my end, but if he started with using Foobar's "Dark Mode" which I am not (I use System - DUI) I guess an empty JSP3 panel would look black instead of white by default.

His script is rather hard for a novice to interpret as it is full of comment lines, variations for DUI/CUI, and what looks like pieces of script originally meant for SMP as well.  If you could just give me a place to start, I'm looking for basically what he posted as the image, with a black background, white text, and blue meter bars--especially if you could point me to where the color of the bar pieces themselves may be modified, and the line #'s affecting text & background color.  Once again, I'm referring to the script and the image he posted as attachments here:
https://hydrogenaud.io/index.php/topic,110516.msg1048520.html#msg1048520 .

Thank you for helping me sort this out!

@ilovefb2k
I hope you don't mind - I made a few modifications, regarding the colours.

@sveakul
You can override the default selection of colours that are loaded from DUI or CUI preferences at lines 94-95-96 (comment the lines out - remove the // s)
The values are what you asked for ( black background, white text, and blue meter bars)

At lines 98,99 you can define the 2 colours that are blended to create the vu bars
eg. black to red
   color_1 = RGB(0,0,0);
   color_2 = RGB(250,0,0);
   

Keep in mind that the latency is high
( on my pc it takes about 10sec to ffprobe the file and start displaying the vu bars)

Re: JScript Panel script discussion/help

Reply #1682
@zeremy
Thank you for editing the script.

> At lines 98,99 you can define the 2 colours that are blended to create the vu bars

I don't understand the effect of lines 98 and 99.
Thanks.






SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, HIFIMAN ANANDA, Bowers & Wilkins P7, FiiO FT5, FiiO FT1 Pro, 水月雨 (MOONDROP) 空鳴 - VOID, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1683
@zeremy
Thank you for editing the script.

> At lines 98,99 you can define the 2 colours that are blended to create the vu bars

I don't understand the effect of lines 98 and 99.
Thanks.







@Airken
The script I modified was version 1.1.0.
It has 2 colours, the effect of your example is to blend the colours starting from white and ending in blue

The other script in your pictures is version 1.1.1. which is different.
It uses 3 colours.



Re: JScript Panel script discussion/help

Reply #1684
Yes, I know. Here is the image below.
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, HIFIMAN ANANDA, Bowers & Wilkins P7, FiiO FT5, FiiO FT1 Pro, 水月雨 (MOONDROP) 空鳴 - VOID, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1685
Sorry. It's hard to understand.

> At lines 98,99 you can define the 2 colours that are blended to create the vu bars

I don't understand the effect of lines 98 and 99.
Thanks.



SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, HIFIMAN ANANDA, Bowers & Wilkins P7, FiiO FT5, FiiO FT1 Pro, 水月雨 (MOONDROP) 空鳴 - VOID, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1686
@marc2k3 - perhaps you should do like pgyt and give these people access to raw audio data from visualization stream. It's insane what they are doing.

Re: JScript Panel script discussion/help

Reply #1687
@zeremy  : Thanks a million for the mod script and explanations on the settings locations for the JSP3 VU Meter 1.0!  Here are some observations of my own now that was able to get a sample script up and running for my DUI Foobar, no "Dark Mode" but has black Background color scheme.  Line #'s refer to the ones in my modified script which is attached.

1.  You can point the script to an external copy of ffprobe.exe by changing line #292 to i.e. :
Code: [Select]
ffprobe: 'C:\\ffmpeg\\ffprobe.exe',

2.  As zeremy says there is about a 10s. latency delay before the start of the meter action while script caches the four RMS values across the whole song.  These are saved per song in a *.js file in its cache folder and persist while Foobar is open, so if replayed the initial latency is gone.  This folder is deleted when Foobar is closed to prevent an infinitely growing cache.

3.  The RMS values are normally displayed in real-time at the bottom area of the panel as in other's screenshots, but I found these numbers to change so rapidly while the song played that they were too much of a distraction for my eyes.  I deleted their text display by editing the //legend section which begins on line #243 to only write the refresh rate values.  This also gave the ability to use the same panel height I use for all my tabbed meters.  See attached screenshot.

4.  While not designed to function properly for streaming radio, ilovefb2k mentioned in a post that, "I am thinking of getting FFmpeg (to) filter exported log data into memory (stdout) on-the-fly to deal with online media."  I strongly encourage ilovefb2k or someone else to implement this, so the meter can be used with radio streams as well as fixed files like any standard VU Meter.

So I've attached where I'm at now, and my next step will be experimenting with the bar color blends.  Thanks again to zeremy.

Re: JScript Panel script discussion/help

Reply #1688
Sorry. It's hard to understand.

> At lines 98,99 you can define the 2 colours that are blended to create the vu bars

I don't understand the effect of lines 98 and 99.
Thanks.




Either use the default  values

color_1 = colours.text;
color_2 = colours.highlight;

or define whatever other like this

color_1 = RGB(250,250,250);
color_2 = RGB(255,0,0);

Re: JScript Panel script discussion/help

Reply #1689
@marc2k3 - perhaps you should do like pgyt and give these people access to raw audio data from visualization stream. It's insane what they are doing.
Case we're just having fun with what we've got to experiment with! 

Re: JScript Panel script discussion/help

Reply #1690
JSP3 VU Meter when running creates a set of subdirectories in the profile\$recycle.bin\js_data folder based on file tag, such as:

C:\foobar2000-x64_v2\profile\$recycle.bin\js_data\jsp3_vu_meter\aqua\euro hits forever

In the last "album" folder a json file is created based on the song title, like in this case "Barbie Girl.json", in which a long string of all the changing RMS peak/average value numbers for each channel are written.

While this file is deleted along with all the subdirectories when Foobar is closed, I found that commenting out (//) line #524 in the script I last posted (JSP3_64bit_VU_Meter-SV1.txt) will prevent the script from creating and writing values into the (filename).json file.  While the tag-based folder structure is still created (and deleted normally when closing Foobar), the values file never is, saving a multitude of file-write operations (think, "SSD").  The only drawback is that if you play the same file again while Foobar is open the meter will exhibit the initial latency period it did before.

The script including both this and the mods made in *-SV1 is attached below.

Re: JScript Panel script discussion/help

Reply #1691
@marc2k3 - perhaps you should do like pgyt and give these people access to raw audio data from visualization stream. It's insane what they are doing.

It is absolutely insane and it's to my eternal credit that I've kept quiet on this instead of resorting to my usual insults. :D

But it's less insane than me trying to implement this. I don't know anything about working with audio data. pqyt already maintained a vis component before he started. I'm an uneducated oik who knows nothing. I don't understand anything about the underlying concepts. I had a quick peak at the webview source and I have no idea what to do with it.  :o

Re: JScript Panel script discussion/help

Reply #1692
FFmpeg is a good fundamental media processing, foobar2000 is based on that platform among others.
Small clarification. foobar2000 is in no way based on FFmpeg. At some point a few decoders were switched from other libraries to decoders found in FFmpeg because they were faster and better. And some of these decoders have been reverted back away from FFmpeg because they turned out to be too buggy.

P/S. Can anyone shed me a light on how to stop this site from keeping me banning without reason. It is annoying that i have to go to some cafe to get access.
How do you connect to the site? I believe some anonymizing VPN services are banned/blocked because of abuse. I also fear that when a spammer is banned the IP-address that was used is banned with the account. Personally I don't believe in IP-banning as the problematic spammers are not stuck with a static IP.

I'm not sure VPN bans will be lifted, but if your normal connection's IP is blocked, you can for example PM the IP info to me and I'll try to get an admin to remove the ban.

 

Re: JScript Panel script discussion/help

Reply #1693
@zeremy
Thanks.

@sveakul
JSP3_64bit_VU_Meter-SV2.txt
Nice!
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, HIFIMAN ANANDA, Bowers & Wilkins P7, FiiO FT5, FiiO FT1 Pro, 水月雨 (MOONDROP) 空鳴 - VOID, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1694
I'm toying with the idea of providing audio data but I really have no idea what I'm doing.

@Case , if you have a minute or 2 could you check this...

I'm thinking of JS code like this...

Code: [Select]
// offset is optional, defaults to zero
var chunk = fb.GetAudioChunk(requested_length, offset);

if (chunk) {
// expose these properties
// chunk.ChannelConfig
// chunk.ChannelCount
// chunk.SampleRate
// chunk.SampleCount
// chunk.Data

var data = chunk.Data.toArray();

var channel_count = chunk.ChannelCount;
for (var i = 0; i < data.length; i += channel_count) {
// assuming stereo
var l = data[i];
var r = data[i + 1];
}
}

The C++...
Code: [Select]
STDMETHODIMP Fb::GetAudioChunk(double requested_length, double offset, IAudioChunk** out)
{
RETURN_HR_IF_NULL(E_POINTER, out);

*out = nullptr;

if (m_vis.is_valid())
{
double time{};
if (m_vis->get_absolute_time(time))
{
audio_chunk_impl chunk;
if (m_vis->get_chunk_absolute(chunk, time + offset, requested_length))
{
*out = new ComObject<AudioChunk>(chunk);
}
}
}

return S_OK;
}

Re: JScript Panel script discussion/help

Reply #1695
Looks correct. I'm not JavaScript guru, but do you need the .toArray() call in javascript part? Isn't the data already accessible without copying it into yet another buffer?

Re: JScript Panel script discussion/help

Reply #1696
It's a VARIANT in C++

https://github.com/jscript-panel/Core/blob/48f3cff3932f10a26336eb6a7ceb8a70805ef48a/ComArrayWriter.cpp#L110-L114

And this is somehow a VBArray(??) in script and it can't be accessed directly. The toArray is the what makes it a "normal" JS array.

edit: I will use the performance profiler in VS before contemplating release to see if there any sticky points,

Re: JScript Panel script discussion/help

Reply #1697
I am trying to replace Spider Monkey Panel with JScript Panel for and I almost got it except the ugly NULL showing in the picture below

JScript Panel


Spider Monkey Panel
Enjoy life now, this is not a rehearsal.

Re: JScript Panel script discussion/help

Reply #1698
Urgh, that instruction to use null in the panel settings is a mess and needs removing. Look out for a release later on tonight.

Re: JScript Panel script discussion/help

Reply #1699
Quote
Reply #1680 – 2024-08-09 20:31:50
Hi Zeremy, good to see you back!  Thanks for giving me some real answers on this problem.  I am using DUI.  After reading your comments I'm almost sure my issue with no text is due to what you surmise about the text color in the script disappearing into my background color, as his shows in the image as being black with an off-white text.

I had thought whatever the color settings were in the script he posted would reflect what showed on my end, but if he started with using Foobar's "Dark Mode" which I am not (I use System - DUI) I guess an empty JSP3 panel would look black instead of white by default.

His script is rather hard for a novice to interpret as it is full of comment lines, variations for DUI/CUI, and what looks like pieces of script originally meant for SMP as well.  If you could just give me a place to start, I'm looking for basically what he posted as the image, with a black background, white text, and blue meter bars--especially if you could point me to where the color of the bar pieces themselves may be modified, and the line #'s affecting text & background color.  Once again, I'm referring to the script and the image he posted as attachments here:
https://hydrogenaud.io/index.php/topic,110516.msg1048520.html#msg1048520 .

Thank you for helping me sort this out!
Hi @Zeremy and @Air KEN,
Thank  and appreciate you both for your valued, kind support.

Hi @sveakul,

I apologize for late reply. Upon reviewing the image post from [Reply #1671 – 2024-08-08 06:58:00], it seems that the background and text color in your fb2k (foobar2000) are white (technically, RGB 255,255,255). To address this, we can adjust the settings via the fb2k reference to make them different.

If the text is still not highlighting properly, we’ll need to delve deeper into the script.
If you’re still using ‘JSP1 64bit VU meter’ 1.0,

1. Navigate to line 133 to fix the VU Meter color:
Code: [Select]
var color_1 = colours.text; // or any color (RGB 250,250,250);
var color_2 = colours.highlight; // or any color (RGB 0,0,0);

In the above code snippet, color_1 and color_2 are assigned by default to the DUI/CUI text and text highlight colors.
These colors serve as gradient colors of VU Meter, with color_1 at the beginning and color_2 at the end of the gradient.
As indicated in the comments, you can assign any color to them using the RGB function (e.g., RGB[r,g,b], where r, g, and b are integers from 0 to 255). Adjusting these color settings to achieve the desired appearance of VU Meter.

2. Additionally, if we navigate to line 235, we can see that the text is written in the text’s DUI/CUI color. This explains why we cannot see this text and the beginning of the VU Meter bar:
Code: [Select]
gr.WriteText(g_text, font, colours.text, VU_x, yR+h+40, ww, wh);

replace 'colours.text' by other color, e.g black 'RGB(0,0,0)' as following and the text should be visible.
Code: [Select]
gr.WriteText(g_text, font, RGB(0,0,0), VU_x, yR+h+40, ww, wh);

I have just created another example, in which the ‘JSP3 64-bit Vu Meter’ was applied to a more relevant context.

Regards,