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 523953 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

Re: JScript Panel script discussion/help

Reply #1850
Okay, this has been driving me crazy for a few days now:
Code: [Select]
// ==PREPROCESSOR==
// @name "Test"
// ==/PREPROCESSOR==

function RGB(r, g, b) {return (0xff000000 | (r << 16) | (g << 8) | (b));}

Button = {State:0};
ButtonColors = {0:RGB(0, 0, 0), 1: RGB(155, 155, 155), 2: RGB(255, 255, 255)};

function on_paint(gr) {gr.FillRectangle(0, 0, window.Width, window.Height, ButtonColors[Button.State]);}

function                 on_mouse_leave() {Button.State = 0; window.Repaint();}
function              on_mouse_move(x, y) {Button.State = 1; window.Repaint();}
function         on_mouse_lbtn_down(x, y) {Button.State = 2; window.Repaint();}
function on_mouse_lbtn_dblclk(x, y, mask) {on_mouse_lbtn_down(x, y)}
function         on_mouse_lbtn_down(x, y) {Button.State = 2; window.Repaint();}
function           on_mouse_lbtn_up(x, y) {Button.State = 1; window.Repaint();}

function on_focus(IsFocused) {if (!IsFocused) {Button.State = 0;}; window.Repaint();};
in my mind, function on_mouse_lbtn_dblclk(x, y, mask) {on_mouse_lbtn_down(x, y)} should make double clicks behave like normal clicks...
To test, single click and drag your mouse outside the foobar window, then try doing the same but double clicking ~

Is ES5 at fault? Is foobar at fault? I'd really appreciate if someone can explain what is happening!

Re: JScript Panel script discussion/help

Reply #1851
Hi All,
I have just  created a script to add 'value' to foo_youtube component by providing it with a song list.

//------------ CREDIT -----------------//
Credit goes to:
- @Wil-B (https://github.com/Wil-B) for the fantastic 'Find-and-Play' app, along with the 'Biography' and 'Library-Tree' scripts based on Spider Monkey Panel. The 'Find-and-Play' inspired me to explore [YouTube searching]. However I've tried, @Wil-B's scripts still set the benchmark.
- @Marc2003 (https://github.com/jscript-panel) for the excellent [JScript Panel 3] component. @Marc2003 actively updates this component with new features, bug fixes, and beautiful, tidy sample scripts.
Spoiler (click to show/hide)
Spoiler (click to show/hide)

Hi @all,
Another weekend is coming, friYay!!! And we have an update for the foo_youtube_addon.
//file: {deployed} foo_youtube_addon.txt
Let’s see what this script has done for us so far:
- Manually: Search YouTube clips by employing yt-dlp.exe or web.
- Automatically: Grab playlists/charts/(radio) from online audio track databases such as last.fm.
That is all.
As we may know, the better the song database, the more updated charts/playlists/top treandings we have. Therefore, we need to look for those charts, which should be based on an in-house streaming platform.

In saying so, this 1.0.1 PD 19oct24 version:
I: Updated with charts from (and should be enough for us to keep updated with trending, as these top trending/charts/playlists are quite the same worldwide):
- YouTube
- Tidal
- Apple Music
- Billboard
II. AND some changes in look and feel:
II.1 Employing Wil-B’s ‘YouTube Track Manager’ (now ‘Find and Play’): (https://hydrogenaud.io/index.php/topic,105522.50.html, wiki: https://hydrogenaud.io/index.php/topic,111059.0.html)
// file: {deployed} foo_youtube_addon_YTTM_lite.txt

1. Features:
Remaining only a few functions of the ALBUM MANAGER section of the ‘Find and Play’ app (originally named ‘YouTube Track Manager’ based on WSH, now based on package SMP).
- Employ audio track lists from MusicBrainz or last.fm to build playlists from YouTube clips.
- MusicBrainz: Search, load, and play a wide range of release types including albums, compilations, singles, and remixes.
- Last.fm: Search, load, and play last.fm TOP albums, TOP artist tracks, and TOP similar songs.
Quote
**Refer to Wil-B's 'Find and Play' app at https://github.com/Wil-B/Find-and-Play for full and rich features, including huge options to play around with the local library as well as YouTube clips.
**This script was refactored to work alongside the JSP3 {foo_youtube_addon} script by @ilovefb2k. They communicate with each other via file configuration (File User Interface - FUI, vs DUI/CUI) or JSP3 window interface.
2 How it works:
- Initially, grabs the artist name from the now-playing audio track.
- Gathers the artist’s album names and track titles from last.fm.
- Further, can pull similar song titles and related/similar artist names (solidly based on last.fm algorithm).
- Finally, searches for clips (by artist name, song title) from youtube.com.
- Adds YouTube links to fb2k’s current playlist.
- Almost the same steps apply to the MusicBrainz repository.

3. Set-up for DUI environment:
- Step 1: Insert 1 UI panel.
- Step 2: Insert 2 child UI panels into the above panel.
- Step 3: Insert JSP3 plugin (UI element) into each panel.
- Step 4: Copy and paste JSP 3 ‘foo_youtube_addon’ into 1 JSP3 panel. Copy this script into the other JSP3 panel.
- Step 5:
   + Play an audio track that has ‘artist’ metadata to enable this script.
   + From the ‘foo_youtube_addon’ context menu, select [YouTube search addon/1~ top tracks per artist/1.1~ select current album artist…].
   + This script panel will pop up to overlay the ‘foo_youtube_addon’ panel. If NOT, move the mouse over the bottom of the ‘foo_youtube_addon’ panel to resize this script panel (just do it once to set up).
   + Once this script panel is shown, click the icon on the top-right corner to return to the ‘foo_youtube_addon’ panel.

II.2 YouTube clip management:
Those favorite video clips we have added so far may end up in a long list, so a base list (credit @marc2003 for the list object) would be convenient for us.
- Load individual/whole clip list.
- Download audio/video (we need yt-dlp.exe, ffmpeg as mentioned in the previous post). //please pay attention to video clip's IP
- Add, rename, remove clip list.
- Set rating level.

And that is all.
Hoping you all enjoy and have a great weekend.
Wish you all the best,
@ilovefb2k
P.S.

I have bundled zip files to retain the folder structure and some supporting files (plain text).
please copy them to 'profile' folder or root folder of foobar2000.
download yt-dlp.exe and ffmpeg to [skins\external_helper\] as said beforehand.
again, i have left lot of comments for your convenient reference and tailoring this script.


Re: JScript Panel script discussion/help

Reply #1852
Hi @all,
As recently posted [https://hydrogenaud.io/index.php/topic,126733.msg1052729.html#msg1052729], we have come up with a JSP3 ‘pseudo beat audio’ script, which helps us visualize music by making light dance with the music, similar to enjoying a water-music festival where light and water dance together with the music.
That said, while BPM is ideal for guiding light to follow the beat, utilizing RMS/peak audio data should be sufficient to give the light a clue to dance.
Therefore, we have turned to @case and @marc2003’s “VU meter script” as a shortcut. Credit goes to both of them for this JSP3 feature and the beautiful VU meter sample. [https://jscript-panel.github.io/gallery/vu-meter/]

With all that in mind, we have released the JSP3 ‘Pseudo Beat Audio’ script, version “1.0.0 QP,” on the beautiful date 24-10-24. Details are as follows:
//How to add a beat skin to this ‘Pseudo Beat Audio’ script:
1.Search for/download free beat audio/3D clips, e.g.:
   - Round Rotating Neon Lights 3D Illustration VJ Loop [https://www.vecteezy.com/video/1909072-round-rotating-neon-lights-3d-illustration-vj-loop]
   - Futuristic 3D Video Animation of Passing Spaceship Tunnel with Square Light Lamps [https://www.vecteezy.com/video/17744905-futuristic-3d-video-animation-of-passing-spaceship-tunnel-with-square-light-lamps-between-]
   - Empty Dark Room Modern Futuristic Sci-Fi Background [https://www.vecteezy.com/video/7635216-empty-dark-room-modern-futuristic-sci-fi-background]
2. Convert these clips into pictures (PNG), e.g., via this site [https://ezgif.com/video-to-png] or by your software/app.
   These pictures will be loaded into memory (cache) and rendered one by one as animation (at least 24 pictures/frames per second is best).
   Note: Try to select at least one full cycle/loop of smooth motion.
3. Copy these pictures into a folder created under the [beat_skin_set_path] directory.
   We can edit this variable to make it convenient. This folder will be shown as the ‘beat skin’ name to interact with via the context menu.
4. Reload this script and select that ‘beat skin’.
//How this ‘Pseudo Beat Audio’ script works:
1. Get only one channel RMS/Peak level and treat this data as pseudo-beat audio.
   Why: We do not focus on math to consider this data as exactly as Beats Per Minute, which is absolutely necessary for DJs.
   Instead, we just focus on visualization and an acceptable level of accuracy, at which we can feel joy while enjoying music along with watching a ‘dancing’ light.
2. The script renders pictures one by one per internal timer to give us a 3D animation. Then several cycles are drawn, with their diameters based on RMS/peak level and panel/window dimensions.
Note: We can let these pictures dance by uncommenting two lines as noted and shown in the scripts.

Final note:
We have zip bundle files to retain folder structure and its files. You can find some folders' content as follows:
- beat_audio: 2 sample skins (due to 30MB quota limit/post)
- jsp3: this ‘Pseudo Beat Audio’ script.
Please unzip this file into the fb2k root folder or ‘profile’ folder.

Hope you all enjoy this humble ‘Pseudo Beat Audio’ script and have a nice weekend.
@ilovefb2k



Re: JScript Panel script discussion/help

Reply #1855
Looks pretty great! Now that there is a 64 SMP, will look into your code and probably recreate something similar for the waveform visualizer mode (which currently works only by BPM), really like what you did. Thank you :)

Re: JScript Panel script discussion/help

Reply #1856
Looks pretty great! Now that there is a 64 SMP, will look into your code and probably recreate something similar for the waveform visualizer mode (which currently works only by BPM), really like what you did. Thank you :)
Hi @regor,
It is my honor to receive your positive feedback.
Last time diving into your scripts but did not realize that you already dealt with BPM. That said, exploring your BPM-related codes is high on my to-do list to "borrow your algorithm" to finish this beat-audio puzzle.
I am glad that SMP is expanded to x64, and therefore, may come with the latest ECMA. This may inspire you to bring us more valuable widgets.
Wish you all the best,
@ilovefb2k.

Re: JScript Panel script discussion/help

Reply #1857
The logic is that higher BPM tracks require less steps to complete an animation, while a lower BPM will add more steps. So the animation goes faster or slower depending on the BPM. The animation itself is a random variation of the waveform.

The gif shows the real waveform and also a simple visualizer preset. I used a 52 and 172 BPM tracks as example.
Currently there is only a pretty simple single preset (because my script was focused on waveform displaying and seekbar usage), and that's the thing I would want to improve seeing yours. I'm sure TT will be interested on that too.

X

You have the relevant code at:
https://github.com/regorxxx/Not-A-Waveform-Seekbar-SMP/blob/main/main/seekbar/seekbar_xxx.js#L553

Then multiple places using 'this.maxStep'.

Re: JScript Panel script discussion/help

Reply #1858
The logic is that higher BPM tracks require less steps to complete an animation, while a lower BPM will add more steps. So the animation goes faster or slower depending on the BPM. The animation itself is a random variation of the waveform.

The gif shows the real waveform and also a simple visualizer preset. I used a 52 and 172 BPM tracks as example.
Currently there is only a pretty simple single preset (because my script was focused on waveform displaying and seekbar usage), and that's the thing I would want to improve seeing yours. I'm sure TT will be interested on that too.

[attach type=image]33158[/attach]

You have the relevant code at:
https://github.com/regorxxx/Not-A-Waveform-Seekbar-SMP/blob/main/main/seekbar/seekbar_xxx.js#L553

Then multiple places using 'this.maxStep'.
Hi @regor ,
Thank you for your prompt reply and for pointing me to the right place, illustrated by a typical example.
This is absolutely saving me time. Let’s see how far I can digest your codes.
Regards,
@ilovefb2k


Re: JScript Panel script discussion/help

Reply #1860
I want to isolate all the Radio Playlists and to only display them ?

I'am looking a way to check if my playlist is a radio playlist ( in JSP3 of course ) ? 
        
length : fb.TitleFormat('$if2(%length%,LIVE)'),  return LIVE if it's a stream ( mp3 or else ) .
 I could also name all the Radio Playlists with : ' RADIO ....... ' and check by name after that ?

thanks a lot if U have a solution ? 


Re: JScript Panel script discussion/help

Reply #1861
Hi @all,
As recently posted [https://hydrogenaud.io/index.php/topic,126733.msg1052729.html#msg1052729], we have come up with a JSP3 ‘pseudo beat audio’ script, which helps us visualize music by making light dance with the music, similar to enjoying a water-music festival where light and water dance together with the music.
That said, while BPM is ideal for guiding light to follow the beat, utilizing RMS/peak audio data should be sufficient to give the light a clue to dance.
Spoiler (click to show/hide)

Hi @all,

A weekend away is ahead, and I have a quick update to ‘JSP3 Pseudo Beat Audio’ to make it ‘true’ 3D, as well as easy to tailor.
While watching MilkDrop2/3, I had a vague idea to add an icon at the center, and here we go.

Basically, to make a shape look 3D, simply turn it into perspective. Since @marc2003 actively keeps JSP3 updated , rendering images is no problem for this component.
Then, our job is just to place objects on the virtual layers: The background should be on layer 0, and the topmost layer is suitable for that icon. So far, we have come up with 3 layers, and maybe the next one will be for something more attractive.

How it works:
- step 1: Obtain a free PNG image (transparent background) from Vecteezy  [(https://www.vecteezy.com] (e.g., for 'Mandala' subject : https://www.vecteezy.com/free-png/mandala)]. You can also let AI generate these images. (Attached are several images for quick samples.)
- step 2: Copy these images into the [beat_audio_icon] folder. Its path is in the script file attached.
- step 3: Select an icon via the context menu. These images/files names should be under the ‘beat icon’ sub-menu.

I am still pretty sour on BPM, as the component foo_bpm [https://www.foobar2000.org/components/view/foo_bpm] is for x32 only. I am thinking of porting it to x64 and, therefore, hope that old-school C++ helps me survive against this giant.

Wish you all a nice weekend.
@ilovefb2k
P/s. Please unzip this file into the fb2k root folder or ‘profile’ folder.


Re: JScript Panel script discussion/help

Reply #1863
I am still pretty sour on BPM, as the component foo_bpm [https://www.foobar2000.org/components/view/foo_bpm] is for x32 only.
I have posted a 64-bit enabled update about a year ago: https://foobar.hyv.fi/?view=foo_bpm.
Hi @Case ,

Wow, thank you so much! Now I understand why there is some text regarding the 64-bit version, but the component from foobar2000.org is only 32-bit (https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Components/BPM_Analyser_(foo_bpm)).

Regards,
@ilovefb2k

Re: JScript Panel script discussion/help

Reply #1864
I think there is a bug at the JS Smooth Playlist.js sample,
js\jssp.js
Line 610
Code: [Select]
			this.playlist_info += plman.GetPlaylistName(g_active_playlist) + ", " + this.list.count + " track";
if (this.list.count != 1) this.playlist_info += "s";
Should be .Count

Re: JScript Panel script discussion/help

Reply #1865
But there is no visible bug when using the script.  :o

It works exactly as expected because component method/property names are not case sensitive. I actually wish they were but there's nothing I can do about it.

I will correct it and thanks for spotting.

Another example would be console Log being uppercase here...

https://github.com/jscript-panel/Core/blob/6fac0c8dbd9110851a1ac886d53f11c630e9e3b4/JScriptPanel.idl#L261

but called using console.log in every script since forever.

Re: JScript Panel script discussion/help

Reply #1866
Oh, didn't know. I was working on a translation layer between JSP and SMP and saw that error xd then it makes sense why it was only visible on SMP then.

Will have that in mind.

Re: JScript Panel script discussion/help

Reply #1867
Hi @all,
Me again, and another weekend is coming—friYAY.
As yesterday posted [https://hydrogenaud.io/index.php/topic,126733.msg1053239.html#msg1053239], we have come up with a JSP3 ‘AIMP Analog VU Meter’ script.
This is just an attempt to see how far we can tune the AIMP analog VU Meter (especially needle movement) and its accurate meter range. As pointed out by @oops, and a quick observation (by me) confirmed the point that the AIMP VU meter may follow its own algorithm in terms of needle decay/raise speed and VU meter scale.

However, this approach can bring us some advantages:
   - Free allocation of the VU Meter in the panel.
   - Easy tuning of the needle speed.
   - Other look & feel effects.
   - Combining this VU Meter with other 'things' within a [JSP3 UI] panel.


So, here we go in detail:
- AIMP VU Meter types covered: analog needle only, horizon, V shape.
   + Type 1: 1 image set skin for both channels.
   + Type 2: 2 images, each for each channel.
- How to:
   + Download the AIMP VU Meter skin file (e.g. https://www.aimp.ru/forum/index.php?topic=52865.0).
   + Unzip the AIMP VU Meter skin into a folder and copy this [folder] to the specific directory as indicated by this script.
   + Load this script into the JSP3 panel.
- Limitations:
   + Options: MobilityNegative, MobilityPositive > could not take these into account.
   + Meter range (in the skin) is quite inaccurate based on fb2k's audio engine.
   + LED VU Meter is currently not supported.

Note: Refer to fb2k, @oops's, Analog VU Meter Visualisation/foo_vis_vumeter component for more options and information [https://www.foobar2000.org/components/view/foo_vis_vumeter].

Final note: We have zipped bundle files to retain folder structure and its files. You can find some folders' content as follows:
   - beat_audio_vu_meter: several AIMP analog VU Meters attached and 1-customized skin to illustrate.
   - jsp3: this ‘AIMP Analog VU Meter’ script.
Please unzip this file into the fb2k root folder or ‘profile’ folder.
If you prefer fb2k's VU meter skin, then simply unzip the BIN file, that AFAIK is index images, and utilize the 'JSP3 pseudo beat audio' script to manage as animation but dictated by RMS/Peak level.


Hope you all enjoy this humble ‘AIMP Analog VU Meter’ script and have a nice weekend.
@ilovefb2k

Re: JScript Panel script discussion/help

Reply #1868
@ilovefb2k
thank you as always.

\profile\skins\viking\scripts\jsp3\{deployed} AIMP Analog VU Meter.txt

Skin folder: \profile\skins\viking\images\vnav_fb2k\beat_audio_vu_meter\
(The folder where you unzipped AIMP Analog VU Meter.zip)

 
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 #1869
These meter screenshots need a health warning. "May cause eye cancer". They're hideous. :/

Re: JScript Panel script discussion/help

Reply #1870
Really?  Do I need eye drops?   8)
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 #1871
These meter screenshots need a health warning. "May cause eye cancer". They're hideous. :/
Hi @marc2k3,
thank you for your feedback, may i consider this as a compliment !?
wish you a nice weekend and give us more valuable features of JSP3.
regards,
@ilovefb2k

 

Re: JScript Panel script discussion/help

Reply #1872
@ilovefb2k
thank you as always.

\profile\skins\viking\scripts\jsp3\{deployed} AIMP Analog VU Meter.txt

Skin folder: \profile\skins\viking\images\vnav_fb2k\beat_audio_vu_meter\
(The folder where you unzipped AIMP Analog VU Meter.zip)

 

Hi @Air KEN,
Thank you for your positive feedback, as always.
It is said that this script can not handle those AIMP VU Meter, which are not equal in width.
It makes sense cause yesterday evening, i did not think that such Vu meter exists. i will soon have a look at this metrics regression error and update script (if any).
Wish you a nice weekend,
@ilovefb2k


Re: JScript Panel script discussion/help

Reply #1874
@ilovefb2k
thank you as always.

\profile\skins\viking\scripts\jsp3\{deployed} AIMP Analog VU Meter.txt

Skin folder: \profile\skins\viking\images\vnav_fb2k\beat_audio_vu_meter\
(The folder where you unzipped AIMP Analog VU Meter.zip)

 

Hi @Air KEN,
Thank you for your positive feedback, as always.
It is said that this script can not handle those AIMP VU Meter, which are not equal in width.
It makes sense cause yesterday evening, i did not think that such Vu meter exists. i will soon have a look at this metrics regression error and update script (if any).
Wish you a nice weekend,
@ilovefb2k
hi @all,
ref: AIMP Analog VU Meter, 1.0.1 - 01Nov24
just a quick update to address metrics regression error where both channel background images are not equal in width, and high CPU-load.
regards,
@ilovefb2k