This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
resources:tools-software:sharc-audio-module:baremetal:chaining-audio-elements [13 Dec 2018 17:28] – Dan Ledger | resources:tools-software:sharc-audio-module:baremetal:chaining-audio-elements [06 Feb 2019 17:53] (current) – Chad Wentworth | ||
---|---|---|---|
Line 3: | Line 3: | ||
The power of the audio elements is how they can be combined in novel ways to create audio effects. | The power of the audio elements is how they can be combined in novel ways to create audio effects. | ||
- | To do this, we'll first need to declare instances of the biquad and integer_delay_lpf audio elements. | + | To do this, we'll first need to declare instances of the biquad and integer_delay_lpf audio elements |
<code c> | <code c> | ||
- | // Declarations for struct/ | + | // Declarations for struct/ |
- | BIQUAD_FILTER filt_300Hz, | + | BIQUAD_FILTER filt_300Hz, |
- | float pm filt_300Hz_coeffs[4]; | + | |
float pm filt_300Hz_coeffs[4]; | float pm filt_300Hz_coeffs[4]; | ||
+ | float pm filt_900Hz_coeffs[4]; | ||
- | DELAY_LPF | + | // Declaration of delay element structs and buffers for delay lines |
- | + | DELAY_LPF | |
- | // Declaration of memory | + | |
float section(" | float section(" | ||
float section(" | float section(" | ||
- | float section(" | ||
</ | </ | ||
Line 29: | Line 27: | ||
// ******************************************************************************* | // ******************************************************************************* | ||
+ | // Set up filters | ||
+ | filter_setup(& | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | filter_setup(& | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | // Set up delay lines | ||
+ | delay_setup(& | ||
+ | delay_buffer_1, | ||
+ | AUDIO_SAMPLE_RATE*2, | ||
+ | AUDIO_SAMPLE_RATE*0.25, | ||
+ | 0.8, // Feedthrough | ||
+ | 0.6, // Feedback | ||
+ | 0.0); // Dampening coefficient (0=no dampening) | ||
+ | |||
+ | delay_setup(& | ||
+ | delay_buffer_2, | ||
+ | AUDIO_SAMPLE_RATE*2, | ||
+ | AUDIO_SAMPLE_RATE*0.5, | ||
+ | 0.8, // Feedthrough | ||
+ | 0.6, // Feedback | ||
+ | 0.0); // Dampening coefficient (0=no dampening) | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Finally, we'll process audio in '' | ||
+ | |||
+ | <code c> | ||
+ | void processaudio_callback(void) { | ||
+ | |||
+ | float audio_temp_1[AUDIO_BLOCK_SIZE]; | ||
+ | float audio_temp_2[AUDIO_BLOCK_SIZE]; | ||
+ | | ||
+ | // Run filters on incoming L/R input audio | ||
+ | filter_read(& | ||
+ | filter_read(& | ||
+ | // Run filtered audio through delay lines and send to L/R/ output audio | ||
+ | delay_read(& | ||
+ | delay_read(& | ||
} | } | ||
</ | </ | ||
+ | ---- | ||
+ | {{navigation SHARC Audio Module# |