$25 : A Piano Sample

Ohanian

Active Member
Licensed User
Longtime User
Hi,

I'm creating a piano-like app where every button plays a note. My buttons play sound on Touch Down event. The problem arises when I'm swiping finger from one button to another (imagine swiping your finger against piano keys to capture all notes in between), which still "holds" the first button without touching another, unless I lift my finger.

It’s the same story on a guitar or any other instrument with keys and string.

All I want is a working sample.

I’ll pay min $25 for it.
 

sorex

Expert
Licensed User
Longtime User
you better use touch events instead of click. then you can track if a swipe happends on another button.
 

Ohanian

Active Member
Licensed User
Longtime User
Hi,

Thank you for your answer, but I'm looking for a working project, since I have no free time and mind these day I’ll pay for that.
 

Ohanian

Active Member
Licensed User
Longtime User
Hi,

thanks for the comment, if the price is the problem i'm ready to raise it.
 

ilan

Expert
Licensed User
Longtime User
Are you looking for a complete app with ui? Or just the code for the playing piano?
 

Ohanian

Active Member
Licensed User
Longtime User
Hi,

No , an activity with some keys (panel or button or image) but it should work as described.
B4A
 

ilan

Expert
Licensed User
Longtime User
ok, this is a very simple example, (i am at work so i could not test it.) it shows how you can use the touch event.

tell me if it is working.

EDIT: new Version in Post #17

EDIT: New version that supports Multi Touch is available Post #25
 

Attachments

  • piano example.zip
    79.4 KB · Views: 261
Last edited:

ilan

Expert
Licensed User
Longtime User
if you need a more complex version let me know (the problem is i am not at home so i did this example via teamviewer)
i will need to sit on my pc to make a better example :)
 

Beja

Expert
Licensed User
Longtime User
ok, this is a very simple example, (i am at work so i could not test it.) it shows how you can use the touch event.

tell me if it is working.

Hi ilan,
Can I also download your demo project? or intended for the recipient?
 
  • Like
Reactions: udg

Beja

Expert
Licensed User
Longtime User
Smart idea, Ilan.
Just a detail: the keys are 12, not 7.
Perfect.. amazing it only uses the core library and all in code.. great job ilan.
Luka, the keys (active) are 8.. the half-tone keys are not active or they are part of the previous key image.
I hope ilan go back home :) and add two things:
1- Add the C#, D#...etc) with their true tones.
2- Add octave buttons so you can rise and fall between octaves as you play, see image (expanding the keyboard will make it difficult land on the right key)

Octaves.png
 

ilan

Expert
Licensed User
Longtime User
Perfect.. amazing it only uses the core library and all in code.. great job ilan.
Luka, the keys (active) are 8.. the half-tone keys are not active or they are part of the previous key image.
I hope ilan go back home :) and add two things:
1- Add the C#, D#...etc) with their true tones.
2- Add octave buttons so you can rise and fall between octaves as you play, see image (expanding the keyboard will make it difficult land on the right key)

View attachment 44104

ok it wasn't that easy but i did a 12 key piano

this piano usage only the core lib. NO designer, No milion buttons or anything else. Just canvas and Math!

have fun :)

(@Beja sorry i could not find 84 (12*7) different sounds but it should be very easy to add those octaves, because you should always have 7 white and 5 black keys (or am i wrong) i never had any piano lessons :confused:.

anyway i also have very less time so i "just" did a full 12 keys piano with a gesture detection math. if you would like to add new mp3 for more octaves you can do that very easily.

EDIT: New version that supports Multi Touch is available Post #25
 

Attachments

  • piano example.zip
    304.8 KB · Views: 276
Last edited:

LucaMs

Expert
Licensed User
Longtime User
(@Beja sorry i could not find 84 (12*7) different sounds but it should be very easy to add those octaves, because you should always have 7 white and 5 black keys (or am i wrong) i never had any piano lessons :confused:.

You should use a sound generator. I tried the Beeper object of the Audio library; result: very bad :D

First octave:
upload_2016-5-18_4-4-8.png


example to change octave:
Frq = 32.70 ' (DO - C)
Frq * Power(2, Octave - 1)
 

Ohanian

Active Member
Licensed User
Longtime User
ok it wasn't that easy but i did a 12 key piano

this piano usage only the core lib. NO designer, No milion buttons or anything else. Just canvas and Math!

have fun :)

(@Beja sorry i could not find 84 (12*7) different sounds but it should be very easy to add those octaves, because you should always have 7 white and 5 black keys (or am i wrong) i never had any piano lessons :confused:.

anyway i also have very less time so i "just" did a full 12 keys piano with a gesture detection math. if you would like to add new mp3 for more octaves you can do that very easily.

Hi,
thanks, it's fantastic.
is it possible for you to add multi touch to the keys? in the current version if i push and hold a key it's not possible to push another key, or push 2 keys at the same time.
and give me a Paypal email please.
 

ilan

Expert
Licensed User
Longtime User
is it possible for you to add multi touch to the keys? in the current version if i push and hold a key it's not possible to push another key, or push 2 keys at the same time.

sure it is possible, but you will need to use a different approach. the simple panel touch does not support multi touch but @Informatix gesture lib does support multi touch.
you could also put lots of panels and detect each touch to play a sound but this wont be a real coding challenge :p.

give me a Paypal email please.

see signature ;)

If you like my source codes you can show it by making a small donation:)
 
Top