Sweet Streams Are Made Of These: Creating Music On The Command Line

There are countless ways to create music. In the simplest form, it won’t even require any equipment, as evidenced by beatboxing or a capella. If we move to the computer, it’s pretty much the same situation: audio programming languages have been around for as long as general-purpose high-level languages, and sound synthesis software along with them. And just as with physical equipment, none of that is particularly necessary thanks to sed. Yes, the sed, the good old stream editor, as [laserbat] shows in her music generating script.

Providing both a minified and fully commented version of Bach’s Prelude 1 in C major as example, [laserbat] uses a string representation of the sheet music as the script’s starting point, along with a look-up table of each transformed note’s wavelength. From here, she generates fixed length PCM square wave signals of each of the notes, to be piped as-is to the sound card via ALSA’s aplay or SoX’s play. To keep things simple enough, she stays within the region of printable characters here, using space and tilde as low and high values respectively, providing highest possible volume at the same time this way.

The concept itself is of course nothing new, it’s how .au and .wav files work, as well as these little C lines. And while the fixed note duration takes away some of the smoothness in [laserbat]’s version, adding variable duration might just be a hint too much for a sed implementation, although we’ve certainly seen some more complex scripts in the past.

[via r/programming]

Music Box Plays “Still Alive” Thanks To Automated Hole Puncher

Custom hole punch and feed system

Most projects have one or two significant aspects in which custom work or clever execution is showcased, but this Music Box Hole Punching Machine by [Josh Sheldon] and his roommate [Matt] is a delight on many levels. Not only was custom hardware made to automate punching holes in long spools of paper for feeding through a music box, but a software front end to process MIDI files means that in a way, this project is really a MIDI-to-hand-cranked-music-box converter. What a time to be alive.

The hole punch is an entirely custom-made assembly, and as [Josh] observes, making a reliable hole punch turns out to be extremely challenging. Plenty of trial and error was involved, and the project’s documentation as well as an overview video go into plenty of detail. Don’t miss the music box version of “Still Alive”, either. Both are embedded below.

Continue reading “Music Box Plays “Still Alive” Thanks To Automated Hole Puncher”

Music Reading For Machines

“Dammit Jim, I’m a hacker, not a musician!”, to paraphrase McCoy Scotty from the original Star Trek series. Well, some of us are also musicians, some, like me, are also hack-musicians, and some wouldn’t know a whole note from a treble clef. But every now and then the music you want is in the form of sheet music and you need to convert that to something your hack can play. If you’re lucky, you can find software that will read the sheet music for you and spit out a MIDI or WAV file. Or, as with my hand-cranked music player, you may have to read just enough of the music yourself to convert musical notes to frequencies for something like a 555 timer chip. We’ll dive into both cases here.

Continue reading “Music Reading For Machines”

Tablet Rig Takes Sheet Music Digital

music-stand-tablet-holder

[Bill Dudley’s] wife wanted to use a couple of different tablets for displaying sheet music. Sure, a proper music stand will have no trouble supporting the weight of the device, but if it’s not secured it place you may soon have a broken device. [Bill’s] solution was to build this tablet stand out of PVC.

The image above doesn’t tell the entire story of how he did this. But if you look really closely you’ll notice that the pipe is actually acting as a frame rather than a cradle. After measuring, cutting, and gluing all of the components together he cut a channel around the inside of the u-shaped PVC frame. The channel is the exact thickness of the tablet and holds the device securely. A base from a music stand makes up the rest of the rig.

Pages can be turned using a USB foot pedal. This is fantastic for gigging musician who use digital music collections like the Real Book.