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

MythMusic: Improve Spectrum and Squares #771

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

twitham1
Copy link
Contributor

@twitham1 twitham1 commented Jul 7, 2023

This applies the lessons learned in Spectrogram to the original Spectrum and Squares, greatly improving them:

  • FFT of complete signal
  • same FFT: 16384 bins, decaying window, peak of bins
  • same Mel Scale replacing log scale (much improved resolution in low frequencies, distributes the sound better across the whole screen)
  • upgrade to 128 bars for better resolution

@twitham1 twitham1 changed the title Improve Spectrum and Squares of MythMusic MythMusic: Improve Spectrum and Squares Aug 8, 2023
By borrowing lessons learned from Spectrogram: process the whole
signal, use the same 16k FFT and MelScale, upgrade to 128 display
bars, separate left and right channels.  On the menu, Spectrum is
renamed to SpectrumBars and SpectrumDetail becomes then new Spectrum
to sit next to the related Spectrogram.
@twitham1 twitham1 force-pushed the visualize-spectrum branch from 8bed561 to 3000550 Compare August 19, 2023 06:03
@twitham1 twitham1 marked this pull request as ready for review August 19, 2023 06:07
@Jpilk
Copy link

Jpilk commented Aug 19, 2023

I have master 0279fd2 running now, with MCW1.10 locally patched to display recordedid as in issue #464.

The only difficulty seen so far is inability to quit full-screen visualiser when the ident popup is continually refreshed, as with ClassicFM streaming. That needs ctrl/c to quit mythfrontend.

http://ice-sov.musicradio.com:80/ClassicFMMP3

Copy link
Contributor

@linuxdude42 linuxdude42 left a comment

Choose a reason for hiding this comment

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

A couple of minor comments.

mythplugins/mythmusic/mythmusic/visualize.h Outdated Show resolved Hide resolved
Comment on lines -1318 to 1320
m_analyzerBarWidth = m_size.width() / 64;
m_analyzerBarWidth = m_size.width() / 128;

if (m_analyzerBarWidth < 6)
m_analyzerBarWidth = 6;
Copy link
Contributor

Choose a reason for hiding this comment

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

Possibly replace this with something like:

m_analyzerBarWidth =
    std::max(m_size.width() / kNumBarsWanted, kMinBarSize);

and define the two constants in the Spectrum class with:

static constexpr int kNumBarsWanted {128};
static constexpr int kMinBarSize {6};

I know there are close to 15,000 other magic numbers in the code, so I'll leave it to you whether to change this. I do think this type of change makes the code more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally, for a number used in 1 place, the number is easier to read than words. Because if it is words I have to go lookup where the words resolve to a number. So reading 128 and 6 right here is easier for me.

But certainly numbers used in more than 1 place should be words instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

You understand the code, so its not surprising that you find the numbers easier. For someone reading the code for the first time, the descriptive constant names would be easier.

@twitham1
Copy link
Contributor Author

The only difficulty seen so far is inability to quit full-screen visualiser when the ident popup is continually refreshed, as with ClassicFM streaming. That needs ctrl/c to quit mythfrontend.

http://ice-sov.musicradio.com:80/ClassicFMMP3

Wow, that's bad! But totally unrelated to this PR. I think I can fix it but let's work on that over on #790.

@linuxdude42 linuxdude42 merged commit 77a0593 into MythTV:master Aug 21, 2023
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.

3 participants