Close

Modular audio engine running

A project log for ModPod

Virtual modular synthesizer on 30x30mm

matthiashMatthias_H 11/25/2014 at 16:100 Comments

... DAC is playing digital noise through the modular structure.

// Declare modules
noise_white m1; // Signal generator module (0 inputs, 1 output)
audio_out m2;   // Wrapper module for DAC (2 inputs, 0 outputs)
// Connect both DAC inputs 0, 1 (left+right) to output 0 of noise module:
m2.connect_input(0, &m1, 0); 
m2.connect_input(1, &m1, 0);

/* ... set up hardware ... */

while (1) {
  if (refresh) { // Interrupt from I2S interface requests refresh when output buffer is less than half full.
    m1.render(); // Produce another buffer full of audio
    m2.render();
    refresh = false;
  }
  // Interrupt-driven I2S service routine takes audio data from m2
}

... Module class structure sadly still a bit fragmented. There is a base class, module, from which all other modules are derived. In the long run, I would love to have a self-registration mechanism in place, so new modules can be integrated more easily. Anyone care to give this a try?

Discussions