Build an Airplay Receiver Using Raspberry Pi

If you’re like me, you have tons of music on your computer but usually end up listening to it on headphones. If you want to use real speakers, you either run an audio cable to your stereo (tripping hazard, low-quality sound) or drag out an audio interface ($$, lots of cables). Bluetooth is an option, but the sound quality is ok at best. Apple’s Airplay goes over wifi and gives much higher-quality audio, but you’ll need some way to get that signal to your receiver or amplifier. There are lots of options on the market, but if you have a Raspberry Pi lying around, it makes a great and very cheap solution!

I decided to use the HDMI out for audio, which gives way better quality, and to include a power button and LED inside a nice laser-cut case. So far, it’s worked great for music as well as movies and podcasts!

Continue reading “Build an Airplay Receiver Using Raspberry Pi”

Linux Setup For Software Installations

The Mac OS is great for creative production, but for computers embedded in new media software installations, Linux gives a lot more flexibility and control, ranging from the ability to schedule automated tasks to the full-on tweaking of most every part of the operating system.

The price you pay for that control, of course, is in complexity. Setting up Linux machines can mean hours of spent in forums and lots of trial and error. This tutorial is meant to save some of those headaches. It explains how to set up a Linux computer for running software installations, and some settings that will make maintaining them easier, too.

Below are some things I’ve found helpful when setting up Linux computers for this purpose. Casey Reas has some great tips for OS X users, and Rafael Lazano-Hemmer’s best practices for new media artworks is also very useful.

We’ll cover two common Linux distributions, though this may work on other versions as well:

  • Raspberry Pi computers running Raspbian – great for low-power needs, when a cheap, small computer will work
  • A “regular” computer running Ubuntu – I often use old Mac Minis for this, for when you need more computing power or a more fully-featured OS

This tutorial assumes you know the basics of the command line (but really, if you don’t know how to do that, using Linux for your project might not be the best choice anyway) and that you can figure out how to install Linux on your machine.

Above: a dissected Mac Mini running Ubuntu. Less overheating = less fan noise, and looks super cool too.

Continue reading “Linux Setup For Software Installations”

Using Word2Vec and TSNE

Word2Vec is cool. So is tsne. But trying to figure out how to train a model and reduce the vector space can feel really, really complicated. While working on a sprint-residency at Bell Labs, Cambridge last fall, which has morphed into a project where live wind data blows a text through Word2Vec space, I wrote a set of Python scripts to make using these tools easier.

This tutorial is not meant to cover the ins-and-outs of how Word2Vec and tsne work, or about machine learning more generally. Instead, it walks you through the basics of how to train a model and reduce its vector space so you can move on and make cool stuff with it. (If you do make something awesome from this tutorial, please let me know!)

Above: a Word2Vec model trained on a large language dataset, showing the telltale swirls and blobs from the tsne reduction.

Continue reading “Using Word2Vec and TSNE”

Torch-rnn: Mac Install

TorchRNN_TinyShakespeare-web

Update! For El Capitan and users of newer version of OS X, you may run into issues installing Torch or Lua packages. A fix is included now.

Update number two! Zach in the comments offers a really helpful fix if you’re on Sierra.

Update three! A lot has changed since 2016, so I’ll be posting a new version of this tutorial soon. In the meantime, please see the comments for common sticking points and troubleshooting.

There have been many recent examples of neural networks making interesting content after the algorithm has been fed input data and “learned” about it. Many of these, Google’s Deep Dream being the most well-covered, use and generate images, but what about text? This tutorial will show you how to install Torch-rnn, a set of recurrent neural network tools for character-based (ie: single letter) learning and output – it’s written by Justin Johnson, who deserves a huge “thanks!” for this tool.

The details about how all this works are complex and quite technical, but in short we train our neural network character-by-character, instead of with words like a Markov chain might. It learns what letters are most likely to come after others, and the text is generated the same way. One might think this would output random character soup, but the results are startlingly coherent, even more so than more traditional Markov output.

Torch-rnn is built on Torch, a set of scientific computing tools for the programming language Lua, which lets us take advantage of the GPU, using CUDA or OpenCL to accelerate the training process. Training can take a very long time, especially with large data sets, so the GPU acceleration is a big plus.

Continue reading “Torch-rnn: Mac Install”

Tutorial: Create A Readme-File Finder Shortcut

There are a few things I always do when starting a project: make a NotesAndIdeas.txt  and a Readme.md  file. But opening a blank text file and saving it to the right location is a pain. To the rescue: a Finder keyboard shortcut.

1. WRITE A LITTLE SCRIPT

01-web
We’ll use an AppleScript to create the files. This requires two parts: getting the current directory and creating the file using a bash script. In the notes file, I’m adding a header to the top of the file, but you could add any text you want. Newlines must be escaped with two backslash characters: \\n .

I save my scripts to a folder called Hacks to I can tweak them later, if necessary.

Continue reading “Tutorial: Create A Readme-File Finder Shortcut”

Tutorial: Node on Raspberry Pi (for Bots)

Screenshot

Almost all my bots have been written in Python, but I’ve been meaning to try Node.js for more interactive bots for some time. Daniel Shiffman’s excellent new tutorials were enough to get my jump-started, and I created @BotSuggestion, a bot whose only activity is following accounts suggested by Twitter, slowly conforming to their algorithm.

I run all my bots on a Raspberry Pi under my desk (see my tutorial on how to get that set up), but getting an ongoing Node server running took a little more work.

Continue reading “Tutorial: Node on Raspberry Pi (for Bots)”

SDR/HackRF One: Mac Setup and Basics

HackRFOne-web

The HackRF One is a very nice software-defined radio (SDR). Though a good bit more expensive than other SDR hardware, it is very well made and Michael Ossmann of Great Scott Gadgets has put together an extensive set of free video tutorials. Of course, those only help if you have everything set up correctly to begin with.

It appears that most SDR work is done through Linux, which makes sense: SDR is classic hardware/software hacking. But for a Mac user, I found it somewhat difficult to get started. This short tutorial will hopefully help kickstart that process for you!

Continue reading “SDR/HackRF One: Mac Setup and Basics”

Exporting Gerber Files From Eagle CAD

Screen-Shot-2015-09-27-at-6.48.36-PM-web

While services like OSH Park let you upload your Eagle CAD files directly for PCB manufacture, most other services, especially production runs, require the industry-standard Gerber files. Essentially a set of text files for each part of the board (ex: top copper, bottom silkscreen, bottom solder-mask, etc), generating Gerbers in the right format can be a bit tricky.

This tutorial walks you through this process, with a specific example of sending files to Seeed Studio’s excellent PCB service (no financial stake here – just like their service!). However, you could use these directions for most any fab house.

Special thanks to Luca Dentella’s post that helped me figure out this process.

Continue reading “Exporting Gerber Files From Eagle CAD”

Simple VU Meter Circuit

VUMeterSchematic

I recently bought a cheap VU meter on Amazon, which looks very cool but needs some circuitry to get running. Unlike vintage meters, which can be driven by the audio signal directly, newer (and especially cheap) meters require DC current. A simple circuit, based on this example by Rod Elliott, uses four diodes to convert the AC audio signal into DC, plus a resistor and capacitor to dampen the movement of the needle.

See Rod’s post for lots more technical detail and a more complex driver circuit. Of course, this is pretty lo-fi and not studio-quality equipment… it also didn’t cost $1000.

Continue reading “Simple VU Meter Circuit”