SOUL Wants to Process Your Audio

Abstraction is the core of nearly all progress in computing. Unless you are fabricating your own semiconductors and drawing wire, we all create with building blocks ranging from components like CPUs, to operating system functions, to specialized libraries. Just as you wouldn’t want to spend your time deblocking disk records or rendering fonts for output devices, you probably shouldn’t have to think too much about audio data. While there are some powerful audio processing libraries out there, a new embeddable language called SOUL (SOUnd Language) is now in version 1.0 and wants to help you create efficient code for processing audio.

The goal of SOUL is to target a runtime that can run on CPUs, but is better on DSPs. The code aims to be secure and real time with no pointers, garbage collection, and other things that typically interfere with audio processing or security.

The code isn’t hard to puzzle out. Here’s the example for cutting audio volume by half:

[CODE]

processor MinimalGainExample

{
// declare our inputs and outputs:
input stream float audioIn; // mono input stream called “audioIn”
output stream float audioOut; // mono output stream called “audioOut”

// every processor must declare a run() function
void run()
{
const float gain = 0.5f; // a constant to use as our gain factor

loop // (this just loops forever)
{
audioOut << audioIn * gain; // Read the next input sample, multiply by our // constant, and write it to our output advance(); // Moves all our streams forward by one frame } } } [/CODE] You can see that a processor is essential a thread and can have local and global storage. There are also graphs that assemble different processors with input and output. Usually, when we want to process audio, we turn to PortAudio just like [Matt] did for his oscilloscope port of Quake. We know of some projects that use Pure Data for audio processing, too.



from Blog – Hackaday https://ift.tt/2NPfgCw

Comments

Popular posts from this blog

Modern Radio Receiver Architecture: From Regenerative to Direct Conversion

Hackaday Links: May 31, 2020

Homebrew 68K Micro-ATX Computer Runs Its Own OS