Live data from Hacker News

Guitar tuner that uses phone accelerometer

tautme.github.io

41–50 of 105 posts

Re: Guitar tuner that uses phone accelerometer

#41
post #8

Earlier quoted context omitted.

Ah, that does look like something I can work with - thanks for the legwork, I will check it out and see if its worthwhile converting to C/C++ for my device ..

That was for a microphone based version. This is the accelerometer one https://github.com/tautme/phone-sensors/blob/main/accel-tune...

Ah, that is very intriguing indeed .. going to have some fun with this code this week .. thanks for that, kind stranger!

Re: Guitar tuner that uses phone accelerometer

#42
post #24

This has some very interesting privacy and security risks. If the tech can do more complex frequency analysis, then couldn't it essentially be used as a microphone for a device that doesn't need permission.

It's a pretty well-known exploit that the CIA is capable of turning a lot of electronics with speakers into microphones. I imagine there is an entire classified backlog of things they can turn into microphones without the target's knowledge.

Re: Guitar tuner that uses phone accelerometer

#43
post #5

Anyone got a handle on the algorithm required to do this? I've got a pocketable accelerometer-enabled device I'd like to try to implement this on..

Don't have a handle on it, unfortunately. But the algorithm is in here: https://github.com/tautme/phone-sensors/blob/main/guitar-tun... . Esp. lines 221–257 and 373–417.

The code mentions "autocorrelation" method: this is a method where you multiply the signal with delayed version of itself: result = sum(x[i] * x[i - delay] for i in some range). You vary the "delay" and pick the value that maximizes the result. This is based on the idea, that the sequential periods of the signal should be similar to each other.

Not a very good method, prone to octave errors (showing pitch one octave lower than the correct one). Furthermore, the "delay" is an integer which limits the precision, so you need to use some form of interpolation. Also it doesn't allow to recognize multiple notes sounding together. Also, slow.

You can read the paper on the "YIN" pitch estimation algorithm which describes the method in details.

I think FFT-based methods are more reliable. I did little experimentation and when measuring a pure sine wave, the frequency can be determined with high precision (tenths-hundredths of a Herz). Not so good in presence of a noise or multiple instruments - I tried to use descending from the hill optimization to figure out the pitch of each harmonic, but it didn't work out.

Re: Guitar tuner that uses phone accelerometer

#44
post #32

My accelerometer apparently reads at 200Hz, but due to a lack of instrument at the ready I had to "pluck" the handle of the office fußball table. When the right defender is near the center I'm reading ~24.74Hz, so slightly above G.

heh, a subacoustic G#?

Re: Guitar tuner that uses phone accelerometer

#46
post #42
post #24

This has some very interesting privacy and security risks. If the tech can do more complex frequency analysis, then couldn't it essentially be used as a microphone for a device that doesn't need permission.

It's a pretty well-known exploit that the CIA is capable of turning a lot of electronics with speakers into microphones. I imagine there is an entire classified backlog of things they can turn into microphones without the target's knowledge.

The CIA…plug a set of regular headphones into a microphone jack, open a recording application and speak into the headphone speaker, you don’t need a 3 letter agency for that physics open secret.

Re: Guitar tuner that uses phone accelerometer

#47
post #24

This has some very interesting privacy and security risks. If the tech can do more complex frequency analysis, then couldn't it essentially be used as a microphone for a device that doesn't need permission.

I don't think that's realistic. If you're looking at the acceleration sound waves cause against a phone's accelerometer, that's likely far below the sensitivity of the sensor- phones are too massive relative to the force of sound waves from speaking. F=ma, so the acceleration you're looking at is the force of the soundwave (tiny) divided by the phone's mass (relatively large). The only reason this kind of works is because you're putting the phone on an object that's mechanically vibrating. I suppose it would work in certain situations like putting the phone on top of a large speaker, but you'd never get the resolution to decipher audio from sound waves alone for a phone sitting on a desk or in a pocket

Re: Guitar tuner that uses phone accelerometer

#48
post #32

My accelerometer apparently reads at 200Hz, but due to a lack of instrument at the ready I had to "pluck" the handle of the office fußball table. When the right defender is near the center I'm reading ~24.74Hz, so slightly above G.

This was the direct inspiration for Total Football: to find harmony with the pitch.

Re: Guitar tuner that uses phone accelerometer

#49
post #42

Earlier quoted context omitted.

It's a pretty well-known exploit that the CIA is capable of turning a lot of electronics with speakers into microphones. I imagine there is an entire classified backlog of things they can turn into microphones without the target's knowledge.

The CIA…plug a set of regular headphones into a microphone jack, open a recording application and speak into the headphone speaker, you don’t need a 3 letter agency for that physics open secret.

I am crap with physics but was going to say I think the last 50+ years of speaker development has been about making them less a microphone than they inherently are.

Re: Guitar tuner that uses phone accelerometer

#50
post #32

My accelerometer apparently reads at 200Hz, but due to a lack of instrument at the ready I had to "pluck" the handle of the office fußball table. When the right defender is near the center I'm reading ~24.74Hz, so slightly above G.

heh, a subacoustic G#?

I think the tuner is off by an octave - it has a lot of harmonics and sounded like a G on a bass guitar.
Post reply on HN