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: Waveform Minibar (mod) (Read 154271 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Waveform Minibar (mod)

Reply #450
Say I update a track because of a previously undiscovered bad rip or something.  Is there a better way to update the waveform cache than nuking it and rebuilding from scratch (which I just did, overnight)?
This ?
Aha!

I looked at that and thought "WTF?", then the penny dropped.  It might have been useful to mention that is on the shift+right click menu!

Thanks.
It's your privilege to disagree, but that doesn't make you right and me wrong.

Re: Waveform Minibar (mod)

Reply #451
Feature request:
Doubleclick on the minibar plays/pauses the track at the (double)clicked position.

Re: Waveform Minibar (mod)

Reply #452
I have been thinking of that feature request over the night and I still don't really see it being useful. Making the seek respond differently to double click would make the main functionality, quick seeking with a single click, worse. I don't see upsides. You can already seek while paused.

Re: Waveform Minibar (mod)

Reply #453
I've been experimenting a lot to give your wavebar a prominent role in my UI.

Let me rephrase ...

1) Bug?
I'm using "Playing track, selected when stopped", which works fine except for the following.
I'm playing a track and the wavebar of this track is shown as expected. Now I click another track in my playlist and then stop playing. Wavebar does NOT change to the selected track. It still shows the wavebar of the previously playing track. If I click the currently selected track once more the wavebar still shows the previously playing track. If I select another track in the playlist the wavebar of that track is selected as expected.

When playback is stopped and the wavebar of the selected track is not shown (the above situation) and I click inside this wrong wavebar playback starts of the selected track and the correct wavebar is shown.

2) Feature request
When playback is stopped and I click inside the wavebar playback is started of the selected track at the clicked position (which is very nice). So from STOP you do issue a PLAY command starting from clicked position.
When playback is paused however, a click in the wavebar just changes the position and does not issue a PLAY (UnPause) command. Then I have to travel the mouse to the Play/Pause button to start playing from the selected position. Makes no sense imo.
Can you change the behavior of a click in the paused wavebar so that it starts playing, just like a click in the stopped wavebar does?

3) Feature request
Since you already issue a PLAY command from STOP via the wavebar and hopefully implement the above feature request (PLAY from PAUSE), the only thing missing would be the possibility to PAUSE playing from the wavebar. Most convenient would be a double leftclick (and not an extra option in the rightclick menu) and thus save a lot of mouse travelling. I hope this kinda makes sense.

Re: Waveform Minibar (mod)

Reply #454
Feature request:
Checkbox to have:
Silent part of sound file (0 at waveform) would render RED line to indicate that there is complete silence.

Why?
I use foobar for various usages. One of them is checking sound assets that will be used in game. I need to sometimes check whether there is complete silence in files or there is faint sound that is shown in waveform as 0 (no peaks visible) but something is still playing back.

Thank you!!

Re: Waveform Minibar (mod)

Reply #455
Hi,

I played some test audio files and when playing a sound that was anti-phased (the same signal but in the opposite phase in both speakers) the wavebar showed nothing (just like silence).
Shouldn't it show a signal? Or if that behaviour is intended how to make the wavebar show something in such circumstances? Maybe there should be seperate bar for each channel?

Re: Waveform Minibar (mod)

Reply #456
It's using a mono mix to generate the waveform.  If your artificial stereo signal is such that a mono mix (A/2 +B/2 ) results in silence, that's what will get saved as the waveform thumbnail.

If you need test signals of that nature, what you could do is temporarily remove one channel and submit the snapshot of that to the database.  Then restore the channel (without changing any of the file details).  So long as you don't then rebuild the thumbnail database, the waveform will be fetched from the database cache and not regenerated from the actual file.
It's your privilege to disagree, but that doesn't make you right and me wrong.

Re: Waveform Minibar (mod)

Reply #457
It's using a mono mix to generate the waveform.  If your artificial stereo signal is such that a mono mix (A/2 +B/2 ) results in silence, that's what will get saved as the waveform thumbnail.

If you need test signals of that nature, what you could do is temporarily remove one channel and submit the snapshot of that to the database.  Then restore the channel (without changing any of the file details).  So long as you don't then rebuild the thumbnail database, the waveform will be fetched from the database cache and not regenerated from the actual file.

If it uses mono mix of the signal what do the upper and lower parts mean? It seems that they aren't just mirror images because sometimes I can see that ex. bottom spikes are different than the upper ones.
How does this component behave when multichannel files are being played - does it downmix all channels to mono or does it downmix just fronts and disregards all the others?

Re: Waveform Minibar (mod)

Reply #458
I would think it's a waveform - music isn't just increases in sound pressure, but a wave with increases and decreases.
Think millionaire, but with cannons.

Re: Waveform Minibar (mod)

Reply #459
I would think it's a waveform - music isn't just increases in sound pressure, but a wave with increases and decreases.
Obviously not the waveform of the actual audio data, but a plot of the peak and average amplitude over time.  Got a better name?

If it uses mono mix of the signal what do the upper and lower parts mean? It seems that they aren't just mirror images because sometimes I can see that ex. bottom spikes are different than the upper ones.
Dunno, but I think you're trying to get more meaning from it than there is.  It's useful to see the upcoming dynamics of a track, especially as a DJ.  It's also more decorative than a plain seek bar.

How does this component behave when multichannel files are being played - does it downmix all channels to mono or does it downmix just fronts and disregards all the others?
No idea.  Is the answer not somewhere in this thread?
It's your privilege to disagree, but that doesn't make you right and me wrong.

Re: Waveform Minibar (mod)

Reply #460
If it uses mono mix of the signal what do the upper and lower parts mean? It seems that they aren't just mirror images because sometimes I can see that ex. bottom spikes are different than the upper ones.

Assuming that Case's modified minibar works the same way that my original components did, the way it processes a waveform is that it divides it up into a fixed number of chunks of roughly even sizes. For each chunk it then finds the minimum and maximum signed value and records that as "min" and "max". It also computes the "RMS" energy of the chunk by squaring all elements, taking their average and then taking the root of that value, a bog-standard "root-mean-square" measurement.

A sequence of those values, however many there are these days, 2048-4096, are used to draw the waveform image as an approximation of the true waveform. For longer waveforms it's going to be a bit biased towards girth, as it's taking the very maximum and minimum values of chunks, and for very short waveform clips it's going to be extremely narrow.

My original seekbar had the ability to process and store individual channels, this primarily driven by that synthetic music like chiptunes and 8-bit NES music tended to have both DC biases and phase cancellation; while the minibars tend to simplify things by downmixing in some manner and consider it Good Enough.

No idea on what happens to multichannel audio for minibars, haven't touched code that since Case gracefully took over development.

Edit: Found my original code on a source host, it did a straight-up channel average of non-mono audio with no consideration of channel purpose.
Stay sane, exile.

Re: Waveform Minibar (mod)

Reply #461
Definitely looks pretty neat for very short tracks. This is from a .umx file that is only about 18 seconds long. Normalized linear scale. I feel like this is somehow relevant. The second one is perhaps even more interesting to look at, and only about 8 seconds long.
Think millionaire, but with cannons.

Re: Waveform Minibar (mod)

Reply #462
That's still a healthy amount of samples at ~800k (assuming 18s at 44.1 kHz) which becomes around 194 samples per bucket. It gets worse below that and for clips that have fewer samples than buckets, you're doomed whatever you do.  :D
Stay sane, exile.


Re: Waveform Minibar (mod)

Reply #464
That would be a separate thing, not an additional feature to Waveform Minibar.
It's your privilege to disagree, but that doesn't make you right and me wrong.

 

Re: Waveform Minibar (mod)

Reply #465
@Case, would it be possible to add an option to save waveforms as separate files in folders containing actual (measured) audio files and not in "central" databse?

Re: Waveform Minibar (mod)

Reply #466
@Case, would it be possible to add an option to save waveforms as separate files in folders containing actual (measured) audio files and not in "central" databse?

Or to change location of the database (ex. to another HDD) or to save only chosen types of files (ex. scan m2ts or SACD-iso but not save the graphs and save all other types) or to scan only chosen types of files (ex. exclide m2ts or SACDiso from scanning) - all that as an option to use or not.

Re: Waveform Minibar (mod)

Reply #467
I'm not really a fan of adding countless options that serve no real purpose. I already regret having so many for a component that was supposed to be a simpler version of Zao's waveform seekbar.

The point of central database is that data for similar tracks is stored only once, the database is in memory and accessing it is instant. All these things are lost if the component litters multiple databases all over the storage devices. Also it will add huge complexity to keep the data together with file moves or copies. A lot of downsides, no benefits.

If you are running out of storage space on the drive where foobar2000 profile is stored, you should address that and not ask for options to store data elsewhere.

Re: Waveform Minibar (mod) [Feature Request]

Reply #468
Add option to see wave form of individual channels like in foo_wave_seekbar
ojos-azules-cat

Re: Waveform Minibar (mod)

Reply #469
Hello!
I've skimmed through this thread and didn't find anyone talking about a VERY TINY "flaw" in this component:
Spoiler (click to show/hide)
Pausing doesn't update waveform minibar instantly, it updates similarly to the default seekbar (which is reasonable!)
JScript Panel "Minimal Seekbar" functions similarly, BUT as you can see, JScript Panel "Seekbar" updates instantly!
I'm not sure what magic it does to achieve that  but maybe it can be done for this component?

JScript Panel "Minimal Seekbar" code:
Code: [Select]
// ==PREPROCESSOR==
// @name "Minimal Seekbar"
// @author "marc2003"
// @import "%fb2k_component_path%helpers.txt"
// @import "%fb2k_component_path%samples\js\lodash.min.js"
// @import "%fb2k_component_path%samples\js\common.js"
// @import "%fb2k_component_path%samples\js\seekbar.js"
// ==/PREPROCESSOR==

var seekbar = new _seekbar(0, 0, 0, 0);
var font = CreateFontString("Segoe UI", 12);
var is_dark = window.IsDark;

var tfo = {
playback_time : fb.TitleFormat('[%playback_time%]'),
length : fb.TitleFormat('$if2(%length%,LIVE)'),
};

var colours = {
dark : RGB(30, 30, 30),
light : RGB(240, 240, 240),
slider_background : RGB(160, 160, 160),
slider_contrast : RGB(196, 30, 35),
};

function on_colours_changed() {
is_dark = window.IsDark;
window.Repaint();
}

function on_mouse_lbtn_down(x, y) {
seekbar.lbtn_down(x, y);
}

function on_mouse_lbtn_up(x, y) {
seekbar.lbtn_up(x, y);
}

function on_mouse_move(x, y) {
seekbar.move(x, y);
}

function on_mouse_wheel(s) {
seekbar.wheel(s);
}

function on_paint(gr) {
gr.Clear(is_dark ? colours.dark : colours.light);
gr.FillRoundedRectangle(seekbar.x, seekbar.y, seekbar.w, seekbar.h, _scale(2), _scale(2), colours.slider_background);

if (fb.IsPlaying) {
var time_width = seekbar.x - _scale(12);
gr.WriteText(tfo.playback_time.Eval(), font, is_dark ? colours.light : colours.dark, 0, 0, time_width, window.Height - 3, 1, 2);
gr.WriteText(tfo.length.Eval(), font, is_dark ? colours.light : colours.dark, seekbar.x + seekbar.w + _scale(12), 0, time_width, window.Height - 3, 0, 2);

if (fb.PlaybackLength > 0) {
gr.FillEllipse(seekbar.x + seekbar.pos(), seekbar.y + _scale(3), _scale(6), _scale(6), colours.slider_contrast);
}
}
}

function on_playback_seek() {
seekbar.playback_seek();
}

function on_playback_stop() {
window.Repaint();
}

function on_playback_time() {
window.Repaint();
}

function on_size() {
seekbar.x = _scale(60);
seekbar.y = (window.Height / 2) - _scale(3);
seekbar.w = window.Width - (seekbar.x * 2);
seekbar.h  = _scale(6);
}
JScript Panel "Seekbar" code:
Code: [Select]
// ==PREPROCESSOR==
// @name "Seekbar"
// @author "marc2003"
// @import "%fb2k_component_path%helpers.txt"
// @import "%fb2k_component_path%samples\js\lodash.min.js"
// @import "%fb2k_component_path%samples\js\common.js"
// @import "%fb2k_component_path%samples\js\seekbar.js"
// ==/PREPROCESSOR==

var seekbar = new _seekbar(0, 0, 0, 0);
seekbar.c1 = RGB(50, 50, 50);
seekbar.c2 = RGB(196, 30, 35);

function on_mouse_lbtn_down(x, y) {
seekbar.lbtn_down(x, y);
}

function on_mouse_lbtn_up(x, y) {
seekbar.lbtn_up(x, y);
}

function on_mouse_move(x, y) {
seekbar.move(x, y);
}

function on_mouse_wheel(s) {
seekbar.wheel(s);
}

function on_paint(gr) {
gr.FillRectangle(seekbar.x, seekbar.y, seekbar.w, seekbar.h, seekbar.c1);
if (fb.IsPlaying && fb.PlaybackLength > 0) {
gr.FillRectangle(seekbar.x, seekbar.y, seekbar.pos(), seekbar.h, seekbar.c2);
}
}

function on_playback_seek() {
seekbar.playback_seek();
}

function on_playback_stop() {
seekbar.playback_stop();
}

function on_size() {
seekbar.w = window.Width;
seekbar.h = window.Height;
}
I realize i'm being very nitpicky, i mean my post to be more of a "hey, maybe this can help" rather than anything else.
I made my forum account to mainly thank you @Case, i love what you've made.

Re: Waveform Minibar (mod)

Reply #470
Seems like i can't edit my post p.p just wanted to add that removing
Code: [Select]
function on_playback_time() {
window.Repaint();
}
from JScript Panel "Minimal Seekbar" makes it behave like JScript Panel "Seekbar" however hacky that might be.

Re: Waveform Minibar (mod)

Reply #471
Hi,
I've been using this plugin for a long time, but today I encountered an issue that I can't diagnose.

I have files downloaded with yt-dlp that originally are .webm with the only audio stream being A_OPUS audio. I've changed the extension of these files to .opus

Once I tried to import the files into foobar2000, the processing took over 15 minutes for files that have total size of 520 MB, and after they imported, foobar2000 absolutely halted and refused to function. After restart, shorter audio files can play with a bit of lag before playback, some longer files can playback without waveform showing anything, and even longer files (30 minutes or so) are freezing foobar2000 and eventually play in the background, but the app is frozen.

Some of the logs I encountered:

Minibar scanning J:xxx.opus
Malformed Ogg stream chain
Malformed Ogg stream chain
Scanning too slow, aborting...

Minibar scanning J:xxx.opus
Track couldn't be analyzed

Also, during import and playback of some files, my CPU (Ryzen 5 5600x) was being absolutely hammered, often at total 50% usage

I've sent two of the files causing the issue, one shorter and one longer, to the developer

EDIT: Forgot to mention, programs such as MPC-BE and Poweramp (that also uses some sort of waveform seekbar), play the audio flawlessly without any issues

Re: Waveform Minibar (mod)

Reply #472
Hello!
Pausing doesn't update waveform minibar instantly, it updates similarly to the default seekbar (which is reasonable!)
JScript Panel "Minimal Seekbar" functions similarly, BUT as you can see, JScript Panel "Seekbar" updates instantly!
I'm not sure what magic it does to achieve that  but maybe it can be done for this component?
It's intentional that the seekbar position isn't artificially stopped when you hit pause. If you try the smooth fading output options and set a longer fade out time you will notice that playback can actually still advance after pausing. If the seekbar was artificially stopped its position would no longer match the reality. The JScript seekbar sample that you think is working will show incorrect position and will jump ahead after unpausing.
The wiggle you see that the bar moves backwards is a problem with timing information between the core and outputs. If you update to foobar2000 v2.2 previews it should be fixed.

Re: Waveform Minibar (mod)

Reply #473
I have files downloaded with yt-dlp that originally are .webm with the only audio stream being A_OPUS audio. I've changed the extension of these files to .opus
That was a mistake. The files you shared with me are WebM files and .opus is a wrong extension for them. If you want to convert them into regular Opus files you'll need to remux them. FFmpeg can help with that.

Once I tried to import the files into foobar2000, the processing took over 15 minutes for files that have total size of 520 MB, and after they imported, foobar2000 absolutely halted and refused to function. After restart, shorter audio files can play with a bit of lag before playback, some longer files can playback without waveform showing anything, and even longer files (30 minutes or so) are freezing foobar2000 and eventually play in the background, but the app is frozen.
I'm on the road at the moment and only with a laptop. I didn't have the patience to see if the larger file would ever load in foobar2000, but the slow loading has nothing to do with Minibar. The incorrect extension makes foobar2000 use a bad decoder for the file - it apparently works somewhat so the player doesn't give up, but not well enough to actually be usable.

The small file is not slow enough to show me any problems. With default settings the waveform generation for it will be aborted because it decodes too slow and that is it. Allowing waveform generation for slow decoding sources makes the waveform visible and everything works perfectly.
But I can imagine that if you have multiple larger problem files in a playlist and you click around triggering waveform generation for them your CPU cycles will get consumed by the stuck background decoder instances. The slow decoding abortion check can't even help here if opening the track takes forever, since the decoding speed is only checked in the actual decoding loop.

Once I'm able I'll check if my assumption about the slow opening was correct and improve the slow decode detection to include the decoder instantiation too.

But for usability and to support correct file naming I highly recommend fixing the file extensions or remuxing the files to a format you want. Though file opening being this slow feels like a bug, I expect Peter to fix it for a future version.

Re: Waveform Minibar (mod)

Reply #474
The wiggle you see that the bar moves backwards is a problem with timing information between the core and outputs. If you update to foobar2000 v2.2 previews it should be fixed.
That was annoying me the most, can confirm it's fixed in v2.2!
Thank you very much :)