Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
resources:tools-software:sharc-audio-module:baremetal:matlab_volume_control [19 Aug 2019 22:11] – [Generating C Code with Matlab Coder] Chad Wentworthresources:tools-software:sharc-audio-module:baremetal:matlab_volume_control [19 Aug 2019 22:26] (current) Chad Wentworth
Line 1: Line 1:
-=====Using a Matlab Volume Control Function in the Framework===== +=====Using a MATLAB Volume Control Function in the Framework===== 
-Matlab gives users the ability to create powerful audio algorithms. This tutorial gives an overview of how to create a simple volume control function and then add it to the baremetal framework.+MATLAB gives users the ability to create powerful audio algorithms. This tutorial gives an overview of how to create a simple volume control function and then add it to the baremetal framework.
  
 <WRAP round 60% important> <WRAP round 60% important>
-All Matlab work was using version R2018b+All MATLAB work was using version R2018b
 </WRAP> </WRAP>
  
-====Creating a Function in Matlab====+====Creating a Function in MATLAB====
 From the **Home** tab choose **New::Function** and then overwrite all template contents with the following: From the **Home** tab choose **New::Function** and then overwrite all template contents with the following:
 <code>function audio_out = volume_control( audio_in, vol_ctrl_factor ) <code>function audio_out = volume_control( audio_in, vol_ctrl_factor )
Line 18: Line 18:
 This function takes an input audio channel, multiplies it by vol_ctrl_factor and stores the result in the output audio channel. It simply changes the volume. Notice that we don't use a for loop because MATLAB has built in implicit expansion for scalar * vector multiplication. The file name should match the function name so name the file volume_control. This function takes an input audio channel, multiplies it by vol_ctrl_factor and stores the result in the output audio channel. It simply changes the volume. Notice that we don't use a for loop because MATLAB has built in implicit expansion for scalar * vector multiplication. The file name should match the function name so name the file volume_control.
  
-====Testing the Newly Created Function in Matlab====+====Testing the Newly Created Function in MATLAB====
  
-In order for Matlab Coder to know what the input variable types are and to verify the function is working properly, a test script needs to be created. From the **Home** tab choose **New::Script** and copy the following contents into the window:+In order for MATLAB Coder to know what the input variable types are and to verify the function is working properly, a test script needs to be created. From the **Home** tab choose **New::Script** and copy the following contents into the window:
 <code>AUDIO_BLOCK_SIZE = int32(32); <code>AUDIO_BLOCK_SIZE = int32(32);
  
Line 31: Line 31:
  
  
-====Generating C Code with Matlab Coder====+====Generating C Code with MATLAB Coder====
  
 <WRAP round 60% important> <WRAP round 60% important>
Line 54: Line 54:
   - Now the code can be generated   - Now the code can be generated
   - **Build type** should be set to **Source Code**   - **Build type** should be set to **Source Code**
-  - **Language** should be **C plus plus**+  - **Language** should be **C plus plus***
   - Change **Hardware Board** to **None - Select device below**   - Change **Hardware Board** to **None - Select device below**
   - **Device vendor** should be **Analog Devices**   - **Device vendor** should be **Analog Devices**
resources/tools-software/sharc-audio-module/baremetal/matlab_volume_control.txt · Last modified: 19 Aug 2019 22:26 by Chad Wentworth