Both sides previous revisionPrevious revisionNext revision | Previous revision |
resources:tools-software:sharc-audio-module:baremetal:tremelo-effect-tutorial [14 Nov 2018 22:23] – [Tutorial: Implementing a Tremolo Effect] Chad Wentworth | resources:tools-software:sharc-audio-module:baremetal:tremelo-effect-tutorial [26 Feb 2019 20:17] (current) – [Tutorial Overview] Chad Wentworth |
---|
{{youtube>oOCNB1izw8A?medium}} | {{youtube>oOCNB1izw8A?medium}} |
| |
In this tutorial, we're going to start by building a basic tremolo effect. We'll then add a few additional bells and whistles. Before you begin this tutorial, it's recommended to quickly go through [[resources:tools-software:sharc-audio-module:baremetal:volume-control-tutorial|Tutorial: Basic Volume Control]]. | In this tutorial, we're going to start by building a basic tremolo effect. We'll then add a few additional bells and whistles. |
| |
Just like last time, we'll be working in the ''callback_audio_processing.cpp'' file. We can implement this code either on SHARC core 1 or SHARC core 2. | Just like last time, we'll be working in the ''callback_audio_processing.cpp'' file. We can implement this code either on SHARC core 1 or SHARC core 2. |
==== Enabling / Disabling the Tremolo with SW1 on the Audio Project Fin ==== | ==== Enabling / Disabling the Tremolo with SW1 on the Audio Project Fin ==== |
| |
We may not want the tremolo enabled all the time so let's use one of the buttons on the Audio Project Fin to enable / disable the tremolo effect. Each of the buttons on the Audio Project Fin is mapped to a default callback that can be found in ''Callback_Pushbuttons.cpp'' in the ARM core (''sam_baremetal_framework_core0''). In these callbacks, the LED below each button is toggled by default and a field in the multicore memory structure is written to indicate that a button event has happened. The nice thing is that we don't need to change any of this default pushbutton callback behavior to use SW1 to enable / disable our effect. | We may not want the tremolo enabled all the time so let's use one of the buttons on the Audio Project Fin to enable / disable the tremolo effect. Each of the buttons on the Audio Project Fin is mapped to a default callback that can be found in ''Callback_Pushbuttons.cpp'' in the ARM core (''<PROJECT_NAME>_core0''). In these callbacks, the LED below each button is toggled by default and a field in the multicore memory structure is written to indicate that a button event has happened. The nice thing is that we don't need to change any of this default pushbutton callback behavior to use SW1 to enable / disable our effect. |
| |
In our audio callback, we'll add a new variable called ''tremolo_enabled'' which will be set to false initially. At the bottom of this callback, we'll check to see if SW1/PB_1 has been pressed and if so, we'll toggle the ''tremolo_enabled''. When it comes time to process the input buffers, we'll check to see if tremolo_enabled is true. If so, we'll apply the effect and if not, we'll just pass the audio through. | In our audio callback, we'll add a new variable called ''tremolo_enabled'' which will be set to false initially. At the bottom of this callback, we'll check to see if SW1/PB_1 has been pressed and if so, we'll toggle the ''tremolo_enabled''. When it comes time to process the input buffers, we'll check to see if tremolo_enabled is true. If so, we'll apply the effect and if not, we'll just pass the audio through. |
| |
---- | ---- |
{{navigation SHARC Audio Module#volume-control-tutorial|Implementing a Basic Volume Control#.|Bare Metal Framework#ring-modulator-effect-tutorial|Implementing a Ring Modulator Effect}} | {{navigation SHARC Audio Module#using-both-cores|Audio Processing Basics#.|Bare Metal Framework#ring-modulator-effect-tutorial|Implementing a Ring Modulator Effect}} |
| |