|
|
|
10-15-2020, 06:20 AM
|
#1
|
Human being with feelings
Join Date: Oct 2019
Posts: 1,082
|
Adding graphical piano keyboard to JSFX as simply as possible
I've written a crude small JSFX that processes incoming MIDI. The code can be improved, but it works as it is. I would very much like to have a small GUI. All I need for the time being is the representation of a MIDI keyboard with keys that can be "turned on" in two different colors.
Is there a simple way, ready-made library or other, that would allow me to add the keyboard without having to code for days? I hope for something that can interface with JSFX eel, or a simple way to connect Lua and eel.
|
|
|
10-15-2020, 06:47 AM
|
#2
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
|
Did you try Piano Display by Geraint Luff?
|
|
|
10-15-2020, 06:53 AM
|
#3
|
Human being with feelings
Join Date: Oct 2019
Posts: 1,082
|
Looks very nice! I'd like to incorporate something like that. But that's a standalone script. It doesn't look easy to dissect and integrate. A library with a reaonable API would be my first choice.
|
|
|
10-15-2020, 07:21 AM
|
#5
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
|
Separate tools are better not worse, no need to incorporate anything, for what?
|
|
|
10-15-2020, 07:42 AM
|
#6
|
Human being with feelings
Join Date: Oct 2019
Posts: 1,082
|
I have no experience at all with GUIs, so the main plugin controls are implemented as basic sliders and take up enough space already. I would REALLY like text inputs and MIDI learn for my controls, but that's another story. First thing is the keyboard display.
I think this is a common enough necessity. Any coder that comes up with a flexible, workable library is likely to see his brainchild used in lots of JSFXs.
@TonE
Separate tools are better when they can communicate with one another to build more complex tools. I need the keyboard display to highlight keys in different colors, according to the main plugin's instructions. Not all keys are being input or output to the actual MIDI stream.
@DarkStar
Good looking tool! Unfortunately, like Geraint Luff's Piano Display, its code does not looke like it's meant to be included into another JSFX. Can it be fired up and controlled remotely? Or would you be willing to tweak the code to turn it into a small library providing a rudimentary API?
I would need the following functionality:
- Toggle keyboard visible/invisible. All the surrounding borders and decorations are unnecessary in my case: I'd like to keep the whole thing as small as possible.
- Display a specified range. Basically the whole 88 keys, but sometimes less would suffice depending on the plugin's settings. Ideally, the whole 127-key shebang could be available, although there are few use cases for that.
- "Turn on" (highlight) a key in a specified color (a limited palette of 3-4 colors could work), "turn off" a key.
|
|
|
10-15-2020, 10:50 AM
|
#7
|
Human being with feelings
Join Date: May 2006
Location: Surrey, UK
Posts: 19,681
|
That's quite a lot of detailed work
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
|
|
|
10-15-2020, 11:36 AM
|
#8
|
Human being with feelings
Join Date: Oct 2019
Posts: 1,082
|
Quote:
Originally Posted by DarkStar
That's quite a lot of detailed work
|
Yeah, I thought so. More than the quick'n'dirty library, I was hoping for some kind of inter-plugin communication.
|
|
|
10-15-2020, 05:26 PM
|
#9
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
|
Quote:
Originally Posted by juan_r
I would need the following functionality:
- Toggle keyboard visible/invisible. All the surrounding borders and decorations are unnecessary in my case: I'd like to keep the whole thing as small as possible.
- Display a specified range. Basically the whole 88 keys, but sometimes less would suffice depending on the plugin's settings. Ideally, the whole 127-key shebang could be available, although there are few use cases for that.
- "Turn on" (highlight) a key in a specified color (a limited palette of 3-4 colors could work), "turn off" a key.
|
First two criteria are already possible, third criteria I did some coloring variations for Piano Display already, see its thread in this forum. What are your criteria for the coloring? You could look into my examples and modify to your criteria. Coloring is no problem, you only need to define your cases in terms of pitch classes in the range 0..11, 0=C, 1=C#, ... 11=B.
I want to write a variant which changes colors based on the used intervals between last two notes, asked Geraint about it per PM, maybe he might add a new variant in future where we can even access the interval information directly.
|
|
|
03-02-2021, 04:32 AM
|
#10
|
Human being with feelings
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 346
|
Apologies for being very late to the party here. If you've already resolved this, ignore this message.
The scrolling part of Piano Display is tied into that particular effect, yes. But for drawing a piano and highlighting some keys, you could maybe try piano-ui.jsfx-inc in the same project.
It's tied into my UI library, but you don't have to use that for your whole UI. You should be able to just initialise/setup, use ui_set_rect() to say where you want the piano to be drawn, and then call piano_draw().
There's no documentation on how to use piano-ui.jsfx-inc, but a good example of its use is this code in my Droplets effect. In particular: it uses "piano_draw()" to draws the general shape, and then highlights notes with piano_fill_key () using a custom colour set by ui_color().
|
|
|
03-02-2021, 01:11 PM
|
#11
|
Human being with feelings
Join Date: Oct 2019
Posts: 1,082
|
Quote:
Originally Posted by geraintluff
Apologies for being very late to the party here. If you've already resolved this, ignore this message.
|
Never too late, Geraint!
I'd left that JSFX without a UI, since it worked well enough for my personal use case, but now I'll see if I manage to add a fancy keyboard UI, following your suggestions.
Thank you for the reply!
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:11 PM.
|