m1gin 218

Replace an Audio Source File in Ardour Project

Let's say I used an audio file in an Ardour project. But after some time I wanted to replace it. What should I do?

It looks like in Ardour5 there is no option to replace a file in the project.

Luckily .ardour project files are XML files. So, it is possible to edit it manually.

Let's try an example

Let's say I used a file with the name mbirgin-test.wav in Ardour 5 project. Then I wanted to save space and replace the WAV file with a FLAC version of it.

Firstly I converted the file to flac:

ffmpeg -i mbirgin-test.wav -c:a flac -sample_fmt s16 mbirgin-test.wav.flac

Now I have mbirgin-test.wav.flac file in interchange/projectname/audiofiles

It is time to edit .ardour project XML file. Open it and focus at //sesion/Sources node:

<Source name="mbirgin-test%L.wav" type="audio" flags="" id="342710" channel="0" origin="" gain="1"/>
<Source name="mbirgintest%R.wav" type="audio" flags="" id="342712" channel="0" origin="" gain="1"/>

For a stereo audio, Ardour saved the channels to seperated files. But I will use one stereo flac file. So I replaced the previous source as follows. (Pay attention to channel attribute too)

<Source name="mbirgin-test.wav.flac" type="audio" flags="" id="342710" channel="0" origin="" gain="1"/>
<Source name="mbirgin.wav.flac" type="audio" flags="" id="342712" channel="1" origin="" gain="1"/>

I saved the file and opened it in Ardour. Hurray! It works! :)

TIP: For more space saving, it should be also possible to use OGG file. But please be sure you are using the same sample rate of the original audio.

Let me try this and type the result. One moment please! :)

Yippe! :)

By the way, it is possible to use the file without copying it to interchange/projectname/audiofiles
In this case the attribute origin need to be set as in:

<Source name="mbirgin-test.wav.flac.ogg" type="audio" flags="" id="342710" channel="0" origin="/home/user/audio/mbirgin-test.wav.flac.ogg" gain="1"/>
<Source name="mbirgin.wav.flac.ogg" type="audio" flags="" id="342712" channel="1" origin="/home/user/audio/mbirgin-test.wav.flac.ogg" gain="1"/>


#ardour #ubuntu #changesource

Add to: