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.
Continue reading “Transcribing Piano Rolls with Python”
A few days ago we featured the USBPass, an offline password keeper made with very few components. At the end of our write-up we mentioned that [Josh] was already working on another version of his hardware, which involved adding an OLED screen to the platform. To help him pick one he created QtLedTest, a Qt-based tool that simulates different OLED displays and GUI layouts for them. Internally QtLedTest is composed of QLedMatrix (a widget that simulates LED matrices), an SSD1306 OLED controller simulator, a simple graphics drawing library and some functions to draw text on the simulated screen. [Josh] used Fontbuilder together with a program he made in order to convert fonts he had found on the internet to C files. All the source code [Josh] made can be found on Github and should be updated in coming weeks as the final program is a bit slow to render the simulated screens.
[Jason] just tipped us off about his recent experiment, in which he creates a sonar system using standard audio equipment and a custom Python program. In case some of our readers don’t already know it, Sonar is a technique that uses sound propagation to detect objects on or under the surface of the water. It is commonly used in submarines and boats for navigation. [Jason]’s project uses active sonar, which consists in sending short audio bursts (chirps) and listening for echoes. The longer it takes for the echo to return, the further the object is. Though his proof of concept is not used underwater, that may change if he continues the project.
The audio editing software Audacity was used to make a fast frequency changing chirp, along with PyAudio libraries for the main Python program. Exact time of arrival is detected by correlating the microphone output with the transmitted signal. Given that [Jason] uses audible frequencies, we think that the final result shown in the video embedded below is quite nice.
Continue reading “Sonar With Python and Conference Call Hardware”
Recent experiments with the Arduino CapSense library led [Bryan] around the Internet looking for interesting applications. He hit upon a very cool touch scroll wheel made entirely with PCB traces, but the geometry – three interleaved zig zags is impossible to build in the decidedly ungeometric Eagle PCB package. One thing leads to another and now [Bryan] has a cap touch wheel Eagle part designed entirely in OpenSCAD.
The touch scroll wheel implementation [Bryan] found came from an ST touch controller datasheet and used oddly-shaped patterns to create a capacities sensor. Eagle is terrible for designing anything that isn’t laid out at a 45 degree angle, so he fired up OpenSCAD to draw these triangles. Importing into Eagle was another challenge, but a quick Ruby script to convert a DXF file into a set of coordinates for Eagle’s POLYGON command made everything very easy.
If OpenSCADing touch sensors isn’t your thing, there’s also an Eagle library full of them – something we found last week.
[Damien George] just created Micro Python (Kickstarter alert!), a lean and fast implementation of the Python scripting language that is optimized to run on a microcontroller. It includes a complete parser, compiler, virtual machine, runtime system, garbage collector and was written from scratch. Micro Python currently supports 32-bit ARM processors like the STM32F405 (168MHz Cortex-M4, 1MB flash, 192KB ram) shown in the picture above and will be open source once the already successful campaign finishes. Running your python program is as simple as copying your file to the platform (detected as a mass storage device) and rebooting it. The official micro python board includes a micro SD card slot, 4 LEDs, a switch, a real-time clock, an accelerometer and has plenty of I/O pins to interface many peripherals. A nice video can be found on the campaign page and an interview with the project creator is embedded after the break.
Continue reading “Interview with [Damien George], Creator of the Micro Python project”
[Stephen Wolfram], possibly the only person on Earth who wants a second element named after him, is giving away Mathematica for the Raspberry Pi.
For those of you unfamiliar with Mathematica, it’s a piece of software that allows you to compute anything. Combined with the educational pedigree of the Raspberry Pi, [Wolfram] and the Pi foundation believe the use of computer-based math will change the way students are taught math.
Besides bringing a free version of Mathematica to the Raspberry Pi, [Wolfram] also announced the Wolfram language. It’s a programming language that keeps most of its libraries – for everything from audio processing, high level math, strings, graphs, networks, and even linguistic data – on the Internet. It sounds absurdly cool, and you can check out a preliminary version of the language over on the official site.
While a free version of Mathematica is awesome, we’re really excited about the new Wolfram language. If it were only an interactive version of Wolfram Alpha, we’d be interested, but the ability to use this tool as a real programming language shows a lot of promise for some interesting applications.
The Hack-a-Day logo challenge keeps on bearing fruit. This tip comes from [Enrico Lamperti] from Argentina who posted his follies as well as success creating a Hack-a-Day logo using a home built scanning laser projector.
The build consists of a couple small servos, a hacked up pen laser and an Arduino with some stored coordinates to draw out the image. As usual the first challenge is powering your external peripheral devices like servos. [Enrico] tackled this problem using 6 Ni-MH batteries and an LM2956 simple switcher power converter. The servos and Arduino get power directly from the battery pack and the Arduino controls the PWM signals to the servos as they trace out the stored coordinate data. The laser is connected to the servo assembly and is engaged and powered by an Arduino pin via an NPN transistor. He also incorporated a potentiometer to adjust the servo calibration point.
His first imported coordinate data generated from some Python script was not very successful. But later he used processing with an SVG file to process a click-made path the Arduino could use as map data to draw the Hack-a-Day logo. It requires a long exposure time to photograph the completed drawing in a dark room but the results are impressive.
It’s an excellent project where [Enrico] shares what he learned about using Servo.writeMicroseconds() instead of Servo.write() for performance along with several other tweaks. He also shared the BOM, Fritzing diagram, Processing Creator and Simulator tools and serial commands on GitHub. He wraps up with some options that he thinks would improve his device, and he requests any help others may want to provide for better performance. And if you want you could step it up a notch and create a laser video projector with an ATMega16 AVR microcontroller and some clever spinning tilted mirrors.