@Joule, thank you very much!
I added a bit of layout:
Click to view contents
function white_tooltip (key, octave)
if key == 1 then return "C-"..octave.."" end
if key == 3 then return "D-"..octave.."" end
if key == 5 then return "E-"..octave.."" end
if key == 6 then return "F-"..octave.."" end
if key == 8 then return "G-"..octave.."" end
if key ==10 then return "A-"..octave.."" end
if key ==12 then return "B-"..octave.."" end
end
---
function black_tooltip (key, octave)
if key == 2 then return "C#"..octave.."" end
if key == 4 then return "D#"..octave.."" end
if key == 7 then return "F#"..octave.."" end
if key == 9 then return "G#"..octave.."" end
if key ==11 then return "A#"..octave.."" end
end
---
function white_bitmap (key, octave)
if key == 1 then
for i = 0, 9 do
if octave == i then return "icons/c-"..i..".png" end
end
end
--if key == 1 then return "icons/c.png" end
if key == 3 then return "icons/d-.png" end
if key == 5 then return "icons/e-.png" end
if key == 6 then return "icons/f-.png" end
if key == 8 then return "icons/g-.png" end
if key ==10 then return "icons/a-.png" end
if key ==12 then return "icons/b-.png" end
end
function pw_build_octave(octave)
local intervals = { 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 }
local black_spaces = { [2] = 8, [4] = 22, [7] = 7, [9] = 7 }
local white_keys = vb:row { spacing = -3 }
local black_keys = vb:row { }
local octave_content = vb:row {
spacing = -131,
white_keys,
black_keys
}
for key = 1, 12 do
if intervals[key] == 1 then
white_keys:add_child(
vb:button {
height = 66, width = 23,
color = { 255, 255, 255 },
id = "KEY_" .. (key - 1) + (12 * octave),
tooltip = white_tooltip(key, octave), --<<
bitmap = white_bitmap(key, octave), --<<
pressed = function(key, octave) end, --<<
released = function(key, octave) end --<<
})
else
black_keys:add_child(
vb:button {
height = 40, width = 15,
color = { 1, 1, 1 },
id = "KEY_" .. (key - 1) + (12 * octave),
tooltip = black_tooltip(key, octave), --<<
pressed = function(key, octave) end, --<<
released = function(key, octave) end --<<
})
if key <= 9 then
black_keys:add_child(vb:space { width = black_spaces[key] })
end
end
end
return octave_content
end
function pw_build(octaves)
local piano_widget = vb:row { margin = 5, spacing = -2 }
for octave = 0, octaves-1 do
piano_widget:add_child( pw_build_octave(octave) )
end
return piano_widget
end
my_pianowidget_content = pw_build(4)
tooltip = white_tooltip(key, octave), --<<
bitmap = white_bitmap(key, octave), --<<
pressed = function(key, octave) end, --<<
released = function(key, octave) end --<<
...
tooltip = black_tooltip(key, octave), --<<
pressed = function(key, octave) end, --<<
released = function(key, octave) end --<<
7449
I think it would be all set to have a virtual piano as a base.From here, on the 10 octave piano, it is possible to add 2 side scroll buttons and display only 3 or 4 octaves to make a more compact tool. Another button on the left to deploy a bottom line with more buttons to trigger functions.
For now, I think I would be able to include 3 things:
- OSC Server for sound.
- Control writing in the pattern editor using the mouse with the virtual piano.
- Control writing in the pattern editor using the USB keyboard with the virtual piano, according the “Oct” value of Renoise.
I find it an unknown world yet for include control via MIDI input.This involves connecting a MIDI keyboard and pressing the keyboard notes that the virtual piano only can illuminate the keys (pressed and released).