An MP3 Player, Implemented As A Factorio Blueprint

Factorio is a factory simulation game that leads its players into many happy hours of building ever more complex factories, but it comes with a snag. Its built-in music is a fairly simple synthesiser, and that doesn’t really cut it for the musical experience. This irked [Nablanaut] to the extent that he created his own MP3 player. Not just any MP3 player, this one is implemented as a Factorio blueprint, using only those in-game speaker elements as output.

The synth has a range of built-in instrument voices and not much else, so he had to find a way to reproduce complex sounds using only those tools. As you can imagine, the result looks a lot like Fourier analysis, but with the added complication that those voices are not the discrete tones needed in such a system. The video below the break is a deep dive into the tricks and compromises required to not only play an MP3, but play it well, as we hear the various versions of the output as bit by bit they get better.

The blueprint itself isn’t created by hand, of course; instead, it’s generated procedurally by a script. As far as we can see, it contains both the audio samples and the playback logic, making for a very complex factory. We especially like the song at the end of the video.

Continue reading “An MP3 Player, Implemented As A Factorio Blueprint” →

Reverse Engineer That USB Device In Style

Proprietary device drivers, dedicated applications, and their ilk are the bane of the open-source hacker. If only we could snoop on every device out there, recording the “secret” USB transactions as they go over the wire, we’d have a chance.

[Emir Mrkaljević]’s tool, usb-rea, aims to make this process a whole lot less painful. The workflow is like this: you start capturing on USB, make an annotation about what action you’re taking, press the button a few times, and then move on to the next action.

sudo modprobe usbmon
usb-rea capture start -o lamp.pcapng
usb-rea mark -m lamp.pcapng.actions.json "brightness 0%"    # then click it in the vendor app
usb-rea mark -m lamp.pcapng.actions.json "brightness 50%"   # ...repeat for 3+ values per setting
usb-rea capture stop
usb-rea report lamp.pcapng -o report.md
usb-rea scaffold lamp.pcapng -o lamp_driver.py
usb-rea dissector lamp.pcapng -o lamp.lua      # Wireshark dissector for the same protocol

Usb-rea records all the USB traffic, timestamps it relative to your actions, and gives you a report, a driver, and a Wireshark protocol dissector out the back side. There is even an MCP file so that you can hand off the grunt work to the bots, possibly enabling this to work closed-loop?

Of course, you don’t want to reinvent the wheel, so it’s fun to see that there’s also a usb-rea lookup command to see if your VID:PID is already in the dataset. Most of the devices are CPU coolers, RGB controllers, and other blinged-out computer peripherals, but we imagine that it’s a lot more broadly applicable. We looked for our mouse on the list, but it’s sadly not there.

Usb-rea is not a silver bullet to bring back abandoned peripherals from the grave, because you still need to run the proprietary driver during the recording. But if you get ahead of the game and document the protocols before the manufacturers abandon them, you stand a chance. Get recording!

ESP-Guardian

Bringing A Cloud Based Monitor Home

When setting up to grow plants hydroponically, it’s important to keep an eye on the numbers, temperature, pH, and electrical conductivity, to name a few. To do this, [Joziti] bought a Bluelab Guardian monitor, which worked well but had a fatal flaw: it required an internet connection. To free the Guardian from the cloud, [Joziti] developed an ESPHome connection for the Bluelab Guardian.

As far as hardware projects go, this one is pretty straightforward. It involves replacing the built-in wireless chip with an ESP32-S3. [Joziti] used an Adafruit ESP32-S3 Feather, though other ESP32-S3s should work for this purpose too. Once you’ve opened up the Guardian and removed the factory Wi-Fi board, it’s a simple matter of tapping into the +5V/GND/TX/RX pins with your flashed ESP32-S3. Once the hardware is in place, the ESP32-S3 should be reaching out to your Home Assistant instance with all the data the Guardian used to send to the cloud is now sitting on just your local network.

The great part about this hack is that it opens up even more capabilities for your growing setup. With the data sitting in Home Assistant, you can now control automations using that data. Too cold? Flip on some lights. pH out of bounds? Maybe have it send you a message to check it out. Thanks for sharing this improvement on a product, [Joziti]. It’s always great to see a hack that turns a product you bought into a product you own. Be sure to check out some of our other ESPHome hacks we’ve featured over the years.

RPN Loved Honk If (or, Write Your Own PostScript Interpreter)

Maybe you like old laser printers. Maybe you were a fan of [Don Lancaster]. Maybe you like Forth, HP calculators, and everything RPN. Whichever it is, why not write your own PostScript interpreter? That’s what [beyondloom] did (and we shamelessly stole their joke for the post title, too).

PostScript started out as a language to describe pages for laser printers but went on to have a life of its own, including a stripped-down version being at the core of PDF files. If you are a fan of RPN, you’ll love PostScript, which operates on several stacks.

Continue reading “RPN Loved Honk If (or, Write Your Own PostScript Interpreter)” →

DIVINER: Occult Synth Firmware For The Cardputer

We see some strange software around these parts, but this is probably the strangest. DIVINER is a firmware for the M5 Cardputer, which is an interesting device in its own right, being essentially a tiny ESP32-S3 dev kit with an even tinier screen, keyboard, some GPIOs, I2C, and an audio jack for output. It is essentially a blank canvas that can do anything if you write the firmware for it.

And that’s what DIVINER does: a little of everything. It’s part standalone synthesizer and sequencer, taking advantage of the I2S audio out, part visualization engine, part WiFi and Bluetooth scanner and monitor (what?), with an LLM interface and an IR blaster thrown in for good measure. [voidrane Splicer] even explores the Channel-State Information to do presence detection, like we’ve seen recently elsewhere. Byte-beat player anyone?

The Hackaday.io page talks about the underlying system layer before it even gets to the applications, and we get the feeling that all of the different apps, called “rites”, were crammed in to exercise it and show off the “blood and ember”, Diablo-esque visual style. But that doesn’t stop us from enjoying the audio engine, demonstrated in the video below, or the awesome graphics.

Do these apps hang together more than visually? Do they need to? Is the sum of the parts so large that you don’t even worry about the whole? We don’t know, but it’s also got a simulator so you can try that out while your Cardputer is shipping.

Continue reading “DIVINER: Occult Synth Firmware For The Cardputer” →

Warm Analog DSP, On The ESP

We love audio, and we love messing around with it. So when [mircemk] wrote in with his latest audio-mangling device, we had to give it a look. It’s a tube-sound processor implemented in an ESP32 with a WM8960 handling the audio side of things. Tubes are expensive, power hungry, and a general pain in the posterior, so there is incentive to DIY it yourself with DSP. The whole setup is mounted in a Tektronix-inspired case that would be at home on the workbench or in the living room.

See? No tubes!

What’s ironic about the tube sound is that it’s essentially a nonlinear distortion of the audio, but it’s a distortion that can sound better than the undistorted signal. (Take that, engineering!) Push-pull transistor amplifiers tend to distort the top and bottom end of the signal similarly, while tubes round off the tops more than the bottoms. [mircemk] lets you tweak this transfer function, and displays it nicely on the screen.

But there’s one more important way that tubes color the sound — they respond slowly to rapidly changing signals — and [mircemk] says he implemented that as well.  We couldn’t find that part of the distortion accounted for in the code, but maybe you can?

Anyway, this is a fantastic audio project, and it just goes to show you how far you can go with some simple parts and clever programming. Indeed, we’ve seen this rig before, with different code that made it a parametric EQ. Once you’ve got the sound turned into numbers, you can math anything at it.

A Hazeltine 1420 Lives Again

There was a time when buying a computer also meant picking out a compatible terminal. There were many to choose from, some good and some bad. While we were partial to TeleVideo, other well-known names included Lear Siegler and ADDS. There was also Hazeltine, a well-known brand that could emulate many other terminals. [The Byte Attic] had an unusable Hazeltine 1420, and finally got around to getting it working again.

As you might expect, the old terminal was full of suspect capacitors. A power transistor was also missing, hinting that someone had been robbing this unit to fix another. In addition to fixing the device, the plan was to improve it with switching regulators. These old terminals generated a lot of heat with linear regulators.

The power supplies were often the major issue with these kinds of devices, and scorch marks under the bridge rectifiers didn’t bode well, either. Another concern: the chips that hold the character sets and some other logic are unobtainable. If they were dead, there would be virtually no way to replace them. The plan was to read them, if possible, and design replacements for the day they did fail. If it wasn’t already too late.

Continue reading “A Hazeltine 1420 Lives Again” →