For a practical example, we are going to process our voice own voice signal. That’s right! This is where we’ll incorporate Arduino.
For this project, I chose a module with MAX9812L amplifier and an electret microphone. The module has the following 3 terminals:
We are not going to use Arduino IDE serial monitor. Instead, we are going to read sensor values directly in Matlab.
Arduino Code:
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
float voltage = sensorValue * (3.3 / 1023.0);
Serial.println(voltage);
}
We are also going to use Matlab for processing. To process our voice signal, we are going to create a graphical user interface. This graphical user interface contains 2 buttons:
Creating the GUI in this program is very easy because you can use drag function to draw connections. To start, type guide in the command window.
When you click on the “Create New GUI”, a user-friendly interface will show. Matlab GUI doesn’t require advanced programming skills like C# or other languages. Here you have to choose the blocks you want to add and modify the generated code.
On the left menu you have different commands for your GUI. For this project, you don’t need more than 3 elements because we only want to display the voice signal. Since we also want to have the data available after recording, we will create a .csv file with the recordings which can be used for signal processing.
In my GUI, I used:
The code for this button is structured according to the button specifications. The entire code will be uploaded to GitHub for you to download.
fid = fopen(‘signal.csv’,’w’)
S=1;
s = serial(‘COM9’);
set(s,’BaudRate’,9600);
fopen(s);
fprintf(s,’%s’,’S’);
If you have made this far, congratulations! This concludes our series of Digital Signal Processing. We have introduced various concepts in regards to signal processing. It is a very challenging topic, and we shouldn’t get discouraged if we don’t understand everything at once! There are tons of resources online providing further details on certain concepts that you find difficult in particular. Feel free to explore and comment and share your input!
Appendix