7 ms·
Guitar tuner that uses phone accelerometer
- adm4 5mo agoguitar detuner that uses accelerometer instead of microphone, it doesn't really work, but amazing to see how sensitive they are.
- tgv 5mo agoIt also shows that it can leak all kinds of other information.
- codethief 5mo ago…which is why both Android & iOS put high-frequency access to the accelerometer behind an additional permission AFAIR.
- tiluha 5mo agoIt really is crazy. Placing my phone on my chest lying down i can clearly see my heartbeat on the graph
- adm4 5mo agogood idea https://tautme.github.io/phone-sensors/heartRate.html https://tautme.github.io/phone-sensors/heartRate.html , try setting it on the ground and see how sensitive it is to foot steps.... or earthquake https://seismosense.com https://seismosense.com
- virgil_disgr4ce 5mo agoit detunes guitars?
- pimlottc 5mo agoIt tunes every string to D
- jmusall 5mo agoFun idea and also I didn't know that websites could get access to my accelerometer data. However for me the sample frequency is 50 Hz which is way too low to measure even the lowest string pitch (E2, about 82 Hz).
- hgomersall 5mo agoIf you know you have a single frequency close to an actual frequency of interest, you can use the fact you know you're in an aliased band to get a precise frequency estimate.
- jonathrg 5mo agoPresumably there is an antialiasing low pass filter somewhere before JS gets to the data. I have a similar sample rate and it certainly didn't work at all for me.
- ErroneousBosh 5mo agoIf the accelerometer samples at 50Hz, how could there be an antialiasing filter? What would that filter look like?
- colanderman 5mo agoAnything physical which dampens higher frequency oscillations would act as an antialiasing filter.
- ErroneousBosh 5mo agoWhat sort of size do you think something that would damp 25Hz vibrations in something that weighs a gram or two would need to be?
- regularfry 5mo agoThey have analogue AA filters just before the sampler.
- aa-jv 5mo agoAnyone 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..
- simonklitj 5mo agoDon't have a handle on it, unfortunately. But the algorithm is in here: https://github.com/tautme/phone-sensors/blob/main/guitar-tuner.html https://github.com/tautme/phone-sensors/blob/main/guitar-tun.... Esp. lines 221–257 and 373–417.
- aa-jv 5mo agoAh, 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 ..
- scoopertrooper 5mo agoThat was for a microphone based version. This is the accelerometer one https://github.com/tautme/phone-sensors/blob/main/accel-tuner.html https://github.com/tautme/phone-sensors/blob/main/accel-tune...
- simonklitj 5mo agoAh, whoops! Thanks for correcting my mistake.
- aa-jv 5mo agoAh, that is very intriguing indeed .. going to have some fun with this code this week .. thanks for that, kind stranger!
- codedokode 5mo agoThe 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.
- JoheyDev888 5mo agoThe neat bit is that it doesn't necessarily need to sample 82 Hz directly. If the sample rate is known and the target is one of a few guitar strings, the aliased peak can still be useful. The tricky part is probably rejecting the wrong alias once the vibration signal gets messy.
- ramenat2am 5mo agoI mean yeah, that's cool as a fun project. And I've also heard about a project that used accelerometers as microphones for surveillance. And while it's doable, even the cheapest crappiest mic would do a much better job at recording sounds for whatever is your goal.
- embedding-shape 5mo ago> even the cheapest crappiest mic would do a much better job at recording sounds And if you don't even have that, use a speaker/headphone as the microphone, probably also better results.
- kelipso 5mo agoIt’s about what apps can do with just default permissions, no? Not about what’s theoretically possible given full access to the phone.
- nubinetwork 5mo agoThis sounds neat, but I think I owned a tuner for about 6 weeks before I could do it by ear... EADGBe isn't that hard.
- beezlebroxxxxxx 5mo agoIf you have a good external reference point. But it's also pretty easy to have your tuning drift quite a bit away from E standard if you solely rely on the strings. Getting a standard tuning is not the same as getting the standard tuning you want, exactly. This is especially true if you play in standard tunings below E, like C or B, where strings can be looser than the norm.
- chpatrick 5mo agoIt's not hard if E is in tune already. :)
- jameshart 5mo agoPack it up folks, nubinetwork has exposed the scam that is the guitar tuner industry. You don’t need a guitar tuner if you have ears; all the guitar techs and musicians who use them have bought into a lie. And obviously since guitar tuners are a waste of time, a tech demo showing that you can use the accelerometer in a commodity handheld device to pick up minute vibrations with sufficient accuracy to detect guitar tuning from a web page is just feeding into the hands of Big Tuner. Seriously, this is the very definition of a shallow dismissal.
- markvdb 5mo agoPro guitar teacher here with over twenty years of experience teaching the guitar, and close to fourty years of experience playing the guitar. I still struggle with properly tuning my instrument by ear. Nothing wrong with my ears. It's just not easy to do this right.
- deleted 5mo ago[deleted]
- dsego 5mo ago
- kingkawn 5mo agoThe very clear and succinct description on the landing page makes me miss the bizarre antisocial charming quirk that people who made things like this used to be stuck with for their copy rather than AI generated language. Our cacophony of experience is quieting.
- Akuehne 5mo agoThis 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.
- weard_beard 5mo agoSounds like you've got a great idea for a proof of concept for DefCon next year...
- DANmode 5mo agoProbably worth reviewing prior art for inspiration: 0) https://www.usenix.org/conference/usenixsecurity14/technical-sessions/presentation/michalevsky https://www.usenix.org/conference/usenixsecurity14/technical... 1) https://infocondb.org/con/black-hat/black-hat-europe-2014/gyrophone-eavesdropping-using-a-gyroscope https://infocondb.org/con/black-hat/black-hat-europe-2014/gy...
- adm4 5mo agoSounds salty. https://people.csail.mit.edu/mrub/papers/VisualMic_SIGGRAPH2014.pdf https://people.csail.mit.edu/mrub/papers/VisualMic_SIGGRAPH2... use a potato chip bag as a microphone
- smallnix 5mo agoI thought this has been done to capture keystrokes of a keyboard next to the phone already 2011 https://www.researchgate.net/publication/221609349_spiPhone_Decoding_vibrations_from_nearby_keyboards_using_mobile_phone_accelerometers https://www.researchgate.net/publication/221609349_spiPhone_...
- pc86 5mo agoIt'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.
- Tade0 5mo agoMy 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.
- virgil_disgr4ce 5mo agoheh, a subacoustic G#?
- Tade0 5mo agoI think the tuner is off by an octave - it has a lot of harmonics and sounded like a G on a bass guitar.
- shiandow 5mo agoIt seems odd that it would be an octave too low. If it detected any harmonics it would be too high. Unless it didn't function like a string at all, then the harmonics would be all wrong.
- cjbprime 5mo ago> If it detected any harmonics it would be too high. I think it's not that simple. A tuner is "hearing" the fundamental and all of the harmonic overtones combined. It has to guess at which frequency is the fundamental, even if the overtones are actually stronger than it amplitude-wise, and it does that by looking at the nature of the repeating overtone pattern and extrapolating back to the fundamental. I think you can end up an octave too low (half the actual frequency) if the waveform repeats in a way that implies a different overtone repetition pattern, for example if there's an every-other-cycle artifact to the waveform.
- tclancy 5mo agoThis was the direct inspiration for Total Football: to find harmony with the pitch.
- AtNightWeCode 5mo agoCool. It worked for E and A but it failed for string 1-4. I was surprised that it worked at all.
- dehrmann 5mo agoThe more reliable guitar tuners do something like this. You clip them on the neck, and they detect vibrations in the wood rather than from sound in the air.
- foobarian 5mo agoViolin/other strings tuners tend to have this mode for orchestra uses with many people next to you also making sounds.
- soperj 5mo agooddly, this is how I learned to tune my guitar. I'm pretty tone deaf, but can feel the difference between the reference string and the string I'm trying to tune through the guitar.
- DANmode 5mo agoThis is fascinating. Thanks for sharing.
- adzm 5mo agoThe beat frequencies are pretty noticable, just tune until they go away
- soperj 5mo agoThat's the terminology I was looking for. Didn't know whether to tune up or down without changing frets, could tell when it was right though.
- hunter2_ 5mo agoNot really. 12 TET (the tuning intervals used in almost all situations where you want equal ability to play in any key, from a Western music perspective) requires a slight amount of beating, even in those "perfect fourth" intervals between most adjacent guitar strings, and especially in the "major third" interval between one pair of adjacent guitar strings, but not in the "2 octave" interval between the lowest and highest guitar strings. Some equal temperament intervals are narrower than their just-intonation (nonbeating) counterparts, for example an ET perfect fifth (2.996614:2) and just perfect fifth (3:2). But others are wider, for example an ET perfect fourth (4.00452:3) and just perfect fourth (4:3), and an ET major third (5.039684:4) and just major third (5:4). If you tune each string sequentially (low E to high E, or vice versa) and eliminate all of the beating each step of the way, the effect adds up to the point where it's quite noticeable, meaning that your low E and high E will sound like garbage when played together because that ratio should be precisely 4:1 but now you've accidentally made it narrower than that. How much narrower? For a guitar going from low E string to high E string, we need to stack 3 perfect fourths, a major third, and another perfect fourth -- and end up at 4x the starting frequency. If we use those non-integer ratios of the 12 TET system (intentional beating), we end up with 4.00452/3 * 4.00452/3 * 4.00452/3 * 5.039684/4 * 4.00452/3 = 4.00000. That's what we want. But if we use the integer ratios of just-intonation (no beating), we end up with 4/3 * 4/3 * 4/3 * 5/4 * 4/3 = 3.95062 and that's going to sound like complete ass. This is why just-intonation is not used for instruments like piano and guitar that are designed to play in all keys. It's used by choirs and barbarshop quartets without piano accompaniment, since they can adapt on the fly, and it's glorious. An electronic tuner is the most practical way to avoid this problem. Alternatively, you could just get the perfect fourths nonbeating, get the double-octave nonbeating, and let the major third beat however it wants -- this works because rounding the ~4.005:3 perfect fourth to 4/3 is somewhat acceptable but rounding the ~5.04/4 major third to 5/3 is not.
- donclark 5mo agoCan an accelerometer determine when a car is having issues? Can it do the same for a human user's body?