0

I have been using Naudio package to convert MP4 audio to WAV, so far things are working out but I have to save the WAV file after converting it

    // create media foundation reader to read the AAC encoded file from URL
    using (MediaFoundationReader reader = new MediaFoundationReader(audioUrl))
    // resample the file to PCM with same sample rate, channels and bits per sample
    using (ResamplerDmoStream resampledReader = new ResamplerDmoStream(reader,
        new WaveFormat(reader.WaveFormat.SampleRate, reader.WaveFormat.BitsPerSample, 2)))

    // create WAVe file
    using (WaveFileWriter waveWriter = new WaveFileWriter(fileFullPath, 
    resampledReader.WaveFormat))
    // save wav file physically on os
    resampledReader.CopyTo(waveWriter);

I tried to read waveWriter stream but apparently I can't do that as its write only stream so my question is is there any way I can read waveWriter directly instead of saving it to a file then read that file again

Dylan Beattie
  • 53,688
  • 35
  • 128
  • 197
Mahmoud Hefny
  • 281
  • 3
  • 13
  • 2
    Does this answer your question? [How to write NAudio WaveStream to a Memory Stream?](https://stackoverflow.com/questions/11500222/how-to-write-naudio-wavestream-to-a-memory-stream) – Métoule Oct 20 '21 at 12:06
  • yup, that seems to be what I am looking for thanks for linking it – Mahmoud Hefny Oct 20 '21 at 14:40

0 Answers0