Piano template using the canvas

I made a simple piano template using a canvas and the sound component.



piano_canvas.apk (5,7 MB)
piano_canvas.aia (493,4 KB)

5 Likes


The marked area is not necessary.

If you think so, remove the blocks and try out and please post your results here as the proof that you are right. So you will help everyone.

Yes good idea, but depending on the FontSize and DisplaySize settings of the device, some keys are not triggered at all or play 2 different tones (depending on whether you click on them left or right).

1 Like

This is just intended to be a template. Feel free to edit it. Of course you need to fix it to different screen resolutions. This may be possible via a lot of mathematics to fit for every device. But this is up to you because I really don’t need this kind of app myself

Is there a resource for the piano notes used? (I want more :wink: )
They sound much better than the ones I already have

I can sent you a 24 keys (= 2 Octaves) pack private. (I shortened the files I used in my aia to 3 sec.)

I found a solution that works pretty good on all devices. I edited the keyboard picture in Photoshop and gave every single key a slightly different color that you can’t notice. And with the canvas colorpicker I can trigger the right sound. The last task is how to get a effect on the keys when touching or flunging.

So here I come up with a working Piano based on a canvas. It provides single touch and flung over the keys. To support nearly no latency play I made a special extension that ca play more than 10 soundfiles from memory :

In this demo I used 24 Piano SoundFiles = 2 Octaves.
The keys are triggered by their color. So I edited every key to a slightly different color in photoshop. You won’t be able to notice that but this way the keys are exactly triggered by their color. This Overcomes the problem with different screen resolutions on different devices.
The last remaing task was how to simulate a key touch. So I made 24 copies of the keypad and edited them…
When playing a key the related image loads as the canvas background pic. The pics aren’t too big so this is going quite well.
Screenshot_20220501-024241
piano_canvas:
piano_canvas.aia (1,3 MB)

Note: You maybe will have to edit the file handling by yourself to match your android version! The soundfiles are in the aia assets.

3 Likes

This should work on all Android versions and also with Companion and the APK:

Blocks

piano_canvas2.apk (6.4 MB)

1 Like

Thx for your suggestion, Anke! You are still the mistress of Android filesystem!
So I changed my load section this way:

Updated aia:
piano_canvas.aia (1,3 MB)

Or just like this: