Opened 13 years ago
Closed 13 years ago
Last modified 13 years ago
#10214 closed Patch - Feature (fixed)
88-Key Piano Visualization for MythMusic
Reported by: | 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 :-)
Change History (5)
comment:1 Changed 13 years ago by
Milestone: | unknown → 0.25 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:2 follow-up: 3 Changed 13 years ago by
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 Changed 13 years ago by
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 13 years ago by
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
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@…>