On Wed, May 15, 2019 at 4:51 PM Anthony Walter via lazarus < [email protected]> wrote:
> I usually add GPL licences to my repositories but I forgot this time. > Thanks for reminding me. It's now attached. > > Regarding the TPianoKeyboard class here is some helpful information. > > It's a TGraphicControl. > It relies on the Music unit, also in the same project, to convert keys to > frequencies and also to format note names as strings. > You can define the number of keys on the piano by setting the KeyCount > property. KeyCount ignores attempts to set its value to less than 1. > You can change the on screen size of the piano by setting the ScaleFactor > property. > Setting Key[Index] := False/True turns the piano key from an > released state to a pressed state (when true). > You can listen to the OnKeyToggle event to take action when a piano key is > pressed or released. > The KeyToFrequency method gives you the frequency in hertz of the piano > key by index. > The piano does its best to keep middle C in the middle of its key layout > when you change KeyCount. > > If you (or anyone really) have any improvement ideas for TPianoKeyboard or > any other code in the project, let me know and I'll do my best to > accommodate. > Two useful features (suggestions :-D): * Split the "sound logic" from TPianoKeyboard to own class (TPianoSynthesizer?) allowing to use it in non-LCL based applications; * Supposing the feature above is done, the synthesizer could allow to record key sequences by typing or by string. (it would be useful to study applications like DefleMask project <http://www.delek.net> and play songs (strings only, without drums, bass etc.) like "Sonic - Green Hill Zone" https://www.youtube.com/watch?v=0YY13qh7X4A, "Spring Yard Zone" https://www.youtube.com/watch?v=_8LUfR1iH_0. (Castlevania, Zelda and so on <3) -- Silvio Clécio
-- _______________________________________________ lazarus mailing list [email protected] https://lists.lazarus-ide.org/listinfo/lazarus
