Friday, 15 May 2015

c# - Splitting audio into left and right channel into seperate files -


I'm having trouble separating channel buffers into a new file.

Here is the code to remove each channel buffer:

  int sample dzed = 10000; Byte [] buffer = new byte [sample skipped * 4]; Small [] left = new small [sampled dish]; Small [] right = new small [samples] dropped; (Using the WaveFileReader PCM = New WaveFileReader (filePath)) {int bytesRead = pcm. Read (buffer, 0, 10000); Int index = 0; For (Int i = 0; I  

And here's how I try to create a file from the collected buffers:

 using  (var leftChannelFile = new WaveFileWriter ("test.wav", new waveform ()) {leftChannelFile.WriteSamples (left, 0, left.length); }  

The problem is, when I try to run "file.wav", then it is 0 seconds long and 19.5 billion bigger. Why is this happening on any idea?

You either set the title of the resulting file so that it indicates that it is a channel / Mono,

or

You add a second empty channel to your result files (all 0 bytes)


No comments:

Post a Comment