In yesterday’s post I covered the bare bones basics of creating audio with the Web Audio API. In this post, I’ll demonstrate one way to start creating some interactivity.
One of the simplest and most dynamic ways to capture interactivity on a computer is by simply reading the mouse position. The strategy for this next experiment is to use the mouse’s y-position to control the frequency of a single oscillator. The code for this is super simple:
Read more...This is something I’ve wanted to play with for a long time. So the other day I buckled down and started searching around.
Yes, you can create sound in JavaScript. In some browsers. Supposedly, it works in Chrome 14, Firefox 23, Opera 15 and Safari 6. Not IE. But, I’ve only tested this in Chrome. So for now, consider this something experimental and fun to lay with, not for your super awesome works-in-every-browser game.
Read more...At long last, the book is available for sale. It took a few days to get through all the copy edits and then a few last minute tweaks, then I hit the big old publish button. A few hours later, it was live … except in the US, Japan, India and Canada. I’m not sure if there is just some lag in the system for certain countries. I contacted support, they said they’d look into it and I never heard back, but the book soon went live on the US and Canadian stores. As of this writing it’s still listed as unavailable for purchase in India and Japan. It may resolve itself, but I’ll keep pushing on it anyway.
Read more...The book is done! Well, not done, done, as in out-the-door done. But I finished all the chapters and all the code and all the images. I’ve worked over every chapter 2-3 times myself and now the book is over to a team of tech reviewers and a professional copy editor. This will give the book the final polish in both the technical sense, making sure the explanations are correct and the code works, and also in a spelling/grammar/style sense, making me look more literate than I am. I’m already getting some great feedback from the reviewers, and while my ego always takes a huge hit at this stage of the game, it’s all going to mean a higher quality book that hits your hands. I’m hoping to wrap up this stage of things in the next couple of weeks and have the book ready on Kindle by mid-September.
Read more...Since my last post, I’ve been focusing almost all of my free time on writing this book. Mostly because I’m having so much fun writing it. I’ve finished a whopping six chapters since I last posted here. So yeah, it’s going pretty well. Here’s the current table of contents:
Chapter 1: Introduction
Chapter 2: What is a Fractal
Chapter 3: Symmetry and Regularity
Chapter 4: Fractal Dimensions
Chapter 5: Order from Chaos
Chapter 6: Diffusion-Limited Aggregation
Chapter 7: The Mandelbrot Set
Chapter 8: The Julia Set and Fatou Dust
Chapter 9: Strange Attractors
Chapter 10: L-Systems
Chapter 11: Cellular Automata
Chapter 12: Fractals in the Real World
A little over a year ago, I announced that I would be writing a book about fractals, entitled “Playing With Chaos”, based on a few presentations I did that went over really well. I set about writing the book and got almost two chapters in before fizzling out. The problem with self publishing is that you don’t have an editor breathing down your throat, asking for the next chapter some time around the next deadline. Other things come up and before you know it, a year has gone by and you haven’t looked at the book.
Read more...One thing you might want to do with an Arduino or even a Raspberry Pi is control a motor. Of course, the GPIO pins on this board are really just designed to send and receive informational signals, not drive the load of something that’s going to draw any significant current like a motor. An LED is fine, but much beyond that and you really need to look at a different solution.
Read more...Working a lot with Raspberry Pi and Arduino stuff lately. The concept of pull-up and pull-down resistors came up quickly and confused me a little at first. So I thought I’d do a little demo of how they work and why they are needed. Doing this helped to clarify it for me, so maybe it’ll help you too.
Common scenario. You want to set up something that reads an input of a GPIO pin. Say, you want to know when the user is pressing a switch. You set up a simple circuit like so:
Read more...I was looking for some Raspberry Pi project to do that not only used external hardware (even if that means only an LED for now), but also reached out into the net to deal with some kind of real time data. I ran into this tutorial on adafruit about checking your gmail with a Pi and lighting up an LED based on whether or not you have new mail. This was along the lines of what I wanted to do, but had two drawbacks. One, I don’t use gmail anymore, and two, it uses a python library called feedparser, which is actually an RSS parser. It only works because apparently you can access your gmail as an RSS feed or something. I wanted to do the same thing, but with any email service that supports, say, IMAP4.
Read more...Recap
As stated in my previous post, the plan was to hit a button that’s connected to my Raspberry Pi, which will trigger Winamp running on my pc laptop to play/pause. This without the Pi being physically connected to the pc – all via wifi and my local home network.
The hardware setup
Raspberry Pi with USB wifi, a small breadboard, 100k ohm resistor, a pushbutton and some hookup wire.
GPIO pin 25 goes to one side of the switch, 3.3 volts to the other. You hit the switch, pin 25 gets juice and goes HIGH. The 100k ohm resistor is also hooked to pin 25 on one side and ground on the other, connecting 25 to ground when the switch is not connected, ensuring it is in a LOW state. For those of you in the know, this is a basic pull down resistor. If you’re not familiar with the concept, as I was not last week, this is a good explanation: http://www.resistorguide.com/pull-up-resistor_pull-down-resistor/
Read more...