Transcribing Piano Rolls with Python

Piano Roll


Perforated rolls of paper, called piano rolls, are used to input songs into player pianos. The image above was taken from a YouTube video showing a player piano playing a Gershwin tune called Limehouse Nights. There’s no published sheet music for the song, so [Zulko] decided to use Python to transcribe it.

First off the video was downloaded from YouTube. This video was processed with MoviePy library to create a single image plotting the notes. Using a Fourier Transform, the horizontal spacing between notes was found. This allowed the image to be reduced so that one pixel corresponded with one key.

With that done, each column could be assigned to a specific note on the piano. That takes care of the pitches, but the note duration requires more processing. The Fourier Transform is applied again to determine the length of a quarter note. With this known, the notes can be quantized, and a note duration can be applied to each.

Once the duration and notes are known, it’s time to export sheet music. LilyPond, an open source language for music notation, was used. This converts ASCII text into a sheet music PDF. The final result is a playable score of the piece, which you can watch after the break.

[Read more...]

Thumbs-Down Songs on Pandora with Your Mind

[Steven] likes music. Like many of us, he uses Pandora to enjoy the familiar and to discover new music. Now, Pandora means well, but she gets it wrong sometimes. [Steven] has had a Mindwave Mobile EEG headset lying around for a while and decided to put it to good use. With the aid of a Raspberry Pi and a bluetooth module, he built a brainwave-controlled Pandora track advancing system.

The idea is to recognize that you dislike a song based on your brainwaves. The Mindwave gives data for many different brainwaves as well as approximating your attention and meditation levels. Since [Steven] isn’t well-versed in brainwavery, he used Bayesian estimation to generate two multivariate Gaussian models. One represents good music, and the other represents bad music. The resulting algorithm is about 70% accurate, so [Steven]‘s Python script waits for four “bad music” estimations in a row before advancing the track.

[Steven] streams Pandora through pianobar and has a modified version of the control-pianobar script in his GitHub repo His script will also alert you if the headset isn’t getting good skin contact, a variable that the Mindwave reports on a scale of 0 to 200.

Stick around for a demo of [Steven] controlling Pandora with his mind. If you don’t have an EEG headset, you can still control Pandora with a Pi, pianobar, and some nice clicky buttons.

[Read more...]

A Guitar From an Old Tin Box


[Atdiy and Whisker], collectively known as  [The Tymkrs] have been busy honing their luthier skills. They’ve created a 10 part YouTube series about the construction of their new cigar box guitar. Instead of a cigar box though, they’ve substituted a 1920’s tin cigarette box. The Omar Cigarette company gave “Project Omar” it’s name. Like [Tymkrs] previous guitar, Omar is a three string affair. The neck was cut from Black Palm, which really shined when polished with a mixture of orange oil and beeswax. They also threw in a couple of new tricks on this build. Omar is an electric guitar, with a pickup custom wound  by [Bob Harrison]. Omar also has frets, which creates a whole new set of complications. Frets are generally installed by cutting slits in the guitar neck with a fret saw. Rather than buy a new tool, [Tymkrs] created a simple jig for their mini table saw. The jig held the guitar neck perpendicular with the saw blade. This made quick work of the many fret slits to be cut. Installed frets must also be dressed and leveled, which is a time-consuming process. 

The tin cigarette box also created a new set of problems. The thin tin proved to be a bit on the weak side when the strings were tightened down. A bit too much pressure on the box while playing would cause notes to bend, much like the tremolo or whammy bar on a standard electric guitar. [Tymkrs] were able to counteract this by adding bracing inside, and a couple of black palm braces to the back of the box.

Hum was also a problem. When [Tymkrs] first plugged in, they found they had more 60Hz mains hum than signal from their strings. Omar uses a classic single coil guitar pickup. Single coils will pick up noise from any magnetic field, including the field created by the studio electrical system. A humbucking pickup uses two coils to counteract this effect. Humbuckers also have a slightly different tone than single coils. [Tymkrs] wanted to stick with their single coil tone, so they counteracted the hum by raising the pickup closer to the strings. Higher pickups receive more signal from the strings, so this is basically a free signal to noise ratio improvement. They also grounded the entire tin box, along with Omar’s metal tail stock. The final build sounds great, as evidenced by the jam session toward the end of Video 10.

[Read more...]

Retrotechtacular: Wax On, Wax Off: How Records Are Made

In this 1942 tour of the RCA Victor plant in Camden, NJ, we see the complete record making process from the master cut production to the shipping of multiple 78RPM shellac pressings. The film centers around a recording of Strauss’ Blue Danube waltz as performed by the 1940s equivalent of studio musicians, the Victor Salon Orchestra.

The master record starts life as a thin layer of molten wax poured on to a hot circular plate in a dust-free room.  Bubbles and impurities are blow torched out, and the wax is left to cool under a steel dome. This perfect disc is carefully passed to the recording studio through a special slot, where it is laid carefully beneath the cutting stylus.

Unlike today’s multi-track recording sessions, the master was cut from the performance of a complete band or orchestra all playing as they would in concert. The sound engineer was responsible for making fast changes on the fly to ensure sonic  and groove width consistency. 

After cutting, the delicate wax undergoes several phases of electrolysis that form the metal master. It is bombarded first with pure gold and then twice with copper sulfate to build a sturdy disc. The copper ionization process also ensures high fidelity in the final product.

Although mighty, this master won’t last long enough to make all the necessary pressings, so a mother matrix is made. This is a negative image of the master. The mother is formed by electrolytically bathing the master in nickel, and then adding a thin film of some indeterminate substance. Another copper bath, and mother emerges. As soon as possible, the master is separated and whisked away to the storage vault.

Since a positive image is needed for pressing, a stamping matrix is made. Mother gets a nickel bath for durability, and then a copper bath to form the stamping matrix. Many stampers are created so that several records can be pressed at once. These images get a chromium plating to help them last through many pressings.

[Read more...]

IR Theremin Speaks In Four Voices


At the end of every semester, we get a bunch of cool and well-documented student projects from Cornell’s ECE4760 class. [Scott] and [Alex]‘s infrared theremin is no exception.

The classic theremin design employs each of the player’s hands as the grounded plate of a variable capacitor in an LC circuit. For the pitch antenna, this circuit is part of the oscillator. For the volume antenna, the hand capacitor detunes another oscillator, changing the attenuation in the amplifier.

[Scott] and [Alex] put a twist on the theremin by using two IR sensors to control volume and pitch. The sensors compute the location of each hand and output a voltage inversely proportional to its distance from the hand. An ATMega1284P converts the signal to an 8-bit binary number for processing. They built four voices into it that are accessible through the push-button switch. The different voices are created with wave combinations and modulation effects. In addition to Classic Theremin, you can play in pure sine, sawtooth, and FM modulation.

If you’re just not that into microcontrollers, you could build this digital IR theremin instead. If you find IR theremins soulless or plebeian, try this theremincello.

[Read more...]

Cast a Shadow, Play a Note

Looking for a way to entertain friends and family this holiday season? Look no further than the Arduino-powered Photocell Piano. [Asahillis] has posted this Instructable for building a 6-note musical command center.

The piano uses photoresistors to turn each note on when the player runs their hand over it. Notes can be tuned independently using potentiometers on the front of the box. The hack uses two circuits: one to generate the tones, and a second to mix them. [Asahillis] adapted [Forest Mims III]‘s timeless schematics for the 555 Tone Maker and the 741 Audio Mixer to create his Photocell Piano.

When the instrument is powered on, the code takes a 5-second reading of the ambient light, and sets a threshold based on its findings. Afterward, the first note will sound, indicating the piano is ready to be played. Each note has its own if-else statement that tells it to sound when its corresponding  photoresistor reaches a value below the set threshold (when the player casts a shadow). There’s a demo video included in the guide but we couldn’t embed it here.  Check out the demo video after the break.

If you prefer to rock out with your lights out, there’s always this impressive laser harp.

[Read more...]

Piano Repurposed as a Resonant Synth Speaker


[Richard] recently rediscovered some files from a hack he did back in 2004. He was experimenting with exciting piano strings via electromagnetic fields. The idea shares some elements with the self tuning piano we saw back in 2012. Piano strings, much like guitar strings, are made of steel alloys. This means they create electricity when vibrated in a magnetic field. This is the basic principle upon which electric guitar pickups are built. The idea also works in reverse. The strings will vibrate in response to a modulated electromagnetic field. Anyone who has seen an E-bow knows how this can be applied to the guitar. What about the piano?

[Richard] started with the Casio CZ-101, a classic synth in its own right. The Casio’s output was run through a Peavy 100 watt amplifier. The amplified output was then used to drive custom coils mounted on a piano. The coils had to be custom wound to ensure they would be compatible with the 4 – 8 ohm impedance expected by the amplifier. [Richard] ended up winding the coils to 28 ohms. Six of these coils in parallel put him just over the 4 ohm mark. The coils effectively turned the piano into a giant speaker for the synth. In [Richard's] write-up (word doc link) he mentions that the strings basically act as a giant comb filter, each resonating strongly in response to frequencies in its harmonic series.

The results are rather interesting. The slow attack of the magnetic fields coupled with the synth’s patch results in a surprising variety of sound. The three examples on [Richard's] blog vary from sounding like a power chord on a guitar to something we’d expect to find in an early horror movie. We would love to see this idea expanded upon. More efficient coils, and more coils in general would add to the effect. The coils on various string groups could also be switched in and out of the system using MIDI control, allowing for even more flexibility. [Read more...]


Get every new post delivered to your Inbox.

Join 96,656 other followers