Cleanup unused regions, delete unused audio ?

Is there a way to delete the audio for deleted regions? Menu item: Session/Cleanup only removes entire audio files.

Any suggestions or tips welcome.

thanks, Jeremy

Short version, no. Ardour is intentionally NON-destructive so it never changes audio once it is written to disk with exceedingly few exceptions.

Longer version is being discussed on the mailing list since it was posted there as well. Essentially there is no automated way to do it, there is an error prone way to manually do it, but I don’t recommend it. And I am looking into enabling FLAC recording for such an occasion as then the silence takes up almost no space on disk.

 Seablade

Thanks seablade. I’m going to read all the comments posted on the mailing list and try out the manual method, explore the risks and see how secure I feel.

For the way I’m working I think the FLAC recording probably won’t work because the “silent” segments contain some background noises.

The reason I’m interested in cleaning up unused region audio is I can save about 30% disk space which means I can usually archive a project to one DVD.

Best regards

Jeremy

For the way I'm working I think the FLAC recording probably won't work because the "silent" segments contain some background noises.

Trust me, I did some extensive testing on this and even with that being the case significant benefits were provided.

  Seablade

Who tracks a LOT of live shows.

I must confess that I didn’t know about FLAC until you mentioned it today so I need to do my homework. Look forward to trying this when it becomes available.

Regards

Jeremy

For me it’s a big mistake to not give a tool to delete unused audiofiles, at list, and unused regionfiles. Harddisk will quickly be full this way and at that point manual cleaning will be a titan work !
What method would you recoment, at list, when you practice loop recording that produces a new sound file at each loop ?

kmchen : There IS a way to remove unused audio files/regions : http://manual.ardour.org/working-with-sessions/cleaning_up/
What Jeremy asked for was a way to delete the unused sections of files, not full files.

Actually, more importantly, this thread was 6 years old, slightly outdated to say the least.

 Seablade

The thread might be rather old, but this problem still seems to be unsolved, isn’t it?
I’m completely new to Ardour and signed up because I have the the same problem.

Once a week I meet with some friends for a jam session of about 2-4 hours, that we record with Ardour.
About 99% of the result is… let’s face it - garbage :slight_smile: But once in a while there is a pearl that’s worth to be worked on.

So what I would like to do is to create a session that only contains the 5 good minutes and completely delete the rest.
Right now I have a 5 minutes piece with three tracks that’s 5 GB of size, even with the unused tracks already deleted. That’s impossible to handle (e.g. send it to the other musicians over the net).

So I wonder how a session can be cleaned from all unused wav files. Is there any way to do this? Maybe with a lua script?

You cannot do this if all you did was trim the regions down. Ardour is a non-linear, non-destructive editor - your changes do NOT modify the original files. Your final “state” (with just 5 minutes of good stuff) has not created any new files, it has just changed the session information to only use 5 minutes of the existing files. “Cleanup” removes files that are no longer in use. Your files are still in use.

You would need to bounce your regions, use the bounce versions to replace the originals, and then cleanup. The bounce process writes new files that contain only the contents of the region at the time it was bounced. The other, larger, original files will then be unused.

This answer applies to Jeremy’s question too. Bouncing needs to be (a) more visible (b) more user friendly (right now the results ONLY end up in the region list).

Thanks for your reply. I already tried bouncing, and it seems to work. But this is a more or less exhausting task, especially if the original tracks consists of more then one region (one has to arrange them all manually after bouncing).

What I like to have is: I select the regions I want and then say “Create a new project with just this data”.
I wonder why there isn’t a shortcut to this. Is it such an exotic scenario?

Yes, it is an exotic scenario. Disk space is extremely cheap now. The need for this sort of cleanup, while theoretically the right thing to do, isn’t really that pressing for most people. Using 5GB of data when you can buy 2TB for US$100 ? It isn’t much of an issue for most people.

I agree that Ardour should have a workflow to make this simpler/easier/faster.

Disk space is cheap, that’s true. But nevertheless I think it’s a good idea not to waste resources.
But the main reason I asked this question is that we plan to collaborate via the internet - something like: upload a session to ownCloud, so every musician can download it and work on it’s part, uploading the changed/new files back. In this scenario size is the main issue.

btw. While writing this I realize that it’s not only the WAV files that change but also the project file. Do you know any workflow to integrate new tracks/regions/filter… into an existing project file (which may have already changed locally, too). Is there a documentation of that project file data structure? I guess, I have to merge the changes with an external tool, right?

when you edit in a non-linear, non-destructive system, the audio files are never changed by your edits. So your interactions online consist of uploading/sharing the files, once. You do not share new versions of the audio file after every edit. You only share new files after capture. But yes, if you captured 5GB, then without the bounce step, you will still be sharing 5GB files.

some people have used git, a revision control system much favored by open source (and some closed source) software developers, to work collaboratively on ardour projects. there are many considerations, and there’s no handbook, manual or blog post about how best to do it.

Paul, thanks a lot for your patient explanations to a newbie.
It’s not, what I hoped for, but at least I know now what works and what doesn’t.
I will still try to strip sessions, maybe externally with a perl script. Do you know if there any documentation of the session xml file (if not external than maybe within the code)?

There is no such documentation. We feel free to change the session file format on an as-needed basis, and do not have the resources to document such changes for 3rd parties/users.

There is a Lua Action Script "Bounce + Replace Regions. It currently operates on the selected regions only (ctrl+a to select all). After that save-as or just save + cleanup will do the trick.

Ardour-Menu > Edit > Lua Scripts Script-Manager (or use the Preferences > Appearance > Toolbar > Action script buttons ; right-click on the toolbar button to map a script)

One caveat. It calls “bounce with processing” so if you use a plugin, that’ll be applied (and if it’s a reverb, the tail will be cut at the end of the region). I suppose you can modify the script to your needs, if you know perl any other scripting language will be easy to grok.

Thank you x42. I’ll give that a try. Right now I’m short of time, but will examine that script later.

I looked at the script and don’t want processing. There is a line like:

local region = track:bounce_range (r:position (), r:position() + r:length (), ARDOUR.InterThreadInfo (), track:main_outs (), false, “”);

Changing it to:

local region = track:bounce_range (r:position (), r:position() + r:length (), ARDOUR.InterThreadInfo (), nil, false, “”);

This is based on the information in the docs at: The Ardour Manual

Search for bounce_range() and apparently passing nil for the endpoint should work “the processor to tap the signal off (or nil for the top)”

When running this script Ardour exits (I assume a silent crash of some kind).

I also tried the “Cleanup Unused Regions” but that doesn’t seem to work either. Any suggestions in the more recent Ardour 6 that I am using?

local proc   = ARDOUR.LuaAPI.nil_proc () -- bounce w/o processing
local region = track:bounce_range (r:position (), r:position() + r:length (), ARDOUR.InterThreadInfo (), proc, false, “”);

The C++ API expects a valid shared-pointer (not NULL) that points to 0. Sadly Lua doesn’t have a good concept to express that.

1 Like