10/21/2018 at 18:27 •
So the Noise Nugget is in final of the 2018 Hackaday Prize! That is amazing and I am very honored that my project was chosen.
I have a few ideas for the future of Noise Nugget. One of them is having a GUI that let the users to build their sounds with basic modules such as oscillators, filters, effects, etc. Similar to the teensy audio tools but in real-time, without any code involved for the users. This could make an interesting and versatile tiny synthesizer.
Noise Nugget is also a way for me to try some hardware design for another project: Wee Noise Maker. Because Noise Nugget is smaller, it cost less to have it manufactured so this allowed me to try different things before using them on a bigger project. For instance, this is my first 4 layers PCB. So I will probably use some of the prize reward to do a new iteration on the Wee Noise Maker project.
10/18/2018 at 11:37 •
The software of the Noise Nugget is written in Ada. The Ada programming language is all about functional safety, that is, detect when the software is not doing what is supposed to do (bugs!). With Ada you know quickly and exactly what is going wrong instead of scratching you head for hours on a buffer overflow or uninitialized driver. This means less time spent debugging. And since I don't necessary have a lot time available to develop this software, every minutes counts.
The most important aspect of the software is to generate audio samples and send them to the DAC.
A sample is a 16bit signed integer that indicates the value of the audio signal at a given point in time.
The DAC is configured at 44_100 samples per seconds (CD quality). If the software fails to deliver the samples at the appropriate speed, the audio will glitch (loud pops and clicks). So this is a true real-time requirement of the system.
The samples are not sent one by one but in buffers of 512 samples * 2 bytes per samples * 2 channels (stereo), so 2048 bytes. Buffer B is filled while buffer A is transmitted, and vise versa (flip flop buffers). Samples coming from the audio input are received in a similar way. The transfer of the buffers is done via DMA so the CPU is not used during that operation, which means more time to generate the samples.
To ensure the real-time requirement, I use the Ada Ravenscar run-time. You can see it as a Real-Time Operating System (RTOS) integrated in the Ada programming language. I wrote a blog post about it if you want to see what it looks like: https://blog.adacore.com/theres-a-mini-rtos-in-my-language
There are two tasks in the system:
- The audio task, it has the highest priority because it is responsible for filling the audio buffers. This means that this task will be executed whenever there are audio buffers to fill.
- The other task is handling USB request in a polling loop. In the future this could be moved to and interrupt handler.
In terms of dependency, the drivers come from the Ada_Drivers_Library, a project I stared a couple years ago to encourage the use of Ada on micro-controllers. The audio synth is based on ada-synth-lib by Raphael Amiard.
10/17/2018 at 08:44 •
The main goals of the hardware design are simplicity and small footprint.
The heart of the system is obviously the STM32F446 micro-controller. It is based on an ARM Cortex-M4 core with floating point unit running at 180MHz, and a ton of peripherals.
Around the STM32F4 we have:
- A USB micro-B connector
- A power regulator to provide 3.3V from the 5V of the USB connector
- Crystal oscillator for the STM32F4 clock
- One user button and one button to enter Device-Firmware-Update (DFU) mode
- Flash memory to store sample data
- A row of header for custom IOs
- A debug header (which is badly wired in rev-B...)
- One headphone jack
- The audio Digital to Analog Converter (DAC)
I could have used the DACs of the STM32F4, but on one hand they are only 12bits vs 16bits for a proper audio DAC, and on the other hand it would have required extra circuitry to drive headphone. So using the SGTL5000 provides higher sound quality and simplicity. The SGTL5000 also have a lot of options for IOs:
- Headphone output
- Line output
- Line input
- Microphone input
This means a lot of options for different applications.
On the rev-B of Noise Nugget I didn't use the microphone input. I think this is a mistake because there is some room on the board for a MEMS mic, and that would open even more possibilities. For instance real-time voice effects or sample recording.
The design of the DFU button is inspired by the Numworks open calculator. If the button is pressed when you plug the USB cable, the STM32F4 automatically enters DFU mode. It is then very easy to install a different firmware without using any debug probe. With WebUSB, it is even possible to install from a
My TODO list for the next revision is:
- Fix the debug connector
- Try to add another jack for line input
- Add a MEMS microphone
10/07/2018 at 17:56 •
I implemented a sampler mode for the Noise Nugget. It plays a single audio clip at different speeds to give the illusion of different notes.
For the moment the audio clip is stored in the main flash memory, with the code. There's not a lot of space available so I am limited to one sample of a couple hundreds kilobytes. In the future I will implement the drivers for the external flash chip that has 8MBytes of memory, that is 1 minute 30 seconds of audio. It might seem small, but samples are only a couple seconds long at most , so 1m30s is plenty.
09/29/2018 at 20:02 •
I finally managed to make the Noise Nugget play notes from MIDI commands over USB!
I took me some time because there was no USB support in the driver library I'm using, so I had to write a USB stack from scratch :)
The synth code is based on ada-synth-lib from my friend Raphael. I used it to make a simple pulse wave sound with ADSR envelope.
09/09/2018 at 20:28 •
One of the example projects that I wanted to do with the Noise Nugget was to use it as an audio effect.
This is what I demonstrate in this video:
The music in produced by the PO-20 (left), then goes through the Noise Nugget (center) and finally comes out of the small speaker (right). The flanging effect is enabled and disabled by pressing on the button of the Noise Nugget. The LED is lit when the effect is enabled.
Flanger/Flanging is a simple effect achieved by mixing a incoming signal with its echo, and slowly changing the period of the echo.
09/03/2018 at 22:01 •
I did a first test on the board using the software of another project and it does work :)
Very short demo here: https://twitter.com/DesChips/status/1036333202028331008
Now, what's next with this little thing? There are multiple directions possible:
- Digital synthesizer, with a MIDI interface or some other means of control
- Audio effects, for a guitar pedal or synthesizer (delay, reverb, distortion)
- Audio FX trigger board, playing pre-recorded sounds
- Audio playback, recording sounds from the input and then playing it back at the push of a button
- USB sound interface
I think I will pick one or two ideas an implement them before the end of the month.
09/01/2018 at 21:50 •
I received my assembled 1 square inch board from MacroFab yesterday:
It is the second time I use this service and I'm happy once again. It is quite expensive, but when you take into account the shipping for low quantity of parts (20 euros for Mouser), the cost of the 4 layers PCB and the difficulty of soldering a QFN20 part, I think it is worth the price.
08/13/2018 at 21:58 •
This project started from the failure of the last iteration of my Wee Noise Maker board. Since the Wee Noise Maker board is relatively big an complicated, I decided to pack the main components in a simpler design to speed up the prototyping time and lower the cost. Turns out that this smaller board is quite interesting in itself.
The first iteration of Noise Nugget was designed around a 2xAAA battery holder :
When I saw the announcement of The Return of the Square Inch Project competition I decided to make a new version that would fit the requirements (1x1 inch board).