Signal Analyser
- 5 Devlogs
- 16 Total hours
A program that is able to analyze a signal and figure out its component waves using a Fourier Transform that I designed in demos
A program that is able to analyze a signal and figure out its component waves using a Fourier Transform that I designed in demos
Worked on cleaning some stuff up, making the terminal version usable, not really much to talk about which weird for apparently 6 hours of work. I was writing most of it my self rather than using an api and so I guess it took me longer because I had to figure out how to make what I wanted to make. But it does make me kind of want to make another project exclusively on CLI and a bunch CLI tools. So I don’t spend 6 hours working on it, again…
Next up will probably be me figuring out how to improve the math and speed, or adding more functionality, which both will probably take time to do. YAY!!!!!!1!1
This dev log tool much longer that I expected and was much harder too. There were plenty of bugs that I came across and paired with my lack of experience in C++ did not make it easy. However my main goals have been achieved with this project, being to gain a foundational understanding of C++, and to actually get it to work. I happy to say both have been achieved.
Currently the program is able to take a signal from an file and process the data withing to find the wave components making up the wave. Currently there seems to be some precision and accuracy issues but it is good enough to see the functioning system in its current state.
This project is not ready to be shipped yet however as there are a few things I want to get working first. Such as other input files like CSV and other sound types. I also want to finish the file selection system and arguments so it can be better interacted with by other programs. Also now is a good point to start optimizing too.
I have also attached an image from audacity and desmos with the input wave, and then the wave we calculated from the data. The console output has also been attached.
Calculated wave:
14163.5sin(19.1x+0.193611) + 14330.7sin(43.9x+-0.038439)
The signal analyser is now able to produce this graph!
Quick explanation:
The program was give an mp3 file containing a wave of 5 Hz, after running the transform and pasting its output into desmos, it shows us that the wave should have a a sin wave with the x-axis dealation factor of ~31. If we plug this into n/2pi, we get ~4.9338, meaning that we basically got our original wave back!
Obviously there is more that I can do with this graph such as finding phase shift and amplitude. But this was the first main step towards the main purpose of this project, which was to be be able to break down any sound/signal into its component sin waves.
If you are looking for more about how I did this,
here is the math formula I made with inspiration/understanding of how the Fourier transform works: https://www.desmos.com/calculator/il9blockap
and here is a visualization I also made that may also help
https://www.desmos.com/calculator/adde2b4abd
(Yes I know neither of these are FFTs, idk why I called them that)
Anyways the next step will be to write an algorithm to find these peaks!
Just finished writing some of the backend for the math required for my signal analyser. More specifically complex numbers with bulk addition and multiplication for more efficient computation. Now the boiler plate code should be complete and ready to start writing the fourier transform part to start testing frequencies.
Hopefully the next dev log will! I am still learning C++ and I feel like I have started to gain a better understanding of the language now and am starting to be more adventurous in my code using more of the features I have access to and a better understanding of what I am writing.
Not really a screenshot to upload here as it is mostly just math that doesn’t really produce anything visual yet. But I have attached a winding of the data that can be produced using the new math.
Worked on extracting the data from the audio file to be able to perform calculations on them. The first image is the generated wave from audacity (1 Hz for 2 seconds) and the graph in desmos is the same data being read from the file and being plotted (with some decreased resolution because it would be too many points otherwise)