thetwom / toc2

Metronome app
GNU General Public License v3.0
151 stars 23 forks source link

Vibration-based metronome #19

Closed fpesari closed 3 years ago

fpesari commented 3 years ago

Hello,

many people always carry their phone in their pocket and when playing music vibration can't be heard by the public but can be felt by the performer. For this reason, I think vibration makes a good alternative to traditional drum sounds or beeps.

It would be nice if there was an option to replace sounds with vibrations. Each note could have a different vibration duration, so that hits (and accents) could be felt differently. For example, a hi-hat would vibrate the shortest time (30 ms?), a kick should last longer (60 ms?), a snare even longer (150 ms?) and a ride the longest (300 ms?).

Disclaimer: I tried to implement this functionality myself in a web app as a proof-of-concept but I just could not get it to a decent performance level (since vibration can't be used from a web worker, AFAIK). I am no Android coder so I prefer you take this concept and do something good with it, since I use your program from F-Droid. Thanks for listening anyway :smile_cat:

thetwom commented 3 years ago

thanks for the suggestion. Currently I am not sure how difficult it is to trigger a vibration, but maybe I find some time and can see how difficult this is. I think for a start I would just add an additional sound which is a vibration. Not sure, when I find time, looking into this.

thetwom commented 3 years ago

If you find a minute, please give the v2.3.0-beta1 a try. Note, that you have to enable the vibration in the settings. Would be great to get a quick feedback. If you have suggestions for improvement, please let me know.

fpesari commented 3 years ago

Wow, thanks for the fast commit and for the great work: it does work very nicely, with harder or softer vibrations for different hits :smiley_cat: I think this has the potential to replace click tracks with something that feels more natural!

One thing which could make the overall experience more customizable is a discrete (let's say an unsigned integer called vibration_multiplier) slider for a multipler for the duration for the vibration, like this:

1[---2---3---4---]5

at 1: vibration goes from 30*1=30 to 70*1=30 (vibration_multiplier = 1) at 5: vibration goes from 30*5=150 to 70*5=350 (vibration_multiplier = 5) (and of course, the same for 2, 3 and 4)

This way people who have phones with weaker vibration will be able to tune them a bit stronger.

thetwom commented 3 years ago

Thanks for the quick test. Glad, that you like it so far, (however, it's no surprise because it was your idea :-).

I understand your suggestion regarding the strength and I think this would be a good addition. Are you able to test this on different phones and give a feedback of how the current strength behaves. Is it reasonable on most phones? I have only one phone available here, so it is hard to tell what is a good default value. I would best like to have default which is quite gently on most phones, and then give the user the option to make it stronger or weaker.

thetwom commented 3 years ago

Here a version with the option to change the vibration strength: v2.3.0-beta2. For me, at the lowest strength one can hardly feel the shorter (i.e. the higher) notes at all. But as you said, this might be different for other phones.

The multiplier range is now between 0.5 and 2 (I use a logarithmic scale, such that the multiplier of 1 is in the center). My feeling is that this range is enough, but as said, I only can test on my phone.

fpesari commented 3 years ago

Thanks again for the quick commit :smiley_cat: The slider works just as it should, it updates the vibration live without needing to reset the "Vibrating notes" switch.

On my phone (which has a mediocre vibration), medium barely cuts so I guess it's a fine default setting, but the maximum would be fine too I guess. Keep in mind that if this function is to be used live, the phone has to be in the pocket*, so there's a layer of cloth it must get through.

Now, a final touch (if I might) would to easily allow muting all notes via a single button. I noticed that there's some space in the mixer on the right so I guess that could be used, here is a mockup made using an icon from the Breeze set:

mute

* = I think the ideal way to use it would be putting the phone in a wristband around the arm or forearm, but perhaps I am getting too cyberpunky :laughing:

thetwom commented 3 years ago

Thanks for the further suggestion. I also thought about something like this, but decided not to implement it since it adds more things to the ui, which are not central to the app (it's still about playing sounds :-). And if I am adding such a button, users should at least have a clue, why it exists. And speaking for myself, I would wonder why I should mute my clicks, if I just could just stop the playing ...

Note, that still the feature is easily accessible by just muting your total volume of the phone.

Just an additional note. For some phones, one can also change the vibration amplitude (not just the duration). If it is available, I use the note volume to scale this amplitude ... However, I cannot test this, since my phone does not support this.

fpesari commented 3 years ago

I understand and I think you are right, the volume button already does that job. I did not want to bring more clutter, just thought those pixels were not going to be used anyway :)

I am not sure if my phone can set amplitude...I guess it should be preferred if available, or maybe the user could be able to choose between amplitude and duration with a switch, which is greyed out if amplitude can't be set.

Anyways for me this issue can be closed even right now, am very grateful for your work :smiley_cat:

thetwom commented 3 years ago

Ok, thanks again for you suggestions. I might do some minor polishing and release an official version soon.

thetwom commented 3 years ago

Ok, we are done. All changes are published in version 2.3.0. fdroid should pick it up during the next days and in google play it also should become visible shortly ...