Shell Script Synthesizer Knocks Your SoX Off

Sound eXchange, or SoX, the “Swiss Army knife of audio manipulation” has been around for as long as the Linux kernel, and in case you’re not familiar with it, is a command line tool to play, record, edit, generate, and process audio files. [porkostomus] was especially interested about the generating part, and wrote a little shell script that utilizes SoX’s built-in synthesizer to compose 8-bit style music.

The script comes with a simple yet straightforward user interface to record the lead and bass parts into a text file, and play them back later on. Notes from C2 to C5 are currently supported, and are mapped to the keyboard in a two-row piano layout. The output file format itself is just a plain text listing of the played note, wave form, and note length. This lets you easily edit the song or even generate it from an alternative source, for example MIDI. Also note that there are no initial audio files required here, SoX will generate them as needed.

Admittedly, the command line interface may not be the most convenient way to create music, but nevertheless, it is a way — and that is [porkostomus]’s main mission here. Also, SoX is fun — and versatile, you can apply its audio effects even on images, or decode strange signals sent from a helicopter with it.

Find Your Level – Extracting NES Game Data Using Python

Just this summer, the Nintendo Entertainment System had its 35th release anniversary, and even after years of discontinuation, it is still going strong in the hacker community. Exhibit A: [Matthew Earl]. For one of his upcoming projects, [Matthew] needed to get his hands on the background images of the NES classic Super Mario Bros. Instead of just getting some ready-rendered images and stitching them together, he decided to take care of the rendering himself, once he extracts the raw game data.

Since there is no official source code available for Super Mario Bros, [Matthew] used a disassembled version to get started looking for the image data. To avoid reading through thousands of lines of assembly code, and to also see what actually happens during execution, he wrapped the game’s ROM data into py65emu, a Python library emulating the 6502, the CPU that drives the NES. By adding a simple wrapper around the emulator’s memory handler that tracks reads on uninitialized data, [Matthew] managed to find out which parameters he needs to feed to the parser routine in order to get the image tile data. After an excursion into the Picture Processing Unit (PPU) and its memory arrangements, [Matthew] had everything he needed to create the Python script that will render the game background straight from its ROM data.

Even if extracting NES game data is not your thing, the emulator concept [Matthew] uses might be still worth a read. On the other hand, if you want to dig deeper into the NES, you should definitely have a look at emulating an SNES game on a NES, presented on the NES itself.

Kindle Tells The Time By Quoting Literature

People love books, and if you’re anything like [tjaap]’s girlfriend, you may easily devour your eighty books and more a year. Maybe to keep better track of time during her reading sessions, her wish was to get a clock for the living room, so [tjaap] stepped up. Being a maker at heart, he decided to skip the ready-made options, and instead build one in the most fitting way imaginable: by displaying the time as literary quotes on a jailbroken Kindle.

Unlike your average word clock, [tjaap]’s literary clock displays (almost) every minute a different sentence that, in one form or another, contains the current time. Thanks to the internet, he didn’t have to compile the whole list of book quotes for each and every minute of the day by himself, but it still required some work to put it all in the form he needed. Eventually he had a script that converted each quote into an image, and a shell script on the Kindle to display them according to the time. As a bonus, the origin of the quote is displayed only optionally, turning the clock into a simple trivia quiz along the way.

It shows that themed, personalized clocks are always a great subject for a gift, just like the one made from analog meters we saw around Father’s Day.

Turn A Cheap Bluetooth Speaker Into An Audio Receiver

Cheap Bluetooth speakers come in all different kinds of shapes and colors, and they let you conveniently stream music, for example from your mobile phone. For [mcmchris], they had one significant shortcoming though: while most of them come with some auxiliary input port as alternative audio source, they usually lack an audio output port that would let him route the audio to his more enjoyable big-speaker sound setup. Lucky for him, it’s a problem that can be fixed with a wire cutter and soldering iron, and so he simply turned his cheap speaker into a Bluetooth audio receiver.

After opening the speaker, [mcmchris] discovered a regular F-6188 Bluetooth audio module built around the BK8000L chip, with the audio jack connected to the chip’s aux input pins. Taking a close look at the PCB, the solution seemed obvious: cut the connection to the chip’s aux input pins, and connect the audio jack parallel to the audio signal itself. After some trial and error, the output pins of the on-board op amplifier seemed to provide the best audio signal for his shiny new output jack. You can see more details about the speaker’s inner life and a demonstration in the video after the break — in Spanish.

If the concept looks familiar to you, we’ve indeed seen a very similar approach to equip a Google Home Mini with an audio output jack before. The alternative is of course to just build a decent sized Bluetooth speaker yourself.

Continue reading “Turn A Cheap Bluetooth Speaker Into An Audio Receiver”

It’s All In The Libs – Building A Plugin System Using Dynamic Loading

Shared libraries are our best friends to extend the functionality of C programs without reinventing the wheel. They offer a collection of exported functions, variables, and other symbols that we can use inside our own program as if the content of the shared library was a direct part of our code. The usual way to use such libraries is to simply link against them at compile time, and let the linker resolve all external symbols and make sure everything is in place when creating our executable file. Whenever we then run our executable, the loader, a part of the operating system, will try to resolve again all the symbols, and load every required library into memory, along with our executable itself.

But what if we didn’t want to add libraries at compile time, but instead load them ourselves as needed during runtime? Instead of a predefined dependency on a library, we could make its presence optional and adjust our program’s functionality accordingly. Well, we can do just that with the concept of dynamic loading. In this article, we will look into dynamic loading, how to use it, and what to do with it — including building our own plugin system. But first, we will have a closer look at shared libraries and create one ourselves.

Continue reading “It’s All In The Libs – Building A Plugin System Using Dynamic Loading”

TerraDome Gives Plants And Dinosaurs A New Home

Housing exotic plants or animals offer a great opportunity to get into the world of electronic automation. When temperature, light, and humidity ranges are crucial, sensors are your best friend. And if woodworking and other types of crafts are your thing on top, why not build it all from scratch. [MagicManu] did so with his Jurassic Park themed octagonal dome built from MDF and transparent polystyrene.

With the intention to house some exotic plants of his own, [MagicManu] equipped the dome with an Arduino powered control system that regulates the temperature and light, and displays the current sensor states on a LCD, including the humidity. For reasons of simplicity regarding wiring and isolation, the humidity itself is not automated for the time being. A fan salvaged from an old PC power supply provides proper ventilation, and in case the temperature inside the dome ever gets too high, a servo controlled set of doors that match the Jurassic Park theme, will automatically open up.

[MagicManu] documented the whole build process in a video, which you can watch after the break — in French only though. We’ve seen a similar DIY indoor gardening project earlier this year, and considering its simple yet practical application to learn about sensors, plus a growing interest in indoor gardening itself (pun fully intended), this certainly won’t be the last one.
Continue reading “TerraDome Gives Plants And Dinosaurs A New Home”

Watch The World Spin With The Earth Clock

With the June solstice right around the corner, it’s a perfect time to witness first hand the effects of Earth’s axial tilt on the day’s length above and beyond 60 degrees latitude. But if you can’t make it there, or otherwise prefer a more regular, less deprived sleep pattern, you can always resort to simulations to demonstrate the phenomenon. [SimonRob] for example built a clock with a real time rotating model of Earth to visualize its exposure to the sun over the year.

The daily rotating cycle, as well as Earth’s rotation within one year, are simulated with a hand painted plastic ball attached to a rotating axis and mounted on a rotating plate. The hand painting was done with a neat trick; placing printed slivers of an atlas inside the transparent orb to serve as guides. Movement for both axes are driven by a pair of stepper motors and a ring of LEDs in the same diameter as the Earth model is used to represent the Sun. You can of course wait a whole year to observe it all in real time, or then make use of a set of buttons that lets you fast forward and reverse time.

Earth’s rotation, and especially countering it, is a regular concept in astrophotography, so it’s a nice change of perspective to use it to look onto Earth itself from the outside. And who knows, if [SimonRob] ever feels like extending his clock with an aurora borealis simulation, he might find inspiration in this northern lights tracking light show.

This is a spectacular showpiece and a great project you can do with common tools already in your workshop. Once you’ve mastered earth, put on your machinists hat and give the solar system a try.