c# - Float array of samples to WAV file format -


i working on application applies filters on sound files, filters applied in frequency domain samples .wav file using naudio library code :

audio = new audiofilereader(wav_file); samples = new float[wave.length]; audio.read(samples, 0, samples.length); 

after applying previous code, have samples array of float, apply short-time fourier transform on samples getting frequency domain data, , filters applied on frequency domain data.
, inverse short-time fourier transform applied on frequency domain data convert time domain should similar initial samples filters applied.
steps again:

  1. get samples (time domain data) array wav file.
  2. apply short-time fourier transform on samples frequency domain data.
  3. apply filters on frequency domain data.
  4. apply inverse short-time fourier transform on frequency domain data samples (time domain data).
  5. convert samples wav form again save , play it.

now problem in last step, have float array of samples (time domain data), how convert .wav file , play it?

to save samples .wav file, following code used:

waveformat waveformat = new waveformat(samplerate, bitdepth, channels); using (wavefilewriter writer = new wavefilewriter("c:\\track1.wav", waveformat)) {     writer.writesamples(floatoutput, 0, floatoutput.length); } 

the samplerate, bitdepth, , channels extracted input file this:

samplerate = wave.waveformat.samplerate; bitdepth = wave.waveformat.bitspersample; channels = wave.waveformat.channels; 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -