Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[upgrade] Use FFT, various fixups, add more settings #49

Open
wants to merge 11 commits into
base: Nexus
Choose a base branch
from

Conversation

kujub
Copy link

@kujub kujub commented May 7, 2021

Hi all!
First of all this will make it actually work like a spectrum analyzer.
Note: Changes for GL only (no directx)

Additional fixes and improvements:

  • cleanup code
  • fix swapped height-speed setting values and enable one more option to disable delaying
  • Render: fix wireframe mode and performance
  • perspective: honor display and pixel aspects to fix excessive distortion, add some settings
  • ... (see below)

@lrusak lrusak requested review from sarbes and AlwinEsch May 7, 2021 19:08
Copy link
Member

@AlwinEsch AlwinEsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Becomed time to look. Your changes looks good and makes it better, only few parts need changed, see notes on related places.

As only part on view where seems to improved, is when no sound comes anymore, There stays one row still a bit up:
Bildschirmfoto vom 2021-07-17 12-13-43

<formatlabel>30024</formatlabel>
<popup>false</popup>
</control>
</setting>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this three new settings only works with GL must you add the:

          <dependencies>
            <dependency type="visible">
              <or>
                <condition on="property" name="IsDefined">HAS_GL</condition>
                <condition on="property" name="IsDefined">HAS_GLES</condition>
              </or>
            </dependency>
          </dependencies>

to prevent show on Windows and his DX.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As only part on view where seems to improved, is when no sound comes anymore, There stays one row still a bit up:

This was never seen here. If you paused, it is maybe normal behavior because shifting rows is paused too then.

As this three new settings only works with GL must you add the:

to prevent show on Windows and his DX.

Done


msgctxt "#30024"
msgid "%i%%"
msgstr "%i%%"
Copy link
Member

@AlwinEsch AlwinEsch Jul 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With formal labels was something changed inside Kodi and with this style now no more supported (on Nexus) and need:

msgid "{0:d}%"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


msgctxt "#30022"
msgid "%+i%%"
msgstr "%+i%%"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What makes the + before the i, not know as this, makes it only then number if higher as 0?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was just kinda cosmetics because actually "0%" is 100% (default) and "+10%" is 110% and so on.
Removed now as i don't know how to do this with the new format.


msgctxt "#30024"
msgid "%i%%"
msgstr ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with use now the translation system by Weblate, would it better to leave de_de and the en_us unchanged.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (reverted)

@AlwinEsch
Copy link
Member

As Note about Windows, I think also to kick the Windows DX support complete and to make via the "Angle" as GLES with it.

There then also the Question has you tested with GLES and worked correct?
And thanks a lot to look for improvements here, your help is welcome 👍

@AlwinEsch AlwinEsch changed the base branch from Matrix to Nexus July 17, 2021 16:08
@AlwinEsch
Copy link
Member

Have changed the target branch to "Nexus", after them here final can we create a backport about for Kodi Matrix.

@kujub
Copy link
Author

kujub commented Jul 18, 2021

There then also the Question has you tested with GLES and worked correct?

Tested GL only (on Fedora 33 x86-64). It seems kodi is built with support for GL and GLES, but i don't know how to switch.

Update: Rebuilt kodi 19.1 with -DAPP_RENDER_SYSTEM=gles. Then rebuilt visualization. Appears to work.

@kujub kujub requested a review from AlwinEsch July 18, 2021 08:21
@AlwinEsch
Copy link
Member

AlwinEsch commented Jul 18, 2021

Has also tested now with GLES and works, with my reported bars seems related to the sound format on played "m4a" files, by other formats it was not present.

From my side is the request now OK and can in. Only if possible can you cleanup the commits a bit, so that the last correction commits would no longer be necessary.

With your request, it works now with his bars much more correct!

@kujub
Copy link
Author

kujub commented Jul 18, 2021

Has also tested now with GLES and works, with my reported bars seems related to the sound format on played "m4a" files, by other formats it was not present.

OK. I only played mp3 and flac.

@kujub kujub force-pushed the Matrix branch 3 times, most recently from 4f0e32b to 5084ad1 Compare July 20, 2021 21:02
@kujub
Copy link
Author

kujub commented Jul 21, 2021

From my side is the request now OK and can in. Only if possible can you cleanup the commits a bit, so that the last correction commits would no longer be necessary.

Squashed all fixup commits also dropping some trailing white-space.

@kujub kujub changed the title Use FFT data, fix performance, fix wireframe mode, do some cleanup Use FFT data, various fixups, add more settings Jul 22, 2021
@kujub
Copy link
Author

kujub commented Jul 22, 2021

Note: Actually newly added: SetSetting cleanup, Rotation speed setting. Perspective settings just rebased for commit cleanup.

@AlwinEsch
Copy link
Member

About this request must be also checked by other Team Member's, like to use FFT, thats why for me OK. Only not complete sure about human feeling on his current displayed bars, as them mostly all complete up and slightly move then up/down to show.

Here as images:

  • WIth this request on 1000Hz Sinus tone
    Bildschirmfoto von 2021-09-04 16-40-38
  • Here before on 1000Hz Sinus tone
    Bildschirmfoto von 2021-09-04 16-42-57
  • Here with new on normal played audio:
    Bildschirmfoto von 2021-09-04 16-51-42
  • And here how on version before:
    Bildschirmfoto von 2021-09-04 16-53-09

@kujub
Copy link
Author

kujub commented Sep 4, 2021

Only not complete sure about human feeling on his current displayed bars, as them mostly all complete up and slightly move then up/down to show.

a) The bar heights are currently scaled to the full dynamic range of CDDA (96 dB ) which is almost never really used. We could add one more setting to allow smaller ranges too.

b) About sine-waves: Ideally there should be only one row of bars up, but only if one of the FFT-frequencies is exactly matched. The wave must fit exactly into the probing window used so that the beginning matches the end to really have a sine-wave detected. The only perfect frequency I found so far is 11025 Hz. (edit: 44100 Hz sample rate file) Other visualization addons seem to implement their own FFT-code, so I guess kodi's built in one isn't absolutely perfect. [edit: problem was: It did not use no window function.]

@kujub kujub force-pushed the Matrix branch 2 times, most recently from 4d81f7b to 41369bb Compare September 8, 2021 17:04
@AlwinEsch
Copy link
Member

Thanks for the update will look next time.

With the bars seen, by work on another addon, a good place how I expect with FFTW. Here by ShaderToy https://www.shadertoy.com/view/4ljGD1 it shows below on "iChannel0" some bars where nice go up by related sound frequency.

@kujub kujub force-pushed the Matrix branch 6 times, most recently from 84a0c53 to b1f4f9e Compare November 26, 2023 23:05
@kujub kujub force-pushed the Matrix branch 13 times, most recently from 5a340de to fbf69a7 Compare January 11, 2024 10:07
@kujub kujub force-pushed the Matrix branch 3 times, most recently from d8d7cf3 to bca8a79 Compare January 15, 2024 18:08
kujub added 6 commits January 16, 2024 10:00
Really implement spectrum analyser functionality
A new setting allows one to set the dynamic range displayed to whatever is used in practice (up to 144 dB for full 24 bit audio)

Note: A new class KFFTR was derived from MRFFT used in other visualizations:
* discard DC bin
* fix hardcoded stereo (just sum up all channels)
* fix broken Hann window function (!)
Wireframe: Show all edges of bars/cuboids, but w/o confusing diagonal lines.
Performance: Don't call glDrawArrays separately for each single bar. Enable face-culling.
Take account of display and pixel aspects and allow to change field size, tilt and base (bottom of bars).
With zero tilt and negative base, perspective distortion can be entirely eliminated and all bars stand vertical then.
With 90° tilt a funny bird's-eye view can be achieved.
Additionally the size of the x*z-field can be changed. Smaller is useful for bird's-eye view and bigger for zero tilt with rotation fixed at 0° or 90° etc.
Rotation speed setting is added too.
Allow up to 128 x 128 bars.
kujub added 5 commits January 16, 2024 14:12
New default color mode (beside of legacy mode): Up to two bars are stacked with blue->green, green->red gradients from bottom to some constant heights. So top colors depend on relative bar heights.

New monochrome color modes: Monochrome gradient from dark to bright amber/blue/green.

New bar height setting 'Flat': Allow clean 2D views with changing bar top colors.

Points mode: Only draw one point at top mid.
Implement smooth animation for backwards shift.
Take account of fps for bar height animation speed.
Allow to start/stop/revert rotation seamlessly at any point by switching back and forth on a set of presets with normal/zero/reverse rotation settings by using hotkeys or to change any other settings parameters on the fly as long as the number of bands remains equal.
A settings category called 'Presets template' allows easy setup and change of a bunch of similar presets.
@kujub
Copy link
Author

kujub commented Jan 16, 2024

Updates:

Upgrades:

  • Add bands setting (allow up to 128 x 128 bars)
  • More color modes, zero bar height, single points at top mid (if points mode)
  • Smooth animation
  • Add presets and reverse rotation setting (see commit msg)
  • Prepare new screenshots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants