Exporting multichannel .WAV files

I have a bunch (like, hundreds) of multichannel .WAV files, each of which I’d like to export as a stereo FLAC file. To keep things tidy I load the WAVs with ‘one track per file’, and if I export them one at a time it works fine, but if I attempt a stem export, it fails. Maybe it’s not possible to do a stem export of several multichannel .WAVs? I’m a complete noob at this and am probably doing something wrong, so any pointers would be appreciated.

Sorry, I’m on Ardour 5.12

Can you explain more how you are mapping from multichannel to stereo? By multichannel I assume to mean 3 or more channels; how many exactly? Do you want to export only two of the channels to a stereo FLAC file, or do you want to export all of the channels, but two at a time? Or do you mix the multiple channels down to two, and want to export the mixed two channel result?

If you all you are trying to do is get downmixed stereo versions of your original 5.1 files, then Ardour is not the right tool for the job. I think sox or FFmpeg could to this and you can also automate downmixing by writing a small wrapper script to feed the input files one by one to sox or FFmpeg.

By the way are you on Linux, MacOs or windows ?

Thanks for your replies.

I’m on Linux.

Or do you mix the multiple channels down to two, and want to export the mixed two channel result?
Yes, basically this. Each WAV file has 15 channels which are mic recordings from a drumkit. I basically want to export each WAV file as a stereo FLAC file to use them in Hydrogen; the original files are from Drumgizmo. The idea is to create a lightweight drumkit in Hydrogen as the Drumgizmo libraries are massive and I don't need such control over so many channels. The way I'm doing it is by exporting the stereo master output of the multichannel WAVs. I load a few of them, each file on a single track, solo the track I want to export, and export it. This is ok for a few files but is very tedious if there are hundreds... I thought 'stem export' could do it but apparently not.

Writing scripts is beyond my skills :frowning:

You want stereo from single channel microphone recordings? That’s … odd.

You have a point there Paul… I thought that the mics might be panned but I’ll have to look into it.

15 channels sounds like a complicated mixdown. You have to know how to pan them and also how much to reduce gain otherwise the downmix will go over 0 dBFS and distort. I don’t know if it is possible to import these into Ardour so that each channel would be on its own track. You need this to pan them individually.

Another option is to extract each channel to a separate file with sox like this:

sox InputFile channel-1.wav remix 1
sox InputFile channel-2.wav remix 2
sox InputFile channel-3.wav remix 3
sox InputFile channel-4.wav remix 4
sox InputFile channel-5.wav remix 5

You can also make the downmix to stereo like this (input file has 6 channels in this example):
sox InputFile channels.wav remix 1-3 4-6

Here the input channels 1-3 are downmixed to the left channel and input channels 4 - 6 are downmixed to the right channel of output file channels.wav. Sox adjusts the volume down automatically when downmixing.

Another example:
sox InputFile channels.wav remix 1,3,5 2,4,6
This downmixes input channels 1,3,5 to the left and input channels 2,4,6 to the right channel of output file channels.wav

You separate channels that are going to be mixed together with a comma and output channel options with a space. You can add an output channel by adding a space and another range of input channels.

You can adjust volume of the input channels by adding a p after the channel or channel range and the decibel value. Example: adjust volume of each channel down -30 dBs.

sox InputFile channels.wav remix 1-3p-30 4-6p-30
sox InputFile channels.wav remix 1p-30,2p-30,3p-30 4p-30,5p-30,6p-30

Thanks mhartzel for such a detailed reply. Ardour can indeed import each wav file and give each channel its track, though I’ve been importing them into combined single tracks. I’ve already exported a good few and haven’t noticed any problems with distortion.
The thing is, if I had to pan each channel for every single wav file I’d go insane. The snare alone has almost 100 wav files… and so on. Maybe a template or something could be used but the quality of the files I’ve exported so far will do for my purposes; I don’t need professional-level quality as this is for my own personal use.

My original question was more about whether it was possible -leaving aside any matters related to panning/mono/stereo/distortion- to do a stem export of these multichannel wav files like you can do with regular audio tracks.

Well, a stem export is simply: 1 file per (selected) track, covering the range(s) to be exported. Each file will have as many channels as the track has outputs.

But the only way that would be close to what you want is if you import them into ardour as “1 channel per track”, which really means you’re just splitting the audio file into independent channels.

If you’re NOT going to deal with panning/stereo, then using Ardour for this is overkill, as mhartzel suggests. a tool like sox is much more appropriate for the purpose.

If you ARE going to deal with panning/stereo, then it’s going to be a lot of work. Sox may still be more appropriate than Ardour for this purpose.

Thanks for the suggestions, I’ll look into it, though it’s possible I’m trying to bite off more than I can chew…

I basically want to export each WAV file as a stereo FLAC file to use them in Hydrogen

Why do that when hydrogen is designed to work with mono files? Hydrogen’s mixer has a pan control on each channel if you need to pan them.

Fair enough, stereo files probably aren’t even necessary, but that doesn’t really have any relation to what I wanted to attempt with Ardour. I’ve since reassessed my approach as it it is too much hassle to pan the channels on each file and export them one by one. I’m better off just using files that are just mono or stereo to begin with.

You may get better direction by finding a Hydrogen forum or mailing list and asking Hydrogen users if they know of a way to import drumgizmo kits directly. Often instrument setup on a sampler can be fairly intensive work, especially if you want to customize for example envelope control mapping to velocity curves, properly label the instrument names, verify the instrument sample to note mapping, etc. I would expect that making “hundreds” of instrument mappings would take months to do properly, although you could probably find a way to script the conversion IF you know that all the channels map consistently from the starting files (e.g. always the same number of drums, and the drum style to channel mapping is consistent) and you are happy with just raw sample triggering, and don’t want any of the advanced features like having the Hydrogen sample player apply ADRS envelopes to the samples, or layer different samples based on velocity, etc.

Thanks for the suggestions. I’m fairly familiar with Hydrogen having used it in the past and contributing when I can to its translation. You can’t directly import Drumgizmo kits as Hydrogen doesn’t support all those different mic channels - each velocity layer can take a mono or stereo file; but it is possible to control Drumgizmo via Hydrogen. However, Drumgizmo is quite heavy on RAM and I wanted to create a lighter kit to be triggered in Hydrogen using an electronic drumkit. I figured that the Drumgizmo samples could be a good source for a heavily multilayered kit with round robins at each velocity layer. I did start exporting files from Drumgizmo and actually created a few multi-velocity kit pieces with round robins (after compiling Hydrogen to support 64 samples per instrument instead of just 16), but found that some kit pieces had strange artifacts and hiss that may have been a result of the export process or a buildup of noise due to polyphony. So I think I’ll just look at controlling Drumgizmo via Hydrogen or use samples that aren’t multichannel.