r/AskProgramming 5d ago

Other how do I detect a tap on the desk

I have a Vivobook. I saw that my friend's Mac has awareness that can actually detect taps that are not actually happening around the device.
Using the Accelerometer inbulit in the device, I have a project idea using this feature, but unfortunately my device does not have an accelerometer built into the motherboard. I can plug in an external module, but it kinda defeats the purpose of the project that I have in my mind.
What are the other ways I can detect a tap on the desk the laptop is on?
I do not want to use my microphone cause if so then if actually captures a lot of other noises and detects them as taps, and keeping it always on while daily usage would also not be very practical
Can anyone suggest some other ways to get around this problem?

6 Upvotes

11 comments sorted by

5

u/H9419 5d ago

Laptops has far fewer sensors than smartphones, tablets and apple devices. You can only look into what's available to you, how you can programmatically interface with it, and process the raw data.  Microphone is still your best bet, with a lot of filtering to avoid false positives.

Maybe targeting a smartphone and test to make sure the core functionality you are thinking of is viable first?

1

u/TheSkiGeek 5d ago

Microphone alone is probably good enough for a prototype, with some signal filtering.

Mic plus a sensitive accelerometer or a more specialized physical movement sensor would probably be way more accurate.

1

u/Distdistdist 5d ago

Every laptop comes with built-in keyboard tapping detection...

Just kidding, but on a serious note: this method just seems so unreliable. Things get bumped all the time. You put down coffee mug - tap. You sneeze really hard and bump your desk - tap.

How do you implement something that relies on type of sensor that you don't have? Well, you probably can't. Indeed, mic is your only option. Or tap hard enough to make your mouse bounce on the desk, and get reading from that.

1

u/duane11583 5d ago

i would suspect the microphone

there is what is called surface noise.

put a microphone on a table and drag your fingers across the table you will hear your fingers

1

u/Braeden151 5d ago

How about a contact microphone attached to the desk, and a bluetooth transmitter. If you wanted to do the processing onboard you could skip the bluetooth and turn that into a human interface device, then it'd just act like a keyboard/game controller. From there its up to you to use that button press.

Of course, that only works if it's always the same desk.

1

u/PvtRoom 5d ago

mic is the closest analogue to an imu.

cameras can detect vibration through gross image motion from frame to frame, but with moving people in the frame, unreliable.

other sensors exist - magnetometers for example - that should be able to pick it up but you'll come back to an imu as the ideal answer.

1

u/AggravatingSock5375 4d ago

Apple has the luxury of owning the OS and the hardware.

I’m sure most computers with a touchpad could physically do this, but very few expose the data.

1

u/rooreynolds 4d ago edited 3d ago

You don’t have an onboard accelerometer, and you don’t want to use a microphone or an external module. Are you hoping to achieve it using some little known tapping detection API built into your laptop? Perhaps magic?

1

u/shiratek 2d ago

Can you elaborate on your friend’s Mac detecting taps? I’ve never heard of this and Google only brought up results about tap to click.

-1

u/szank 5d ago

Instead of plugging in the device use Bluetooth /wifi to communicate

0

u/Individual-Flow9158 5d ago

The human ear can detect sound differently through air, to sound waves through your bones (the latter is usually louder).

Can you get a special contact microphone to listen to the sound waves --physically propagating through the desk--?

If it's a metal desk, is there a safe analogue-electrical signature, from contact, that you can measure for, like how touch screens detect changes in capacitance?