Author Topic: [Vis] SpectrumBars  (Read 5612 times)

tniemi

  • Posts: 42
[Vis] SpectrumBars
« on: 3 Mar '10 - 13:19 »
I liked my simple Qt skin test so much I made a version that does not require Qt:

    SpectrumBars - A basic spectrum style plug-in for XMPlay

     - Simple but polished
     - Four modes, click with middle button to change
     - Fully configurable via the vis.ini file
     - Linear or logarithmic scale
     - Source code included

Let's see if the attachment works now...

Dotpitch

  • Posts: 2871
Re: [Vis] SpectrumBars
« Reply #1 on: 3 Mar '10 - 14:13 »
The 7z archive seems to be corrupt.

tniemi

  • Posts: 42
Re: [Vis] SpectrumBars
« Reply #2 on: 3 Mar '10 - 15:06 »
The 7z archive seems to be corrupt.
Well, works for me. ??? Please check the file you downloaded with notepad.exe. Did you recieve an error message instead?

In the mean time, here is an alternative link!

Dotpitch

  • Posts: 2871
Re: [Vis] SpectrumBars
« Reply #3 on: 3 Mar '10 - 15:29 »
Please check the file you downloaded with notepad.exe. Did you recieve an error message instead?
The file on the mirror is 15 bytes larger, and that one does work.

Ah, it looks pretty good :). Simple yet effective, and configurable!
Fully configurable via the vis.ini file
What does SamplesPerBar do? Resize the FFT data to match the number of bars displayed?

amit

  • Posts: 723
Re: [Vis] SpectrumBars
« Reply #4 on: 3 Mar '10 - 16:51 »
Nice!

Just to give an idea here are two snapshots:

biglebowski

  • Posts: 20
Re: [Vis] SpectrumBars
« Reply #5 on: 4 Mar '10 - 00:08 »
I searched forever at one point for this exact plugin. Thanks for this.


[edit]

0xFFFFFF00

Is that Visual C++ hex? I have one color picker that seems to support it, but all colors render as black in the vis.
« Last Edit: 4 Mar '10 - 00:20 by biglebowski »

saga

  • Posts: 2179
Re: [Vis] SpectrumBars
« Reply #6 on: 4 Mar '10 - 02:53 »
I would guess that it's in Little Endian format (which happens to be the number representation on x86, not Visual Studio or whatever), so you have to read the bytes in reverse order, i.e. it's not RGBA but ABGR. That's just a guess, though.

Jace

  • Posts: 825
Re: [Vis] SpectrumBars
« Reply #7 on: 4 Mar '10 - 08:55 »
I'd hazard to guess that it's ARGB. :)

As the default HighColour is 0xFFFF0000, medium 0xFFFFFF00 (which does mix into yellow) and Low at 0xFF026732, showing mostly green. Alpha channel stays at full, so it's fully visible.

tniemi

  • Posts: 42
Re: [Vis] SpectrumBars
« Reply #8 on: 5 Mar '10 - 16:43 »
Hello!

As the default HighColour is 0xFFFF0000, medium 0xFFFFFF00 (which does mix into yellow) and Low at 0xFF026732, showing mostly green. Alpha channel stays at full, so it's fully visible.
That is absolutely correct. The first one is alpha, and it has to be FF, because it is respected. Allowing decimal rgb(r,g,b) value could have been nice feature though.

(I think you can use a web hex colour picker/editor. Just replace the '#' character with '0xFF'.)

Quote
What does SamplesPerBar do? Resize the FFT data to match the number of bars displayed?
XMPlay provides a 256 byte spectrum sample data [0..255] for left and right channel.

NumberOfBars=25
SamplesPerBar=2

shows 25 bars, visualising sample range [1..50] (NumberOfBars * SamplesPerBar = 50). Using settings:

NumberOfBars=255
SamplesPerBar=1

Visualises the sample range [0..254].

There are few caveats in this that have been taken care of:
  • Sample #255 (the last one) is actually not a spectrum sample. It is a some sort of average channel volume. This is not used.
  • Sample #0 (the first one) is over-presented. The algorithm ignores it when it is not useful.
  • The spectrum data provided by Sonique visualisation interface is extremely poor at the range [128..254]. On most music tracks this section gives only numbers 0, 1, 2. This is bothersome with logarithmic scale. A 1.0 sample jitter is added to hide this.

A great TODO idea would be to ignore the Sonique sample data altogether and calculate a new high resolution one from the waveform data. The waveform data is high resolution enough for this and there are enough calculation cycles for this (the visualisation itself is simple). The only problem is that I have to learn how to extract spectrum data from an oscilloscopic view! ;D
« Last Edit: 5 Mar '10 - 17:12 by tniemi »

Dotpitch

  • Posts: 2871
Re: [Vis] SpectrumBars
« Reply #9 on: 5 Mar '10 - 19:00 »
The spectrum data provided by Sonique visualisation interface is extremely poor at the range [128..254]. On most music tracks this section gives only numbers 0, 1, 2. This is bothersome with logarithmic scale. A 1.0 sample jitter is added to hide this.
Sounds like the maximum frequency does not depend on the currently playing file, i.e. it always provides 48 kHz range. If you play CD-quality audio however, there's nothing above 22 kHz. Ian can probably shed some light on how the array is calculated.

A great TODO idea would be to ignore the Sonique sample data altogether and calculate a new high resolution one from the waveform data. The waveform data is high resolution enough for this and there are enough calculation cycles for this (the visualisation itself is simple). The only problem is that I have to learn how to extract spectrum data from an oscilloscopic view! ;D
FFT. Requires quite some cycles, so it seems a bit odd to ignore the spectral data provided by XMPlay.

Chinese Sausage

  • Posts: 424
Re: [Vis] SpectrumBars
« Reply #10 on: 6 Mar '10 - 01:31 »
Nice plugin. It IS simple but polished.

Nice to see new plugins being developed.
Thank you.
Cheers 8)

tniemi

  • Posts: 42
Re: [Vis] SpectrumBars
« Reply #11 on: 9 Mar '10 - 06:43 »
Sounds like the maximum frequency does not depend on the currently playing file, i.e. it always provides 48 kHz range.
I have no idea. All this is very new to me, as I know almost nothing about the science behind the music.

The provided spectrum range is a bit problematic as 100Hz peaks at spectrumSample[0] and 440Hz at spectrumSample[4]. I have tried all kind of logarithmic scaling algorithms (area, diff, sum) with no luck. Still seeking for a better solution.

FFT
I was afraid of this... Visualisation called "Spectrum 2.0Re leo.s" does exactly this, I am pretty sure about it. For example, it can visualise under 100Hz.

I try to attack this problem if I have some free time in my future. I think I would have to pre-calculate some wave tables. Oh, well. I was once a math major...

- - -

Thank you for everyone for your comments. This is the first time since 80286 processors that I try to create real time graphics. Oh the luxury of C/C++!

Chinese Sausage

  • Posts: 424
Re: [Vis] SpectrumBars
« Reply #12 on: 10 Mar '10 - 13:25 »
I'm enjoying this vis to the max, it is now the all-purpose one that I use by default. Simple, clean, low on RAM, and very sensitive to all kinds of music. And looks great on fullscreen too! 8)

amit

  • Posts: 723
Re: [Vis] SpectrumBars
« Reply #13 on: 14 Mar '10 - 15:35 »
Again thank you for the viz.

A couple of suggestions:

1. Allow to choose also the background color.
2. Allow to show more than one spectrum of audio stream. Maybe two spectrums for stereo?

biglebowski

  • Posts: 20
Re: [Vis] SpectrumBars
« Reply #14 on: 20 Mar '10 - 13:50 »
Again thank you for the viz.

A couple of suggestions:

1. Allow to choose also the background color.
2. Allow to show more than one spectrum of audio stream. Maybe two spectrums for stereo?

An image background would be pretty interesting. It wouldn't even have to scale.

Chinese Sausage

  • Posts: 424
Re: [Vis] SpectrumBars
« Reply #15 on: 10 May '10 - 19:32 »
Again thank you for the viz.

A couple of suggestions:

1. Allow to choose also the background color.
2. Allow to show more than one spectrum of audio stream. Maybe two spectrums for stereo?

An image background would be pretty interesting. It wouldn't even have to scale.

How about additional colors themes on the bars? (Configurable with the middle mouse button) :D

i.e.
DEFAULT

LowColour=0xFF026732
MediumColour=0xFFFFFF00
HighColour=0xFFFF0000

BLUEISH

LowColour=0xFFFFFFFF
MediumColour=0xFF00FFFF
HighColour=0xFF0000FF

GOTHIC

LowColour=0xFFFFFFFF
MediumColour=0xBBB8797D
HighColour=0xDDD4000E

RED, WHITE & BLUE

LowColour=0xFF0000FF
MediumColour=0xFFFFFFFF
HighColour=0xFFFF0000

WHOLE LOTTA ROSY

LowColour=0xFFFFFFFF
MediumColour=0xFFFF99FF
HighColour=0xFFFF00CC

SHADES OF GRAY

LowColour=0xFFFFFFFF
MediumColour=0xDDDDDDDD
HighColour=0x88888888
« Last Edit: 11 May '10 - 05:32 by Chinese Sausage »