A Rust Command Line Tool
This program can read, modify, and create audio files
This program can read, modify, and create audio files
synth, the rust written commandline tool has the ability to recreate audio files using multple sine waves. It creates oscillators with proper amplitude and frequency.
The following example demonstrates how synth modifies a given input file:./synth decompose saw.wav write saw2.wav
input:
output:
There are a few things wrong with the recreation. First is the interference between the oscillators. Because I am reconstructing this sample using a Fourier transform, the frequency domain will contain a section around the actual frequencies that is raised from the rest of the values. This generates multiple oscillators with similar frequencies, creating "beats"(interference between waves). The other problem with this recreation is the lack of higher frequencies present in the output. This problem exists because I am calculating the oscillators that should go into the final result with standard deviation, but saw waves' overtones decrease with higher frequency. When I come back to this project, I will calculate local maximums instead of standard deviation.
This command-line tool can output the amplitudes across the frequency spectrum of an input audio sample to stdout. When coupled with a simple python plotter one can quickly visualize the results
The following is the output of running these commands./synth decompose saw.wav | python3 plotter.py
output:
The command-line tool can also create audio files with given frequencies:
The following is the output of running the command./synth out.wav 440 660 533
You can also add frequency modulation: ./synth out.wav 440 660 533 fm: 5
And another example:
./synth out.wav 440 660 533 fm: 220