Piano lib

Programming applications for making music on Linux.

Moderators: MattKingUSA, khz

Post Reply
j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 357 times

Piano lib

Post by j_e_f_f_g »

I created a new lib for developers called Piano Lib. From the docs:

Many programs draw a graphical piano keyboard using pixmaps or bitmaps. The main problem with pixmaps/bitmaps is that they're designed for a particular screen resolution. So if your enduser has a large screen resolution, then the piano keys may be too small to operate easily with a mouse. Conversely, if your enduser has a small screen resolution, then the piano keys may be so large that too few of them are visible onscreen. There are functions to convert resolutions on-the-fly, but they don't always scale well. And if you need features like highlighting (ie drawing in a different color) various keys, or zooming in/out upon keys, then things quickly get complicated with bitmaps.

The Piano library offers a developer a set of functions to display/operate a graphical piano keyboard without pixmaps or bitmaps. The keyboard can be set to any number of keys upto the 88 keys of a grand piano. For example, it can be set to show an octave and a half from low G to high C. Then the keyboard can be scaled on-the-fly to any resolution. For example, the keys can get bigger as the user enlarges the window, or smaller as he shrinks the window.

The Piano library also offers zooming in, where the keys get bigger, not because the piano on the whole gets bigger, but because the user has zoomed in on a smaller range of keys, for example only one of the 2 octaves. When zoomed in, the user can scroll the keyboard left or right to bring other keys into view.

With both size scaling as well as zoom, regardless of the user's screen resolution, he'll always be able to set the keys to a useable size.

The Piano library also offers highlighting (displaying some keys in a different color). You can highlight a range of keys, or individual keys.

You can choose to have the Piano library draw zoom-related buttons beside the keyboard. There are 4 buttons. The 2 buttons to the right of the piano ("+" and "-") zoom in and out, respectively. When zoomed in, the 2 buttons to the left of the piano (arrows) scroll left or right.

You can draw as many keyboards as you desire, each with its own settings (size, zoom/scroll, key range, selection).

The Piano library works on both Windows and Linux, so you use the same Piano functions on both systems. Example apps included. detailed docs.

http://wikisend.com/download/883970/piano.zip

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

fundamental
Established Member
Posts: 165
Joined: Thu Nov 07, 2013 1:19 pm
Been thanked: 1 time

Re: Piano lib

Post by fundamental »

It certainly sounds interesting, though I don't really use GTK for any of my UI work.

Why don't you put it up on a site where it will get some more exposure than a wikisend url which will end up expiring in due time?
The place with the lowest barrier to entry (with a large community) in this case would likely be github.
ZynAddSubFX maintainer
j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 357 times

Re: Piano lib

Post by j_e_f_f_g »

don't use GTK for any of my UI work.
QT?
put it up on a site
Yeah, I'll do that later. I put up 6 projects on Sourceforge, and then it wouldn;t let me create any more. Something about a quota, which hopefully will time out.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

fundamental
Established Member
Posts: 165
Joined: Thu Nov 07, 2013 1:19 pm
Been thanked: 1 time

Re: Piano lib

Post by fundamental »

j_e_f_f_g wrote:
don't use GTK for any of my UI work.
QT?
Some Qt, but mostly fltk at the moment
ZynAddSubFX maintainer
Post Reply