Turning Sounds From A Flute Into Sheet Music

Composing music can be quite difficult – after all, you have to keep in mind all of the elements of musical theory, from time signature and key signature to the correct length for all of the notes. A team of students from Cornell University’s Designing with Microcontrollers class developed a solution for this problem by transcribing sounds from a flute into sheet music.

The project doesn’t simply detect the notes played – it is able to convert the raw audio into a standardized music score complete with accurate note timings and beats per minute. Before transcribing the music, some audio processing was necessary. The team chose to use a Sallen-Key filter to amplify the raw audio input due to its complex conjugate poles. They then used a fast Fourier Transform (FFT) to determine the frequency for the input note, converting the signal from the time domain to the frequency domain.

The algorithm samples the data to generate an input signal, using the ADC on the microcontroller to receive input from the microphone. It takes the real and imaginary components of the sampled signals and outputs a pair of real and imaginary amplitude components corresponding to the sampled frequency, evenly spaced from 0 to the Nyquist rate (half the sampling rate). The spacing of these bins and the bin with the largest amplitude are used to convert the signal back to a real frequency and a MIDI note.

The system uses a PIC32 for the logic. The circuitry for the microphone amplification uses a non-inverting op-amp with a gain of 50 to increase the microphone output signal amplitude from 15 mV to 750 mV to use by the microcontroller’s ADC. The signal is then sent to the anti-aliasing Sallen-Key filter, with a pole at 2.5 kHz and a Q of 1. The frequency was chosen since the FFT samples at 8 kHz and the frequency corresponds to a note out of the range of a flute. As for the filters, only the low pass filter was implemented in hardware.  While a bandpass filter could have been implemented in hardware, the team decided on a cleaner software approach.

The project is well-documented on the team’s project page, and it’s certainly worth checking out for more detailed discussions on the keypad controls and the software side of the audio processing. If you want to learn more about the FFT, check out this 2016 Hackaday Prize entry for an FFT spectrum analyezer.

Continue reading “Turning Sounds From A Flute Into Sheet Music”

Sara Adkins Is Jamming Out With Machines

Asking machines to make music by themselves is kind of a strange notion. They’re machines, after all. They don’t feel happy or hurt, and as far as we know, they don’t long for the affections of other machines. Humans like to think of music as being a strictly human thing, a passionate undertaking so nuanced and emotion-based that a machine could never begin to understand the feeling that goes into the process of making music, or even the simple enjoyment of it.

The idea of humans and machines having a jam session together is even stranger. But oddly enough, the principles of the jam session may be exactly what machines need to begin to understand musical expression. As Sara Adkins explains in her enlightening 2019 Hackaday Superconference talk, Creating with the Machine, humans and machines have a lot to learn from each other.

To a human musician, a machine’s speed and accuracy are enviable. So is its ability to make instant transitions between notes and chords. Humans are slow to learn these transitions and have to practice going back and forth repeatedly to build muscle memory. If the machine were capable, it would likely envy the human in terms of passionate performance and musical expression.

Continue reading “Sara Adkins Is Jamming Out With Machines”

Numpy Comes To Micro Python

[Zoltán] sends in his very interesting implementation of a NumPy-like library for micropython called ulab.

He had a project in MicroPython that needed a very fast FFT on a micro controller, and was looking at all of the options when it occurred to him that a more structured approach like the one we all know and love in CPython would be possible on a micro controller too. He thus ended up with a python library that could do the FFT 50 times faster than the the pure Python implementation while providing all the readability and ease of use benefits that NumPy and Python together provide.

As cool as this is, what’s even cooler is that [Zoltan] wrote excellent documentation on the use of the library. Not only can this documentation be used for his library, but it provides many excellent examples of how to use MicroPython itself.

We really recommend that fans of Python and NumPy give this one a look over!

Probe The Galaxy On A Shoestring With This DIY Hydrogen-Line Telescope

Foil-lined foam insulation board, scraps of lumber, and a paint-thinner can hardly sound like the tools of a radio astronomer. But when coupled with an SDR, a couple of amplifiers, and a fair amount of trial-and-error tweaking, it’s possible to build your own hydrogen-line radio telescope and use it to image the galaxy.

As the wonderfully named [ArtichokeHeartAttack] explains in the remarkably thorough project documentation, the characteristic 1420.4-MHz signal emitted when the spins of a hydrogen atom’s proton and electron flip relative to each other is a vital tool for exploring the universe. It lets you see not only where the hydrogen is, but which way it’s moving if you analyze the Doppler shift of the signal.

But to do any of this, you need a receiver, and that starts with a horn antenna to collect the weak signal. In collaboration with a former student, high school teacher [ArtichokeHeartAttack] built a pyramidal horn antenna of insulation board and foil tape. This collects RF signals and directs them to the waveguide, built from a rectangular paint thinner can with a quarter-wavelength stub antenna protruding into it. The signal from the antenna is then piped into an inexpensive low-noise amplifier (LNA) specifically designed for the hydrogen line, some preamps, a bandpass filter, and finally into an AirSpy SDR. GNURadio was used to build the spectrometer needed to determine the galactic rotation curve, or the speed of rotation of the Milky Way galaxy relative to distance from its center.

We’ve seen other budget H-line SDR receiver builds before, but this one sets itself apart by the quality of the documentation alone, not to mention the infectious spirit that it captures. Here’s hoping that it finds its way into a STEM lesson plan and shows some students what’s possible on a limited budget.

Bike-Mounted Synthetic-Aperture Radar Makes Detailed Images

Synthetic-aperture radar, in which a moving radar is used to simulate a very large antenna and obtain high-resolution images, is typically not the stuff of hobbyists. Nobody told that to [Henrik Forstén], though, and so we’ve got this bicycle-mounted synthetic-aperture radar project to marvel over as a result.

Neither the electronics nor the math involved in making SAR work is trivial, so [Henrik]’s comprehensive write-up is invaluable to understanding what’s going on. First step: build a 6-GHz frequency modulated-continuous wave (FMCW) radar, a project that [Henrik] undertook some time back that really knocked our socks off. His FMCW set is good enough to resolve human-scale objects at about 100 meters.

Moving the radar and capturing data along a path are the next steps and are pretty simple, but figuring out what to do with the data is anything but. [Henrik] goes into great detail about the SAR algorithm he used, called Omega-K, a routine that makes use of the Fast Fourier Transform which he implemented for a GPU using Tensor Flow. We usually see that for neural net applications, but the code turned out remarkably detailed 2D scans of a parking lot he rode through with the bike-mounted radar. [Henrik] added an auto-focus routine as well, and you can clearly see each parked car, light pole, and distant building within range of the radar.

We find it pretty amazing what [Henrik] was able to accomplish with relatively low-budget equipment. Synthetic-aperture radar has a lot of applications, and we’d love to see this refined and developed further.

[via r/electronics]

Fourier Explained: [3Blue1Brown] Style!

If you ask most people to explain the Fourier series they will tell you how you can decompose any particular wave into a sum of sine waves. We’ve used that explanation before ourselves, and it is not incorrect. In fact, it is how Fourier first worked out his famous series. However, it is only part of the story and master video maker [3Blue1Brown] explains the story in his usual entertaining and informative way. You can see the video below.

Paradoxically, [3Blue1Brown] asserts that it is easier to understand the series by thinking of functions with complex number outputs producing rotating vectors in a two-dimensional space. If you watch the video, you’ll see it is an easier way to work it out and it also lets you draw very cool pictures.

Continue reading “Fourier Explained: [3Blue1Brown] Style!”

A DIY EMC Probe From Semi-Rigid Coax And An SDR

Do you have an EMC probe in your toolkit? Probably not, unless you’re in the business of electromagnetic compatibility testing or getting a product ready for the regulatory compliance process. Usually such probes are used in anechoic chambers and connected to sophisticated gear like spectrum analyzers – expensive stuff. But there are ways to probe the electromagnetic mysteries of your projects on the cheap, as this DIY EMC testing setup proves.

As with many projects, [dimtass]’ build was inspired by a video over on EEVblog, where [Dave] made a simple EMC probe from a length of semi-rigid coax cable. At $10, it’s a cheap solution, but lacking a spectrum analyzer like the one that [Dave] plugged his cheap probe into, [dimtass] went a different way. With the homemade probe plugged into an RTL-SDR dongle and SDR# running on a PC, [dimtass] was able to get a decent approximation of a spectrum analyzer, at least when tested against a 10-MHz oven-controlled crystal oscillator. It’s not the same thing as a dedicated spectrum analyzer – limited bandwidth, higher noise, and not calibrated – but it works well enough, and as [dimtass] points out, infinitely hackable through the SDR# API. The probe even works decently when plugged right into a DSO with the FFT function running.

Again, neither of these setups is a substitute for proper EMC testing, but it’ll probably do for the home gamer. If you want to check out the lengths the pros go through to make sure their products don’t spew signals, check out [Jenny]’s overview of the EMC testing process.

[via RTL-SDR.com]