Software design

A project log for Noise Nugget

Square Inch music widget

Fabien-ChouteauFabien-Chouteau 10/18/2018 at 11:371 Comment

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:

There are two tasks in the system:

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.


williamw2626 wrote 04/15/2020 at 10:45 point

I am learning Ada programming language and was searching online regarding its uses when I found this post. I was looking online for some writing services to help me with my programming assignment and my friend suggested checking I would like to use their services for my homework.

  Are you sure? yes | no