)I just got a ukulele and I love it. I play it nonstop. Because of the temperature changes in my room and how often I play it, the instrument goes out of tune quite often. I wanted to write a simple tuning program that could play a solid sine wave at the frequencies I needed it to. I found it very easy to tune off of a loud sine wave instead of the sound of a ukulele string being plucked over and over again like most ukulele tuners. This one is going to be very short because this program is very simple and to the point.
This is going to be a fairly simple program that emits a sine wave at a certain frequency with which to tune the Ukulele. This app is going to be dead simple, so let's talk about some of the concepts behind the WebAudio API before we dive into code.
The WebAudio API can best be thought of as discrete nodes all working together to make the sound you want to make. Audio starts from a node in the graph and travels along its edges (or connections) through effects and whatnot and then ends up at an output node (generally your speakers). Audio can come from several places: it can come from your microphone, an audio or video element, a file (the API is capable of decoding), or an oscillator. Of course, we will be using the latter to make our tuner.
So I wrote it. It took me no time at all and I was pretty happy with the result. The WebAudio API is super easy to do and, as far as I can tell, pretty flexible. I'm impressed every day by what Javascript can do and I'm surprised that Web Apps aren't taking off even more with how easy browsers are making it.
The page is dead simple and there isn't a whole bunch to it. I didn't even bother making a GitHub repo of it. Just go to the page and view the source. It's 67 lines, and a lot of it is styling.
Here it is, go tune that ukulele! Unless you have Internet Explorer. Then you can't use this. Edge surprisingly seems to work, though! Sorry this post wasn't super awesome like some of the other ones, I'm not near my equipment for the summer and I really wanted a decent ukulele tuner because my phone is too quiet and the internet ones aren't great. This one takes advantage of browser capabilities, and that's always better than playing noises from audio files!
No comments:
Post a Comment