How do I convert a session from one sample rate to another?

From the Googling I’ve done, I don’t think there’s an easy way to convert, say, 44.1k session into a 48k session…

However, there have to be some shortcuts. I already know about exporting midi tracks which I can then import into the new version. What about CD and location markers? That’s my biggest headache right now. I have 40 sessions to convert and any shortcut would be very helpful.

1 Like

There’s no shortcut. Ardour 2.x had a script that could convert a session. But since then, given the absolutely central role of sample rate when working with digital audio, Ardour has assumed that you get the SR right first time. This won’t change at least until the “nutempo” work (which involves a complete change in how we represent time) becomes part of the regular codebase.

Dang. Didn’t realize so many devices were 48k only or 48k-based. Thanks anyway.

Edit: Plugins (Guitarix) too.

Ok, I wasn’t willing to take “no” for an answer on this and glad I didn’t. You can go into an existing session file (with a text editor), find the Locations tag, copy all the marker information from there, then paste it into the new session. (I don’t know if it matters, but I left the start/end information tag alone in the new session).

It looks like I’ll have to adjust the markers since they got samplerate-skewed, but that’s a million times better than typing them all out again.

Hope this is helpful to others.

1 Like

Aren’t position markers by sample position? If so your positions will be 17% off from where you intended, won’t they? Is that what you meant by markers get samplerate-skewed?

And what did you do about all the session audio files? Did you run sample rate conversion by hand on those (or shell script, I guess, if you were trying to change a few dozen projects at once)?

Yes the markers were off and takes a little effort to slide them to the correct spot for each song, but that’s far better than typing them all again.

I don’t have any audio files in my sessions, just MIDI, so it worked out for me. Not sure what you’d do with audio files but it would probably involve ffmpeg.

I have just applied this command from the session audiofile directory:

for i in *; do sox “$i” -r 44100 “44100_$i”; mv -f “44100_$i” “$i”; done

then changed the sample-rate parameter from 48000 to 44100 in the session .ardour file and everything is fine.

:bangbang: WARNING EDIT :bangbang: : as mentioned by @x42 in reply, you can do this ONLY if all you region start points are sticked to zero in time. If you have some regions anywhere else, do NOT do this!

This is dangerous :bangbang: For anyone reading this, do not do this unless you have a backup of the whole session and understand what you’re doing!

Ardour’s session-file keeps all positional data in samples at session-rate. So all edits, source-file-offsets, region-positions, markers, automation-points, etc will be incorrect if you change a file’s rate under the hood.

That being said, if all those values are zero, it can work.

It may also happen that after re-sampling some offset exceeds the file’s length which will make the session unusable.

Dear Robin @x42

Yes you are right, I really should have mentioned that in my case all my region start times are equal to zero. So I will add an edit to my post.

BTW thank you so much for all your contributions to the project.

It could be useful to convert a session from on rate to an other, for example if you don’t use samples at all (only midi).
I used to have a rate of 44100, then I read 48000 could improve the latency a bit (with less computing). So I’ve began to use a rate of 48000. I don’t use samples but when I load a 44100 session, the problem is some midi notes are not working a all (at random). If I start a 44100 session, then the midi notes are played correctly. I’ve modified the sample-rate in the xml file, but it’s still the same.
Switching from one rate to an other is quite annoying :slight_smile:

Just to make sure…
The safe way would be to export all the audio stems and then apply your command to the wave files in the ‘export’ directory, correct?
Are there any other risks involved?

Operating on exported files will do nothing (they are exported and thus not part of the session).

Yes. I meant exporting, converting them, starting a new project and importing the converted ones.
I wanted to know if there are risks of losing quality or anything important in the process.

You could set up an ABX test between your original files and the resampled ones to see if you can reliably hear a difference (highly doubtful). Something like SoX even with default settings is going to be excellent. In terms of importing the resampled files into a new Ardour project, there would be zero risk.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.