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:



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
      }
   }
}


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.

14 thoughts on “SOUL Wants To Process Your Audio

  1. To play with SOUL go to the web playground at soul.dev, an example “patch” (their term) of SOUL code that plays the old Nokia cell phone ringtone will be preloaded (at least it was for me when I visited). To play the patch press the big Compile button in the top-right of the page.

    If the example patch code doesn’t appear for you in the playground web page and you have a scripting/ad-blocker add-on running in your browser, tweak it to allow Amazon Web Services through. That’ll fix it.

  2. Just a suggestion: because the the audience (at least 90% have coded before at various levels of education and proficiency), you may want to use a less-commented example. I am usually big on comments, but these detract from a very straight-forward example.

    1. I’ve done a LOT of coding over my professional career and I take issue with your suggestion. Nothing is worse than having to clean up poorly or uncommented code because some guy figured that “90%” of whoever opened the source code should already be familiar with what it does or how it works.

      That you’d suggest minimizing comments in code depicted in an article, the whole point of which is to introduce a tool to people that aren’t familiar with it, is absurd.

      There is no such thing as “too many comments” in source code. There, I said it. Now you kids get off my lawn.

  3. For what I’ve briefly seen of SOUL, there’s nothing FAUST (https://faust.grame.fr/) can’t do. Unlike the former, the later is open source + free software and FAUST is developed by top experts in the field of DSP like J.O.Smith. I wouldn’t be surprised if SOUL borrowed a large part of FAUST source (there are A LOT of similarities).
    On the other side are devs that brought JUCE and they are no beginners in the DSP field too. Plus marketing and branding. I simply hope that if SOUL has some FAUST ancestry they will publicly contribute to it too.

    1. Bringing up Faust here is good. It is probably more than a coincidence that the SOUL Web-based UI looks and feels like a Faust clone. Another thing – I wonder if there is a connection between SOUL and Tracktion, makers of the proprietary and rather expensive Waveform Pro application. SOUL says Waveform is a plausible front end for SOUL.

  4. “The code aims to be secure and real time with no …, garbage collection…”

    That had better be no NEED FOR garbage collection. There have been a lot of programs and apps that NEED good garbage collection but don’t have it and leave junk all over the storage and/or hog progressively more RAM due to not unloading unused code or resources. Want to see bad garbage collection in action? Take a look in your Temp folder.

    Microsoft should have ages ago rigidly enforced that Temp is NOT to be used to store things and that software WILL clean up after itself. But instead we have software stashing repeatedly used stuff in Temp long term and using it to do things like completing installs after restarting – then not deleting them. Software treats Temp like not-so-bright people use the Trashcan or Recycle Bin to hold stuff – then get irritated when some person or automatic process deletes their files.

Leave a Reply to KenNCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.