I am working on an application that applies filters on sound files, the filters are applied in frequency domain so I get the samples from the .wav file using NAudio library with this code :
audio = new AudioFileReader(wav_file);
samples = new float[wave.Length];
audio.Read(samples, 0, samples.Length);
after applying the previous code, now I have the samples as an array of float, then I apply the short-time Fourier transform on the samples getting the frequency domain data, and then the filters are applied on the frequency domain data.
and then the inverse short-time Fourier transform is applied on the frequency domain data to convert it back to time domain which should be similar to the initial samples but with the filters applied.
the steps again:
- Get samples (time domain data) array from the wav file.
- Apply short-time Fourier transform on the samples to get frequency domain data.
- Apply filters on frequency domain data.
- Apply inverse short-time Fourier transform on the frequency domain data to get samples (time domain data).
- Convert samples into wav form back again to save and play it.
now the problem is in the last step, I have the float array of samples (time domain data), how do I convert it into a .wav file and play it?