Piano Keyboard

  1. 5 months ago

    Hi,
    I am in the process of learning Creo.
    In my iPad project, I need a piano keyboard and eventually implementation of MIDI.
    I have designed all my piano keys (12) for one octave and also another 12 highlighted notes.
    I imported all 24 keys into my project Assets.
    I have read on Stackoverflow that using buttons is not the right approach.
    What about using an ImageView for each keys?
    Thank you for your help.

  2. marco

    Apr 4 Administrator User since 2016

    Hi @JazzHot why using buttons is not the right approach?
    However ImageViews could be a correct solution.

  3. Hi @marco, In fact it is ok to use buttons but here is an answer I got from Stackoverflow
    «a better approach is using UIImageView and add a gesture recognizer to that view.»
    In Creo, I did not succeeded using imageViews. Showing a different color image when a key is pressed on the piano did not worked for me. I managed to do that easily with buttons.
    Another person mentioned that he preferred using UITouches...
    I am looking for the best way if there is.

  4. marco

    Apr 5 Administrator User since 2016

    @JazzHot it really depends on what you'd like to achieve.
    With buttons I think it is really easy to implement "discrete" note where a push on a button simply play a predefined audio file. But playing a piano is not a discrete action but it involves more complex touches where a note can be simultaneous played with other notes. For this more complex interaction I think that a gesture recogniser (UITouches) could be a better approach.

  5. @marco It will be a complex interaction. I will need to play chords. Considering, I have to go with the UIImageView approach for the design part, right?
    Thanks

  6. marco

    Apr 5 Administrator User since 2016

    I would use the ImageView approach where a method triggers the pressure UI part and the playing of a sound. Then I'll duplicate that ImageView to the N piano keys you'll need and on top of that I'll add a View that can capture the touches and it will redirect that touches to the underline ImageViews.

  7. @marco Thank you for the precision. A lot of work ahead... I am still reading the Creo and Gravity documentation. I am actually going thru all the tutorials.
    Also, I just registered Creo for one year.

  8. marco

    Apr 5 Administrator User since 2016

    Thanks a lot for your support @JazzHot and let me know if you need any help!

or Sign Up to reply!