Automated Tuning Of Linux Audio

Audio systems in Linux are terrible. You’ve never known true pain until you’ve tried to set up a recording or broadcasting workstation running Linux. I did, twenty years ago, and nothing has changed since. This wasn’t really a problem when Linux was either used in server spaces or some nerd’s battle station, but now we have small single board computers that everyone uses and wants to turn into a modular synth. Welcome to paintown, because the Linux audio stack is terrible.

For the past ten years, [Dynobot] has been working on improving audio in Linux. This is a decade of reading manuals from IBM and Oracle, and a deep knowledge of how to adjust settings so audio actually works. All of this work is now combined into a single script that improves everything. This means the priority of the Audio group is changed, the thread priority is better, the latency is better, and for anyone who wants to set up a local streaming service, the network latency is better. It’s not everything, and there’s no mention of recording multitrack audio, but we’ll accept the baby steps here.

There are two relevant Github repositories for this, the first containing audio adjustments for Debian-based systems, including the Raspberry Pi. This should work on any single board computer running Debian, and has been tested on all the Raspberry Pis, the Allo Sparky, ASUS Tinkerboard, and the Odroid C2. There’s also a version for TinyCore-based Linux systems that improves the priority of the audio threads, changes the thread scheduling from ‘whatever’ to FIFO, and improves the latency. If you’re running Linux, and you’re doing something with audio, this is what you need.

Python Script Sends Each Speaker Its Own Sound File

When it comes to audio, the number of speakers you want is usually governed by the number of tracks or channels your signal has. One for mono, two for stereo, four for quadrophonic, five or more for surround sound and so on. But all of those speakers are essentially playing different tracks from a “single” audio signal. What if you wanted a single audio device to play eight different songs simultaneously, with each song being piped to its own speaker? That’s the job [Devon Bray] was tasked with by interdisciplinary artist [Sara Dittrich] for one of her “Giant Talking Ear” installation project. He built a device to play multiple sound files on multiple output devices using off the shelf hardware and software.

But maybe a hack like this could be useful in many applications other than just art installations. It could be used in an Escape room, where you may want the various audio streams to start in synchronicity at the same time, or as part of a DJ console, sending one stream to the speakers and another to the head phones, or a game where you have to run around a room full of speakers in the right sequence and speed to listen to a full sentence for clues.

His blog post lists links for the various pieces of hardware required, although all of it is pretty generic, and the github repository hosts the code. At the heart of the project is the Sounddevice library for python. The documentation for the library is sparse, so [Bray]’s instructions are handy. His code lets you “take a directory with .wav files named in numeric order and play them over USB sound devices attached to the host computer over and over forever, looping all files once the longest one finishes”. As a bonus, he shows how to load and play sound files automatically from an attached USB drive. This lets you swap out your playlist on the Raspberry Pi without having a use a keyboard/mouse, SSH or RDP.

Check the video after the break for a quick roundup of the project.

Continue reading “Python Script Sends Each Speaker Its Own Sound File”

Tiny Amplifier With ATtiny

Small microcontrollers can pack quite a punch. With the right code optimizations and proper use of the available limited memory, even small microcontrollers can do things they were never intended to. Even within the realm of intended use, however, there are still lots of impressive uses for these tiny cheap processors like [Lukasz]’s audio amplifier which uses one of the smallest ATtiny packages around in the video embedded below.

Since the ATtiny is small, the amplifier is only capable of 8-bit resolution but thanks to internal clock settings and the fast PWM mode he can get a sampling rate of 37.5 kHz. Most commercial amplifiers shoot for 42 kHz or higher, so this is actually quite close for the limited hardware. The fact that it is a class D amplifier also helps, since it relies on switching and filtering to achieve amplification. This allows the amplifier to have a greater efficiency than an analog amplifier, with less need for heat sinks or oversized components.

All of the code that [Lukasz] used is available on the project site if you’ve ever been curious about switching amplifiers. He built this more as a curiosity in order to see what kind of quality he could get out of such a small microcontroller. It sounds pretty good to us too! If you’re more into analog amplifiers, though, we have you covered there as well.

Continue reading “Tiny Amplifier With ATtiny”

This Chromecast Volume Knob Has a Certain ’70s Chic

Chromecast devices have become popular in homes around the world in the last few years. They make it easy to cast audio or video from a smartphone or laptop, to a set of speakers or a display connected to the same network. [Akos] wanted to control the volume on these devices with a single, simple piece of equipment, rather than always reaching for a smartphone. Thus was built the CastVolumeKnob.

The project began by using Wireshark to capture data sent by the pychromecast library. Once [Akos] understood the messaging format, this was implemented in MicroPython on an ESP8266. A rotary encoder is used as a volume knob, and a Neopixel ring is used for visual feedback as to the device being controlled and the current volume level.

Further work was done to improve usability, with an ATtiny85 microcontroller being used to monitor the encoder for button presses before waking up the ESP8266, greatly reducing power consumption. The device is also rechargeable, thanks to an 18650 lithium polymer battery, and charger and boost converter boards. It’s all wrapped up in a sleek 3D printed case, with a translucent bezel for the LEDs and a swanky machined aluminium knob as the cherry on top.

It’s a homemade device that nonetheless would be stylish and unobtrusive in the living room environment. We imagine it proves very useful when important phone calls come in and it’s necessary to cut the stereo down to a more appropriate volume.

For another take, check out this USB volume knob with a nice weighty feel, courtesy of lead shot.

Listening To Mains Power, Part 2

The electricity on the power grid wherever you live in the world will now universally come to you as AC. That is to say that it will oscillate between positive and negative polarity many times every second. The frequency of 50 or 60Hz just happens to be within the frequency range for human hearing. There’s a lot more than this fundamental frequency in the spectrum on the power lines though, and to hear those additional frequencies better you’ll have to do a little bit of signal processing.

We first featured this build back when it was still in its prototyping phase, but since then it’s been completed and used successfully to find a number of anomalies on the local power grid. It takes inputs from the line, isolates them, and feeds them into MATLAB via a sound card where they can be analyzed for frequency content. It’s been completed, including a case, and there are now waterfall diagrams of “mystery” switching harmonics found with the device, plus plots of waveform variation over time. There’s also a video below that has these harmonics converted to audio so you can hear the electricity.

Since we featured it last, [David] also took some feedback from the comments on the first article and improved isolation distances on his PCB, as well as making further PCB enhancements before making the final version. If you’ve ever been curious as to what you might find on the power lines, be sure to take a look at the updates on the project’s page.

Continue reading “Listening To Mains Power, Part 2”

DIY Ribbon Element Upgrades A Studio Microphone

For those with some experience with pro audio, the term “ribbon microphone” tends to conjure up an image of one of those big, chunky mics from the Golden Age of radio, the kind adorned with the station’s callsign and crooned into by the latest heartthrob dreamboat singer. This DIY ribbon mic is none of those things, but it’s still really cool.

Of course the ribbon mic isn’t always huge, and the technology behind it is far from obsolete. [Frank Olsen]’s ribbon mic starts out with gutting a run-of-the-mill studio mic of its element, leaving only the body and connector behind. The element that he constructs, mostly from small scraps of aluminum and blocks of acrylic, looks very much like the ribbon element in commercial mics: a pair of magnets with a thin, corrugated strip of foil suspended between them. The foil was corrugated by passing it through a jig that [Frank] built, which is a neat tool, but he says that a paper crimper used for crafting would work too. There’s some pretty fussy work behind the cartridge build, but everything went together and fit nicely in the old mic body. The video below was narrated using the mic, so we know it works.

Fun fact: the ribbon microphone was invented by Walter Schottky. That Walter Schottky. Need more on how these mics work? Our colleague [Al Williams] has you covered with this article on the basics.

Continue reading “DIY Ribbon Element Upgrades A Studio Microphone”

A Hacked Solution For Non-Standard Audio Modules

When life hands you lemons, lemonade ends up being your drink of choice. When life hands you non-standard components, however, you’ve got little choice but to create your own standard to use them. Drinking lemonade in such a situation is left to your discretion.

The little audio record and playback modules [Fran Blanche] scored from eBay for a buck a piece are a good example. These widgets are chip-on-board devices that probably came from some toy manufacturer and can record and playback 20 seconds of audio with just a little external circuitry. [Fran] wants to record different clips on a bunch of these, and pictured using the card-edge connector provided to plug them the recording circuit. But the pad spacing didn’t fit any connector she could find, so she came up with her own. The module and a standard 0.1″ (2.54 mm) pitch header are both glued into a 3D-printed case, and the board is connected to the header by bonding wires. It makes a nice module that’s easily plugged in for recording, and as [Fran] points out, it’s pretty adorable to boot. Check it out in the video below.

Sure, the same thing could have been accomplished with a custom PCB breaking out the module’s pins to a standard card-edge connector. But [Fran] knows a thing or two about ordering PCBs, and our guess is she wanted to get this done with what was on hand rather than wait for weeks. There’s something to be said for semi-instant gratification, after all. And lemonade.

Continue reading “A Hacked Solution For Non-Standard Audio Modules”