Modify
Warning Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#10214 closed Patch - Feature (fixed)

88-Key Piano Visualization for MythMusic

Reported by: MythTV-Trac@… Owned by: paulh
Priority: minor Milestone: 0.25
Component: Plugin - MythMusic Version: Master Head
Severity: medium Keywords: visualization, new
Cc: Ticket locked: no

Description

Here's the pull request I just put in on GitHub? :

I've created a Piano Visualization to mythmusic.

Basically, it's a spectrum analyzer that detects frequencies specifically at the pitches of a piano keyboard, and then displays the notes being pressed on a piano keyboard displayed across the screen.

It makes interesting viewing (particularly for piano music, of course). But it's cool to look at for all styles of music...

One feature, coding-wise, is that an additional private variable had to be added to MainVisual?, and two extra virtual functions to VisualBase?, so that the Piano visualization can inspect every sample of the audio.

Most visualizations don't inspect every sample of the audio, typically looking at 512 samples every 50ms. Since exact pitch detection (on each of the 88 keys) takes more than 512 samples, we need to collect data over far longer windows (rough calculation : 10 cycles of 440Hz ~=1000 samples at CD rates. Lower notes take correspondingly longer).

The interfaces to all the other visualizations require no changes - no extra work is done unless the plugins specifically use it.

Please let me know if there's anything else you need from me. Licensing (of course) to comply with the rest of MythTV.

And thanks for MythTV generally : I've been a happy user for many years - and am glad that I finally have something interesting to give back.

Martin
:-)

Attachments (0)

Change History (5)

comment:1 Changed 2 years ago by Github

  • Milestone changed from unknown to 0.25
  • Resolution set to fixed
  • Status changed from new to closed

MythMusic: Add a 88-Key Piano Visualization

Basically, it's a spectrum analyzer that detects frequencies specifically at
the pitches of a piano keyboard, and then displays the notes being pressed on
a piano keyboard displayed across the screen. Thanks to Martin Andrews for the
patch. Closes #10214.

Note: Edited slightly to match our coding standards.
Signed-off-by: Paul Harrison <pharrison@…>

Branch: master
Changeset: 845b087f99b5daf76de3c0381f88e2265ca858a3

comment:2 follow-up: Changed 2 years ago by jyavenard

I had trouble compiling this on my machine.

Upon investigation, the culprit is in the Piano class, and the two <vector> members: rects and magnitude.

In Piano::draw, you call the method data() on the <vector>

std::vector do not have a data() method, only QVector do.

So either the type of rects and magnitude should be changed to QVector, or replace the data() call with something like: &rects[0] (or use the .begin() iterator).

I'll be modifying the code accordingly

comment:3 in reply to: ↑ 2 Changed 2 years ago by MythTV-Trac@…

My apologies - it compiles fine on my machine (Fedora 16). It looks like the code in there is a mismash of Spectrum (QVector) and StereoScope (vector<double>), since I wasn't trying to reinvent an idiom that had been used before. { Unless (possibly) they've also been updated in the meantime. }

Thanks for figuring out the fix.

comment:4 Changed 2 years ago by jyavenard

Any particular reason why in one class you used QVector, and in the ther other std::vector ?

Especially a vector containing QObjects.

Not that it matters much, it's more to do with consistency and portability. STL implementations vary across platforms, while Qt is the same everywhere, hence more portable

comment:5 Changed 2 years ago by jyavenard

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.