Search code examples
pythonaudioscipywavpydub

How to write multi channel wav file in python


I am reading multi channel audio using pydub and I am doing some manipulation to change the audio's loudness. Now I want to write this multi channel audio as a .wav file?

I don't know how to do this. The pydub doesn't support this action.

Could anyone please help me with this?

Kind regards Denis


Solution

  • you can make a multichannel audiosegment from muliple mono audio segments:

    from pydub import AudioSegment
    
    # load individual channels...
    mutli_channel = AudioSegment.from_mono_audiosegments(channel1, channel2, ..., channel_n)
    

    more info in the pydub docs