src/main/java/org/jcodec/codecs/wav/WavHeader.java
public static WavHeader multiChannelWav(WavHeader[] headers) {
        WavHeader w = emptyWavHeader();
        int totalSize = 0;
        for (int i = 0; i < headers.length; i++) {
            WavHeader wavHeader = headers[i];
            totalSize += wavHeader.dataSize;
        }
        w.dataSize = totalSize;
        FmtChunk fmt = headers[0].fmt;
        int bitsPerSample = fmt.bitsPerSample;
        int bytesPerSample = bitsPerSample / 8;
        int sampleRate = (int) fmt.sampleRate;
        w.fmt.bitsPerSample = (short) bitsPerSample;
        w.fmt.blockAlign = (short) (headers.length * bytesPerSample);
        w.fmt.byteRate = headers.length * bytesPerSample * sampleRate;
        w.fmt.numChannels = (short) headers.length;
        w.fmt.sampleRate = sampleRate;
        return w;
    }
public static WavHeader multiChannelWav(WavHeader[] headers) {
        WavHeader w = emptyWavHeader();
        int totalSize = 0;
        for (int i = 0; i < headers.length; i++) {
            WavHeader wavHeader = headers[i];
            totalSize += wavHeader.dataSize;
        }
        w.dataSize = totalSize;
        FmtChunk fmt = headers[0].fmt;
        int bitsPerSample = fmt.bitsPerSample;
        int bytesPerSample = bitsPerSample / 8;
        int sampleRate = (int) fmt.sampleRate;
        w.fmt.bitsPerSample = (short) bitsPerSample;
        w.fmt.blockAlign = (short) (headers.length * bytesPerSample);
        w.fmt.byteRate = headers.length * bytesPerSample * sampleRate;
        w.fmt.numChannels = (short) headers.length;
        w.fmt.sampleRate = sampleRate;
        return w;
    }
public static WavHeader multiChannelWav ( WavHeader [ ] headers ) { WavHeader w = emptyWavHeader ( ) ; int totalSize = 0 ; for ( int i = 0 ; i < headers . length ; i ++ ) { WavHeader wavHeader = headers [ i ] ; totalSize += wavHeader . dataSize ; } w . dataSize = totalSize ; FmtChunk fmt = headers [ 0 ] . fmt ; int bitsPerSample = fmt . bitsPerSample ; int bytesPerSample = bitsPerSample / 8 ; int sampleRate = ( int ) fmt . sampleRate ; w . fmt . bitsPerSample = ( short ) bitsPerSample ; w . fmt . blockAlign = ( short ) ( headers . length * bytesPerSample ) ; w . fmt . byteRate = headers . length * bytesPerSample * sampleRate ; w . fmt . numChannels = ( short ) headers . length ; w . fmt . sampleRate = sampleRate ; return w ; }
Takes single channel wavs as input produces multi channel wav
Takes single channel wavs as input produces multi channel wav