Sound Password
This is a mini project with real-time trained “machine learning model” where users will use sound to train the model. Users need to record a sound clip as password in order to save some secret information. They can unlock the information by reproducing the same sound.
Implementation
In this assignment, I utilized the FFT algorithm provided by p5 library. After processed by FFT algorithm, the sound characteristics at a frame is represented by a number array of length 1024 with each entrance a value ranging from 0 to 255. To store the sound data in a certain period of time, I used a 2D array.
The KNN methodology used here is comparing the difference between two number array. Iterate through two arrays and compute the absolute difference between two numbers with the same index. Finally, divide the sum by 1024 and the derived value is the difference of two sound waves at the same time point.
Then we can expand this technique. Compute the accumulation of such difference and return the average value in each time point. The final value we get is a value ranging from 0 to 255. However, after several test, I found this value quite low and decided to use 10 as threshold.
Difficulties
After finishing the assignment, I was still unable to synchronize the two sound clips well. A user may successfully reproduce the same sound clip as the recorded password. However, they may not start at the exactly same point. Therefore, such offset causes obvious inaccuracy in the final difference.
I think the algorithm I used in this project is quite weak. To make the algorithm robust, I believe some mathematical techniques need to be involved.