Monday, November 10, 2014

Best Discoveries of the last 12 months

I'm in the mood to make a top albums list for the year. However, I have a tendency to be a little behind-the-times in terms of music. So here are the top things I've discovered since this time last year. The first group of things have actually come out since September 2013. The rest are new discoveries of older things. In researching this, I discovered that at least three of these artists are on Jagjaguwar, and at least four are on Matador. I couldn't bring myself to rank them exactly, so each group is sorted alphabetically by artist. That way you have to listen to all of them!

From this year

Angel Olsen - Burn Your Fire for No Witness
Sure, this ends up on everyone's top albums for 2014 (or will, when December rolls around), so I won't repeat everyone else's opinions here. Suffice to say, her voice is absolutely haunting. Listen



CHVRCHES - The Bones of What You Believe
This girl sounds like she's twelve, but she can sure sing. One of many great bands from Glasgow (along with Belle and Sebastian, Mogwai, Primal Scream, and many more). Listen



Eagulls - Eagulls
Post-punk is still going strong in some parts of the world (Leeds, in this case). I first heard these guys on A.V. Undercover doing some fancy trick with a portable fan. Listen


Lady Gaga - ARTPOP
I've been meaning to write a post about why this album is better than Born This Way, but I still haven't gotten around to it. It has more edge, some nice bass lines, and a few spectacular hooks that she uses conservatively, which keep them from wearing out ("Watch me at the pool..."). Also I finally got to see her live on this tour. Listen

Moonface - Julia With Blue Jeans On
Moonface is the newest solo project of Wolf Parade (see below) singer Spencer Krug. The whole album is just him at a piano, and the piano work is absolutely astounding, and the lyrics are solid too. Listen


Typhoon - White Lighter
This is one of those baroque indie bands with dozens of instruments. I think this one has 14 members. I'm pretty sure this one got the most listens of all on this list. Listen



Discoveries

Foals - Holy Fire (2013)
I hadn't heard Foals before I stood out in the rain at Shaky Knees this summer. Everyone was cold and soaked to the bone, but everyone was too caught up in the music to notice. At one point, a tarp got dragged over the crowd and a few hundred people all danced together beneath it. I feel back in that moment again when I hear this album. "My Number" is so groovy. Listen

Guided By Voices - Bee Thousand (1994)
Okay, so I'm a decade behind on this one. If you are behind too, this is probably the greatest lo-fi album ever recorded. I got so obsessed with "Tractor Rape Chain" that I played it over and over until my hands were sore. I wonder sometimes if the low production quality hints at more than is actually there, and it is this inference that makes the songs more beautiful. Listen

Lovers - Dark Light (2010)
I'm not sure how such a good band picked such a generic name for both band and album. Anyway, they don't have a Wikipedia article, but I get the impression they are a lesbian indie rock band (in the vein of Tegan and Sara) from the west coast. I heard "Boxer" on the radio in a coffee shop and couldn't get it out of my head. Listen

Mogwai - Rock Action (2001)
This was the first Mogwai album to incorporate more electronic sounds into their music (as with their latest Rave Tapes, which gets an honorable mention below). It also has a lot more vocal parts than usual. This made it a bit divisive with the post-rockers, but in my opinion it is their best. Listen

The Radio Dept. - Clinging to a Scheme (2010)
This appeared on someone's top albums of all time list. When I gave it a listen, I realized I recognized the intro to "Heaven's on Fire" from an ad for Gold Soundz on WREK. Listen



Regina Spektor - Soviet Kitsch (2004)
So technically I heard this back around 2011. I didn't really give it a chance which I've realized was a mistake. This is now my favorite of her albums, although I suspect it is less popular with her "Samson"-loving fans. The uncharacteristic fury of "Your Honor" and the adorable intro for it really make this album, although "Poor Little Rich Boy" is likely the strongest track. Listen

Screaming Females - Ugly (2012)
I first heard this New Jersey punk band's track "Expire" on WREK and became obsessed. I can't comprehend how such fury comes from such a small person. And she can absolutely shred. If you don't believe me, check out their cover of Sheryl Crow. Listen


Sebadoh - Bakesale (1994)
I didn't realize you could get such beautiful melodies from power chords. This band is the result of Lou Barlow not getting along with J Mascis and leaving Dinosaur Jr. Some of the other albums get a little sappy but this one is well balanced. Listen


Sharon Van Etten - Tramp (2012)
I don't know what to say about this one, except that "Give Out" gets stuck in my head like mad. She had assistance from members of The National, Beirut, and Wye Oak, so it must be good. Listen



She Keeps Bees - Nests (2008)
She Keeps Bees has been described as a gender-swapped White Stripes, where she (Jessica Larrabee) is the shredding blues rocker who taught him to play the drums. She's generally compared to Sharon Van Etten and Cat Power, but I think she's more talented than both. Listen

Slowdive - Souvlaki (1993)
There is some chill, ambient stuff here, but this is probably the most extreme on the list. "Alison" starts the album off strong, and the rest keeps the pace. Listen



Wolf Parade - Apologies to the Queen Mary (2005)
This was the crowning achievement of a short-lived but critically-acclaimed group which split into dozens of other bands including Sunset Rubdown, the Handsome Furs, and Moonface. Every song on this is my favorite. Listen



Yo La Tengo - Popular Songs (2009)
Apparently this band has been around and releasing albums for decades now. Classic indie formula: soft, ostinato rhythm section with experimental guitar melodies. See also: I Can Hear the Heart Beating as One and And Then Nothing Turned Itself Inside-Out. Listen

Wye Oak - Civilian (2011)
I haven't been this obsessed with an album in a very long time. I can't seem to put into words how much I love this album, except that for a few weeks I listened to it at least twice a day. See also: Shriek and If Children. Listen



Honorable Mentions

Galaxie 500 - On Fire (1989)
Kendrick Lamar - good kid, m.a.a.d. city (2012)
Mogwai - Rave Tapes (2014)
The National - Trouble Will Find Me (2013)
Cat Power - You Are Free (2003)
This Frontier Needs Heroes - Hooky (2013)

Monday, November 3, 2014

Color of Music II

I long time ago (ages it seems), I posted about mapping the audio spectrum to the visual spectrum after watching Neil Harbisson's TED talk. Well NPR mentioned that same talk today and it got me excited about the project again. I played around some more using my slightly more developed MATLAB and DSP skills, and the results are below.


Quick recap:

Sound and light are both waves though they differ significantly in frequency, medium, propagation type, and speed. A major similarity though is that we have sensory organs for both, and those sensory organs have some interesting quirks. Humans can only perceive small bands of each spectrum. The audio band is typically quoted at 20Hz to 20KHz (point of reference: the A below middle C on a piano is 440Hz). The visible light spectrum goes from roughly 700 nm where infrared transitions to red, to about 400 nm where violet transitions into ultraviolet (it's easier to talk about light in wavelengths=speed of light/frequency because the frequencies are huge numbers). The exact endpoints of these bands vary from person to person, and often with age; however, the range for an average human is well known.

Another quirk of human perception is that we don't perceive equally across these bands. I know a lot more about these limitations in the audio world than in the video world, but there is plenty to read on that if you're interested. We perceive sound on a logarithmic scale, both in loudness and pitch. The decibel scale adjusts for this, so that a 20dB noise sounds twice as loud as a 10dB sound, even though the former is actually about 2.8 times the pressure. And a 40dB sound again sounds twice as loud as that, but is actually 10 times the pressure of 20dB and 28 times the pressure of 10dB. Not only this, but we don't perceive loudness evenly over all frequencies. 
Wikipedia

Lower frequencies sound much quieter than middle and high frequencies, and the function is not an elegant relation. Psychologists studied people's perceived loudness and created the equal-loudness contours. Along the red lines are sounds at a constant "perceived loudness" (measured in phons, a made-up unit which sets it's point of reference so that 20dB of pressure equals 20 phons). For different frequencies, different amounts of pressure are required to reach that phon level. There are a number of functions which approximate the correction factor, such as the A-weighting filter.



Wikipedia
Pitch perception is logarithmic also. Similar to the ELCs, psychologists created a unit for perceived pitch, the mel (where 1000 mel = 1KHz). A pitch that sounds about twice as high (2000 mel) is about 3.5KHz. The equation is below.

Results

The goal then is to have something that hears a pitch, corrects for proper human perception of that pitch, and then maps that frequency's relative position in the audio band to a color in the same relative position in the visual band. Low frequency sounds would map to red and high frequencies to violet. I want the colors to map to the red-green-blue color space, so that they can be represented by a computer (e.g. an LCD display, a 3-color LED, etc.). Of course, there are all sorts of issues with a computer's ability to generate actual colors, which I touched on in my earlier post about this. However, there are rough approximations that can map the color spectrum to RGB. Here's the one I used from StackOverflow (this guy has awesome graphs and seems to have done some impressive work):


The basic algorithm is to take a FFT of an audio sample at regular intervals to find the amplitude of different frequency components. Then those frequencies are converted to mels for the perceived log scale and then mels are mapped to light wavelengths. These wavelengths are then converted into RGB vectors using the algorithm above. The brightness of each channel is then weighted by both the phasor magnitude of the signal and the A-weighting loudness filter. This results in a final RGB vector for each small sample of audio where brightness is relative loudness and color is relative perceived pitch.

I ran this against MATLAB's sample file (a clip of Handel's Messiah). These are with an FFT sampling rate of 100Hz.

I then generated a video to go along with the audio. The first is the standard result, but it flickered unpleasantly, so the second is with a 10 frame (0.1 second) averaging filter applied. Forgive the low quality of each, generating MPEG4 video in MATLAB is not an easy task, and I ended up stringing together a bunch of JPEGs).





Unfortunately, it seems music is too low-bandwidth to see significant changes in pitch. One thing I might do in the future is map notes to colors, rather than the entire band.

Thoughts? Feel free to leave a comment. :)

Friday, September 12, 2014

New blog on the way

It's been a while since I've posted, but I assure you this isn't blogrot (a term I just made up). I'm in the process of building a new blog, and in the meantime I've been queueing up posts for it. By posting this publicly, I'm basically committing myself to releasing it soon.

I'd like to move all my old posts to the new blog, but that may not be possible, so this might hang around as an archive. In any case, stay tuned.

Sunday, June 8, 2014

Wearable: lighty.. shirty.. thingy

I have a couple of project updates I haven't gotten around to posting, but I wanted to share the one from this weekend first. The neighborhood I grew up in had a midnight 5K which encouraged lights and costumes. I figured this would be a good chance to do some wearable stuff. I spend waaayy to much money at Adafruit and got some EL wire and a decent-sized Neo-Pixel ring. I figured I'd attach these to a hoodie and make some cool light effects (and hopefully win the costume prize! :P ).

I got the aqua EL wire and the cheapest hoodie I could find on Amazon. When I realized the power requirements of the Neo-Pixel and a couple of batteries wasn't going to cut it, I got a decent sized portable charger (10000mAh should power everything for around 1~2 hours) and threw in another strand of EL wire for good measure. This was a different brand and turned out to be much poorer quality. For one thing, it was a log bluer than I expected for aqua. This turned out to be okay, because it's color ended up working better with everything over all, but the two were a lot further off than I expected. The isolation itself was blue; I suspect the wire lights up white underneath instead of lighting the actual color. Also the wire was not as bright and had a "thinner" appearance.

I put off actually putting anything together until the day of the race, so there were some serious hacks. I sewed the Neo-Pixel down to the chest, but broke two needles in the process of threading conductive wire through three through-holes. Then those needed a path to the pouch in the front where the electronics would go. I made the poor choice to "show off" the wires by threading the conductive thread on the outside of the shirt. I did a crappy job in a rush to get it done and it ended up looking pretty bad. One more plug for Adafruit: I had some conductive thread from eBay and it was crap. It was thick and would come unraveled and was generally difficult to work with. That's how I thought all conductive thread was. But I got some more from Adafruit and it was superb: thin and stiff, so easy to thread and tie. I'm not sure how well it would do in a sewing machine, but by hand it was great.

I had planned on attaching this plastic thing (that was actually half of an Easter egg turned upside-down) to act as a partial defuser and weird shape thing to the front, but I had no idea how to attach it. It turned out that hot glue worked much better than expected. Of course, I rushed that too and got some glue where I didn't want it.

As for the EL wire, since the strand from Amazon happened to fit through some holes in the plastic egg thing, I decided to put those on the body, and the Adafruit strand around the hood. This meant that I had to split and solder the cheap wire instead, which was much thinner and an absolute nightmare. The outer wires were a single, crazy-thin strand hidden behind two thick layers of isolation, and I was using a box cutter since I don't own any wire strippers.

I got that down, and realized I needed some sort of bus for the EL wire from the pouch as well. I had some extra EL wire clips so I attached them to some speaker wire (it was easy to tell sides apart and in reach from where I was sitting, so give me a break) and ran that through the inside of the shirt.

I attached the ends of the conductive thread from the LEDs to headers with wire leads. It turns out if you cut away a little insulation and tie the thread around that, it works pretty well. I doused those in too much hot glue and continued on.

At some point, I must have blown out the inverter from Adafruit, because it stopped powering anything. Fortunately the wire from Amazon came with one too. That circuit turned out to be quite resilient. Even though it was designed for 3V, it ran at 5V without anything except an obnoxious high-frequency whine. I after a couple shorts and a couple of shocks (EL wire runs at high voltage AC, if you didn't know), the inverter was happily powering all of the EL wire.

The last physical part was the microprocessor. I used a Teensy 2 since it is my favorite board and I had loaned out all my other boards. At this point it was crunch time, so instead of removing the temporary headers on the Teensy, I just added some more upside down so the female headers from the NeoPixel could plug in. I broke the battery clip on the inverter, so I ended up wrapping the ground from the USB cable to a leg of a BJT. Then I carefully balanced a safety capacitor across it for the LEDs, one leg of which I soldered to a slit in the isolation of the output wire. The battery pack has two outputs, one that maxes around 2A and one that maxes around 1A. I was worried that the LEDs and EL would together pull more than the max of the higher amp output, but it turned out to be okay. I ran the Teensy off the second output (in an attempt to protect it from the sketchy high-power circuit of the other stuff).

With all this working and the rest of the EL wire sewed down, I had about an hour left to program the Neo-Pixel. Fortunately I had played with the library a little bit before. I wanted to make a spinner with a tail of decreasing brightness. The library changes brightness for the entire output, and it is slow and requires a refresh. I tried to write my own function to reduce brightness, but due to some issue with bit shifting and data types that I didn't have time to debug, only the blue worked correctly (since those are the LSBs of the color integer). Blue it is, then. Also, I learned this late that the first LED on the chain doesn't work right. It flashes intermittently and often shows the wrong color. It could be a data/noise issue, but since the rest work, I suspect it is actually just a bad LED. The way it acts is strange, but consistent. I found removing one unrelated test line caused it to intermittently blink blue instead of green. As we say at hackathons: "Fuck it, ship it." I scooped everything up, dug around my closet for running shoes and made it to the race just in time.

One thing I really wish I had more time for was a better way to secure everything. I spent the whole race cradling a few pounds of electronics against my chest to keep them from bouncing around. The LEDs lost data connection early on and froze with a single, off-center white LED on and remained that way the rest of the race. At every bounce, the mode change button on the inverter would get pressed, so the EL wire was blinking randomly, and occasionally the inverter would short and even shock me. I dropped a couple of things and had to go back for them, and that sweatshirt was SO HOT (this is June in Atlanta). I managed to to okay, coming in around 28:02 (and I think I deserve a handicap!).

I didn't win the costume contest, although the judge came by after and said I was his second choice. I managed to put everything back together after the race. I will put the code on GitHub once I've debugged the dimmer issue. A pretty decent way to spend a weekend in my opinion.


By the way, I stumbled across this awesome alternative NeoPixel library for the Teensy 3.0. They made a full display that streams YouTube! Check it. 

Tuesday, February 18, 2014

Swank - A Stupid-simple static webserver

Today doing some web development I got tired of messing with httpd.conf files with XAMPP every time I changed projects, so I whipped up a little project called swank. Simply run swank from a terminal, optionally giving it the root path (if not the current working directory) and the port (if not 8000). It will spin up a static file webserver on your local machine, and spit back a link you can try in your browser. Ctrl-C to kill when you are done.

Sure, most browsers will open raw local files, but you run into issues with cross-site requests and over permissions. And the closer you can imitate a real webserver in development, the better.To install:
[sudo] npm install -g swank
It is my first item on npm. I was quite impressed with how easy it was to create a module and publish it. It is really nothing more than npm init (which is required for things like Heroku and good practice anyway) and npm publish.

I'd like to eventually drop the Connect middleware requirement, but it works for now (and it is realistically about 15 lines of code). Here is the project on npm. Let me know what you think!

EDIT: The latest version of swank now has optional ngrok support. Just add the --ngrok flag to the command, and have your server tunneled to the outside world. Pretty cool!

Tuesday, January 28, 2014

Temporary solution

I'm still working on getting an embedded car music player working, but I've been so busy with so many other things recently that I've rigged together a temporary solution. I got a spare wireless charger and literally hacked it into a car dock (using leftover plastic and hot glue - beautiful). Then some Tasker scripts turn on Bluetooth when wireless charging and automatically start playing music when connected to a Bluetooth audio receiver (this one is perfect and really cheap).



I had to put in a pretty long delay on connection before playing, thanks to some quirks with BT audio media volume levels since Jelly Bean. However it stops very quickly when removed or when the car shuts off. The audio quality is superb as well. No more risking my life trying to play some music in my car.

Friday, January 3, 2014

A little thing

I've been out of town for a couple days, so as soon as I got back I was desperate to build something. My wireless charger for my new Nexus 5 happened to be here, so on a whim I looked to see if Tasker was capable of telling if this was the case. Sure enough, Tasker can detect the charger flawlessly. So what to do with it...

I decided opening the desk clock was a little boring. I also noticed Tasker had a whole bunch of image manipulation methods and also an HTTP Get method. So I threw together some Ruby to scrape Flickr for a random image and pushed it to Heroku.

It seems that you can no longer easily export Tasker profiles, or else I would post it here. But it is pretty simple:
  1. Add a new Profile for Event > Power and set it to Wireless (or Any if you prefer)
  2. Create a new Task:
    1. Turn on Night Mode
    2. Set Variable %FLICKRIMG to Download/flickr.img (a static name will replace old images to save space)
    3. HTTP Get
      Server: random-flickr-image.herokuapp.com
      Output File: %FLICKRIMG
    4. Set Wallpaper to %FLICKRIMG
  3. Also create an Exit Task to turn Night Mode back off and set the wallpaper back to normal (or don't, and have a new wallpaper for the day!)
Here's a video of it in action. For a 3 hour project, I'm pretty excited.