ESP32 Becomes Music Player In Under 40 Lines Of Code

The demo code for [XTronical]’s ESP32-based SD card music player is not even 40 lines long, though it will also require a few economical parts before it all works. Nevertheless, making a microcontroller play MP3s (and other formats) from an SD card is considerably simpler today than it was years ago.

Part of what makes this all work is I2S (Inter-IC Sound), a format for communicating PCM audio data between devices. Besides the ESP32, at the heart of it all is an SD card reader breakout board and the MAX98357A, which can be thought of as a combination I2S decoder and Class D amplifier. The ESP32 reads audio files from the SD card and uses an I2S audio library to send the I2S data stream to the MAX98357A (or two of them for stereo.) From there it is decoded automatically and audio gets pumped though attached speakers.

A few economical components, and only a handful of connections between them.

It’s amazing how much easier audio is to work with when one can take advantage of shuffling audio data around digitally, and the decoder handles multiple formats with an amplifier built in. You can see [XTronical]’s ESP32 player in action in the video embedded below.

Continue reading “ESP32 Becomes Music Player In Under 40 Lines Of Code”

Don’t Forget The Baby!

It must be a common worry among parents, that they might forget their offspring and leave them in the car where they would succumb to excessive heat. So much so that [Matt Meerian] has produced an alarm that issues a verbal reminder to check for the youngster when the vehicle is turned off.

It’s a simple enough device, with an ATmega328, an off-the-shelf MP3 module, and a power supply regulator to deliver 5 V into a pair of supercapacitors from the vehicle accessory socket’s 12 V. The idea is that the  power is cut when the vehicle ignition is turned off, and that the supercaps have enough energy within them to play the reminder sample for the driver to check for forgotten children.

We can’t help remarking that a percentage of cars leave their accessory sockets turned on all the time, so it would be interesting to ponder how one might detect the car being turned off in that case. He muses about using a surplus cell phone instead of his ATmega328, perhaps the MEMS sensor on a phone could also be used to detect the vibrations of the engine stopping as it was turned off. Such cars notwithstanding, this unit is a straightforward solution to the problem in hand.

Musical Mod Lets MRI Scanner Soothe The Frazzled Patient

Hackers love to make music with things that aren’t normally considered musical instruments. We’ve all seen floppy drive orchestras, and the musical abilities of a Tesla coil can be ear-shatteringly impressive. Those are all just for fun, though. It would be nice if there were practical applications for making music from normally non-musical devices.

Thanks to a group of engineers at Case Western Reserve University in Cleveland, there is now: a magnetic resonance imaging machine that plays soothing music. And we don’t mean music piped into the MRI suite to distract patients from the notoriously noisy exam. The music is actually being played through the gradient coils of the MRI scanner. We covered the inner working of MRI scanners before and discussed why they’re so darn noisy. The noise basically amounts to Lorenz forces mechanically vibrating the gradient coils in the audio frequency range as the machine shapes the powerful magnetic field around the patient’s body. To turn these ear-hammering noises into music, the researchers converted an MP3 of [Yo Yo Ma] playing [Bach]’s “Cello Suite No. 1” into encoding data for the gradient coils. A low-pass filter keeps anything past 4 kHz from getting to the gradient coils, but that works fine for the cello. The video below shows the remarkable fidelity that the coils are capable of reproducing, but the most amazing fact is that the musical modification actually produces diagnostically useful scans.

Our tastes don’t generally run to classical music, but having suffered through more than one head-banging scan, a half-hour of cello music would be a more than welcome change. Here’s hoping the technique gets further refined.

Continue reading “Musical Mod Lets MRI Scanner Soothe The Frazzled Patient”

PiPod: A Raspberry Pi Zero Portable Music Player

[Bram] wasn’t satisfied with the portable music playback devices that were currently available. He craved an offline music player that had a large storage capacity but found that this was only available in high-end, off-the-shelf options, which were far too expensive. [Bram] decided to make his own, powered by a Raspberry Pi zero. After building an initial prototype, the design was iterated a few times, with the latest version featuring a BOM cost of roughly €80.

The whole project is open source, with hardware and software files available on the project GitHub. A 2.2″ TFT displays the UI, which is of course completely customisable. Everything is squashed into a 3D printed case, which has the smallest form factor possible whilst retaining a decent amount of battery life. The electronics are what you’d expect: a boost converter to produce 5 V for the Pi from the 3.7V battery, a charge controller and a battery protection circuit. As a bonus, the battery voltage is monitored with a 12-bit ADC which reports to the Pi, enabling it to do a safe shutdown at low voltage, and display battery level on the UI.

Since the whole purpose of the device is to play audio, onboard filtered PWM wasn’t going to cut it, so instead a 24-bit DAC talks to the Pi via I2S. The audio player backend is VLC, so there’s support for plenty of different file types. A disc image of the whole system is available with everything pre-configured, and you can even buy the assembled PCB from Tindie.

Want to keep the look and feel of your old iPod? We covered an impressive restoration of a 6th gen model, upgrading the storage and battery significantly.

Chest Of Drawers Stores Audio Memories

Some people collect stamps, some collect barbed wire, and some people even collect little bits of silicon and plastic. But the charmingly named [videoschmideo] collects memories, mostly of his travels around the world with his wife. Trinkets and treasures are easy to keep track of, but he found that storing the audio clips he collects a bit more challenging. Until he built this audio memory chest, that is.

Granted, you might not be a collector of something as intangible as audio files, and even if you are, it seems like Google Drive or Dropbox might be the more sensible place to store them. But the sensible way isn’t always the best way, and we really like this idea. Starting with what looks like an old card catalog file — hands up if you’ve ever greedily eyed a defunct card catalog in a library and wondered if it would fit in your shop for parts storage — [videoschmideo] outfitted 16 drawers with sensors to detect when they’re opened. Two of the drawers were replaced by speaker grilles, and an SD card stores all the audio files. When a drawer is opened, a random clip from that memory is played while you look through the seashells, postcards, and what-have-yous. Extra points for using an old-school typewriter for the drawer labels, and for using old card catalog cards for the playlists.

This is a simple idea, but a powerful one, and we really like the execution here. This one manages to simultaneously put us in the mood for some world travel and a trip to a real library.

Continue reading “Chest Of Drawers Stores Audio Memories”

Cluephone For Partiers

[Sam Horne] adapted an old school landline phone to deliver clues to birthday party guests. When guests find a numerical clue, they type it into the keypad to hear  the next clue, which involves decoding some Morse code.

The phone consists of an Arduino Pro Mini, a MP3/WAV trigger, and the phone itself, of which the earpiece and keypad have been reused. [Sam] had to map out the keypad and solder leads connecting the various contact points of the phone’s PCB to the Arduino’s digital pins. He used a digitally-generated voice to generate the audio files, and employed the Keypad and Password Arduino libraries to deliver the audio clues.

This seems like a great project to do for a party of any age of attendee, though the keying speed is quick. Hopefully [Sam]’s guests have a high Morse WPM or are quick with the pen! For more keypad projects check out this custom shortcut keyboard and printing a flexible keyboard.

Continue reading “Cluephone For Partiers”

Patents On MP3 Format Due To Expire

MP3 took off in the late 90s as the digital music format. It then proceeded to slaughter the CD, and launch the file sharing revolution as well. It’s a proud format that has roots stretching all the way back to the early 1980s, when the possibility of sending music over ISDN lines was first considered. Now the patents on it are beginning to expire and its licencing program has been terminated.

The MP3 standard was the property of Fraunhofer IIS, and the original licencing model was intended such that encoders would be expensive, and decoders relatively inexpensive. This would allow people to buy software to listen to MP3s cheaply, but the creation of MP3s would be expensive, and thus handled by studios and music labels. This all changed when a high-quality MP3 encoder was leaked to the public, and suddenly it became possible to readily convert your CDs at home into the MP3 format.

One hangover of this ownership of the MP3 standard was that when you installed certain FOSS software, such as Audacity or a Linux distro, you would find that you had to go and do some legwork to find an MP3 codec. That was because it wasn’t worth the legal trouble for the FOSS authors to arrange a workaround, and trading in proprietary software is the antithesis to everything they stand for.

However, now that more of the relevant patents are expiring, you can now expect MP3 support to be baked into more software. It may be more than a little late, with more advanced audio formats beginning to take over, but it’s great to know that Fedora, for one, is starting to include MP3 support with their releases.

If you’d like to read more about the history of the MP3, check out this great article from NPR. Fraunhofer have their own great history site, too. If all this talk of advanced audio formats has gotten you excited, check out this MP3 decoder written for the ESP8266.

[Thanks to Tim Trzepacz for the tip!]