top | item 33150260

I made a guitar tuner app using Flutter and Rust

208 points| zduny | 3 years ago |justune.eu

146 comments

order
[+] taraparo|3 years ago|reply
The app looks great, but since no source code is provided knowing that it's made with Flutter and Rust isn't really of much use for anyone (esp. for learning purposes).

For anyone interested, I found a nice open source tuner for Android https://github.com/thetwom/Tuner

[+] notfed|3 years ago|reply
Evil plan:

1. Create closed-source app in some boring language

2. Promote on hacker news as "written in Rust"

[+] bsder|3 years ago|reply
Agreed. Without source code, this is just Yet Another Guitar Tuner App(tm) this time with Magic Rust Pixie Dust(tm) (take our word for it).

If they release source code, I'll toss them money. Until then, pass.

[+] bibanez|3 years ago|reply
This is the tuner I use! It works great, definetely recommend it.
[+] taylodl|3 years ago|reply
There are two Drop D tunings listed and one is actually Drop C. There is no Drop D♭, you call it Drop C♯ which while it's technically the same set of tones, it's now how guitar players think of it. You have the same issue with E♭ Standard. Each of your notes in these tunings are listed as sharps instead of flats, which is not how guitar players think of the notes in these tunings.

Also, you might want to consider polyphonic tuning. That's what would set you apart from everybody else. I bought a TC Electronic PolyTune earlier this year and it's been a game changer. It's much faster and easier to get tuned

[+] huehehue|3 years ago|reply
Interesting you mention guitarists thinking in terms of flats. Is that rooted in music theory, preference/convention, or something else?

A sibling common mentions "c#, g#, c#, f, g#, c#" which is exactly how I would think of it. I'd guess that without a key signature to reference it doesn't really matter, but I'm a theory novice so curious about this.

[+] skybrian|3 years ago|reply
I'm interested in the algorithm for that, but it looks like for PolyTune, they just say "patented 'MonyPoly' algorithm."

So that's out. I wonder what other research has been done into detecting multiple notes at once?

[+] tomduncalf|3 years ago|reply
In general polyphonic pitch detection is a much harder problem to solve than monophonic. I guess focussing on guitar tuning only rather than trying to transcribe a whole song makes the problem a bit simpler but still is probably a lot more challenging than handling one note a time. Cool feature though, I had never thought of a polyphonic tuner!
[+] RHSman2|3 years ago|reply
Why is it good? Interested
[+] RHSman2|3 years ago|reply
As an alternate tuning person I’d love a simple ‘this is the note you are playing’ I hate having to pick the tuning as I just wanna know a c#, g#, c#, f, g#, c#

Please :)

[+] zduny|3 years ago|reply
It's available free (and no ads) for desktop browsers and as a $1 Android app (on mobile needs to be an app for performance reasons and I believe it's a fair price).
[+] KMnO4|3 years ago|reply
While $1 is certainly far less than the value this app provides, it’s going to be a hard sell when there are several free apps which do the same thing.
[+] bicarbonato|3 years ago|reply
Is the app the same as the desktop version feature wise?
[+] munro|3 years ago|reply
The movement is really choppy on my iPhone 13 Pro. Did you use requestAnimationFrame for the tuning movement? & CSS animations for switching instruments? Kinda just wondering how the performance could be so bad. Reminds me of PhoneGap circa 2013
[+] panzerboiler|3 years ago|reply
I can confirm. It is extremely choppy and resource hungry for what it does. Since they use Flutter, the UI is rendered using 119 canvas elements. The same thing could be implemented using the web platform (no flutter and no rust) with better results.
[+] alvarlagerlof|3 years ago|reply
Flutter is not web-based. It's all custom.
[+] phdelightful|3 years ago|reply
As an undergrad I made a guitar tuner using a PIC32 microcontroller to do time-series correlation to figure out the frequency (FFT was too slow for real-time) and a state machine embodied in a stratix FPGA to control a stepper motor to turn the pegs. A different era of “mobile app” I guess.
[+] psuedo_uuh|3 years ago|reply
I would love to see the source code, or at least a simplified version. Audio input in rust and rust talking with flutter on mobile device. Such a cool project.
[+] zduny|3 years ago|reply
Well, all the Rust crates I've mentioned in other comment have comprehensive examples attached, so it's just a matter of connecting their functionality together :)
[+] audio_stuff|3 years ago|reply
Looks very nice, would you tell us a little bit about what you used to build this? I am just getting started with Rust and it would be cool to hear what approach you went and what you would recommend when starting today.
[+] zduny|3 years ago|reply
Flutter for the UI. Rust for the listening, and pitch detecting backend. Connected the former with the latter using flutter_rust_bridge.

More details on Rust backend:

For listening (getting audio signal from microphone) I used:

- Android: https://crates.io/crates/oboe

- native desktop/iOS (not currently released): https://crates.io/crates/clap

- Web: https://crates.io/crates/web-sys (so basically JS Web Audio API called from Rust compiled to WASM).

For pitch detection:

- https://crates.io/crates/pitch-detection

[+] account-5|3 years ago|reply
This might have an obvious answer for the more experienced here, but (potentially stupid question) why didn't you use dart for this?

Nothing against rust, just interested is all considering the dart/flutter relationship.

[+] zduny|3 years ago|reply
Performance reasons, also wanted it to work on the web (Flutter web support is fairly recent, and dart/flutter libraries don't automatically work on the web, they have to support the platform).
[+] nu11ptr|3 years ago|reply
Speaking only for myself, I'm considering Flutter + Rust because I want to write everything in Rust, but there aren't great GUI options for Rust atm. I've heard good things about the rust<->dart bridge so it seems like a reasonable compromise, esp. given the Dart code to write Flutter UIs seems fairly declarative. Hoping to keep most of the logic in Rust and just the view in Flutter/Dart.
[+] n4bz0r|3 years ago|reply

[deleted]

[+] tabtab|3 years ago|reply
I'm looking for JavaScript library that would allow me to build a hobbyist autoharp tuner. I can program the UI, but need a note generator library. It just needs one API function or equivalent: soundNote(noteNum, duration); Note-number is the MIDI note number, and duration is the duration of the note in micro-seconds. (It can be in "beats" when the beat unit is defined via another function.)
[+] LocalPCGuy|3 years ago|reply
Purchased for Android, love Flutter and been trying to learn guitar off/on, so this could be helpful.

Question re: web (where I have not been impressed with Flutter as a platform) - I just get "Failed to start listening thread." I tried both Firefox and Chrome, latest versions.

Side note: Also noticed I can't highlight/copy the text (common usability/accessibility issue with Flutter Web. I believe it's not that hard to allow?)

[+] slfnflctd|3 years ago|reply
You may already be aware, but having a small clip-on digital hardware tuner you can use anywhere without involving a phone is a life upgrade if you're playing guitar on a regular basis.

Of course, this is a cool project for more insight into the technologies involved regardless.

[+] zduny|3 years ago|reply
I don't know if it is allowed here:

Please reply if you would be interested in free promo codes for the Android app, I will post some.

[+] zduny|3 years ago|reply
20 promo codes for the Android app:

[all codes have been redeemed]

[+] criddell|3 years ago|reply
When I click through, all I get is a black screen that says "Failed to start listening thread."
[+] zduny|3 years ago|reply
Android or Web?

If web - well, it sadly requires modern browser on relatively modern hardware - it has some performance problems currently in browsers, I'm not happy about that fact, I am considering improving it if the app catches enough interest.

If Android - please consider returning the app and getting your money back as long as you still can - I'm afraid I won't be able to solve it in quick fashion.

[+] lightedman|3 years ago|reply
This is pretty handy, though my usual tuning method is to play a pure tone and match to that. Makes getting right there so much easier when you hear the warbling between guitar and tone stop.
[+] iwebdevfromhome|3 years ago|reply
This is very cool! Is there a way to contribute or something to have support for ukulele ? I'm just starting to learn the uke and this could be very useful.
[+] jaywalk|3 years ago|reply
There's a Ukulele switch at the bottom left of the window.
[+] copperx|3 years ago|reply
What algorithm are you using? I've been tempted to write a tuner using autocorrelation, because in my experience it picks up pitch wonderfully.
[+] andrewon|3 years ago|reply
This is surprisingly useful. Thanks!

I used an iPhone app with similar interface but couldn't find one that's as intuitive on web until this one.

[+] vhanda|3 years ago|reply
Do you have any plans on open sourcing the code?
[+] zduny|3 years ago|reply
Not at the moment. Sorry.

I'm planning to create a simpler free version of the app for the sake of cross-promotion, I may open source that one (but I can't make any promises currently, both regarding creating the actual app and open sourcing it).

[+] Narishma|3 years ago|reply
How do you scroll the list on the left? It doesn't have any scroll bar or scroll buttons that I can see.
[+] K0nserv|3 years ago|reply
With the mouse wheel/trackpad. Flutter Web doesn't actually generate proper DOM, instead it renders things (mostly) from scratch, hence no scroll bars.
[+] zduny|3 years ago|reply
Thanks for mentioning the problem. I haven't noticed it using a laptop and trackpad.
[+] tonypags|3 years ago|reply
Assuming you're using A440. I do not see a way to change it to my preferred reference frequency A432.
[+] zduny|3 years ago|reply
I'm considering adding that feature in future versions depending on interest.