Piano roll


#1

I’m trying to write a piano roll, but I’m not sure what would be a nice design to do so. Maybe asking here is a bit outside of the scope of the forum, but I reckon there’s a good chance someone else did the same thing before me.

My initial guess would be to make a big PianoRollComponent that has a number of NoteComponent children and lives inside a Viewport.
One concern here is possibly having loads of child components; however my immediate concern is the following:

I figured my data could simply be a wrapper around MidiMessageSequence that notifies Listeners on changes so that data and GUI are automatically kept in sync.
I imagine an edit sequence to look something like this:

  1. Mouse event handling in NoteComponent, modifies MidiMessageSequence data through wrapper, which notifies listeners telling which event changed.
  2. PianoRollComponent listens for event changes and updates the NoteComponent corresponding to the changed event.

This sounds good but step 2 requires me to maintain a map between events in the MidiMessageSequence and corresponding NoteComponents; which doesn’t seem right (and requires a MidiMessageSequence alternative that doesn’t invalidate iterators or has some event id).

Another option would be to have PianoRollComponent do all drawing of notes and corresponding mouse handling itself, and on changes to the data simply redraw the entire visible area. Or the same thing but destroying/creating NoteComponents for every change to the data or the Viewport’s visible area.

Anybody got a nice solution?


#2

http://code.google.com/p/juced/source/browse/#svn%2Ftrunk%2Fjuce%2Fsrc%2Fextended%2Fcontrols%2Fgrid


#3

^ That link tries to clone to my GitHub and falls over.

http://www.juce.com/forum/topic/what-happened-juced-project <-- seems to have reappeared here.

So: https://github.com/kunitoki/juced/tree/master/juce/src/extended/controls/grid


#4

You do know that you can just subclass Juce::MidiKeyboardComponent and override drawWhiteNote() and drawBlackNote() to customize the visuals, right? 

 

edit: didn't realize this post was from 2011 and pi is bumping the old thread (don't bump 5 year-old threads)


#5

Bumping up old thread as it reuses a perfectly good existing title, so people searching in the future for 'piano roll' don't have to wade through a zillion hits.

"One thread per topic" kind of thing.

Besides, in addition to bumping, I am repairing out-of-date information.

I can't see any logic that would favour creating a new topic.

π


#6

...than read through a zillion threads! A topic 5 years old is probably obsolete anyway...

Admittedly, in the current forum you can't sort the hits by date, but hopefully that will be doable in the new forum. And I would certainly not mind a bumper limit...

By the way, why *did* you bump this thread? Did you have a question or suggestion?

Don't say you bumped a 5 year old thread just to say that a 5 year old link is bad...


#7

I wasn't actually bumping or initiating a new conversation. I was fixing an old link. Surely that can't be bad thing!

I'm putting together some kind of piano roll visualisation, so I was browsing old forum posts.

It's quite interesting to find that open source JUCE project, it looks as though a lot of work has gone into it.

It makes me wonder how much material is out there, and whether it would be practical to do some kind of community organising effort so all this work is not lost, catalogued somehow.

May be a MediaWiki? I would be happy to offer mine (http://pipad.org/wiki/index.php/Main_Page) --  but it would be more professional to create a dedicated server and do it properly.

I will propose this in a separate thread.

EDIT: A quick search shows that Jules did indeed create a wiki, I vaguely remember that he took it down because nobody really used it. It does seem like it would be a good idea though...

π