Export WAV files with (uppercase) .WAV extension

This might be a niche issue, but it’s an issue for me nonetheless.

Here’s the short version:

When exporting WAV files, Cubase 12 on Windows 11 uses a lowercase .wav extension. I need it to use an uppercase .WAV extension instead for compatibility with (internally Linux-based) hardware I use for playing live. Aside from manually renaming those files after the fact (which I am currently doing, but it’s tedious), is there a way to make Cubase use an uppercase .WAV extension instead when exporting files?

The longer version:

By default, Windows is case-insensitive when it comes to file names, so as far as Windows is concerned, a file with a lowercase .wav extension is the same as a file with an uppercase .WAV extension, so this isn’t a problem when staying within the Windows ecosystem.

In my case, I am exporting these .wav files to an Akai MPC Force, which runs Linux internally, and Linux is case-sensitive when it comes to file names. When I first create projects based on those exported .wav files on my Akai MPC Force, the Force will (for some reason) change the case on these audio files to an uppercase .WAV extension. Which isn’t a problem - until I try to replace those WAV files with updated versions exported out of Cubase. Those files will have the lowercase .wav extension, so the Force won’t recognize those files as being a replacement - instead it considers them completely alien files and won’t load them as replacements in my Force project.

The only workaround is to manually change the extension to uppercase .WAV on the Windows side (via ren *.wav *.WAV) before sending them over to the Akai MPC Force (in which case they are then properly recognized there and all is well).

Before I send this as a #feature-request to Steinberg Support, I wanted to see if anybody on this forum has maybe a clever solution?

Imho this is something you should complain about with Akai. If you copy the same file with the same name twice to the device, but it changes the name so the second copy is not recognized anymore, that is stupid behavior from the MPC. It should just leave the filename as it is…
Imho uppercase extension aren’t the norm on windows, either. Not unheard of, but lowercase is definitely the majority.

Apart from writing a script that changes the case and then directly copies the files to the MPC (if that is possible, don’t know the device), I have no idea for a clever workaround.
I very much doubt though that you’ll be successful with a FR for Cubase for this :wink:

1 Like

There is a section on batch renaming file extensions about a third of the way down the page.

I agree that this is dumb behavior on behalf of the MPC. Unfortunately, based on past interactions with Akai Support, the chances they’re going to do anything about it are virtually zero. They don’t even respond to support tickets at all …

And yes, I doubt that Steinberg is going to bother implementing such an edge case feature request, but at least now there’s a record of this in this forum.

Thanks! Like I said in my original post, “REN *.wav *.WAV” works well enough to change the case of the extension to uppercase, it’s just tedious.

I’d love to have an option in the Export dialog that allows me to run an arbitrary command-line tool after the Export concludes.

That dialog already offers a couple of other post-export options, so it wouldn’t seem too strange to just add a text field to point to a command line script that Cubase automatically runs after export.

That’s probably a more generally useful #feature-request.

You can use an Audio Export Post Process script.

For example, this will open a command prompt (if you’re on Windows):

<?xml version="1.0" encoding="UTF-8"?>
<AudioExportPostProcess>
   <Description>Open a command line</Description>
   <Icon>CommandLine.png</Icon>
   <Executable>
      <Path>C:\WINDOWS\system32\cmd.exe</Path>
      <Argument>/k echo $PATH</Argument>
   </Executable>
   <RunOnce>true</RunOnce>
   <WaitDone>false</WaitDone>
</AudioExportPostProcess>

Put that into a text file, call it “CommandLine.aepp”, place it in “C:\ProgramData\Steinberg\Audio Export Post Process Scripts” and that will add it as an option in the drop-down list. You can then adapt it to do whatever you want with the files.
CommandLine_AEPP.zip (1.2 KB)
The attached zip archive also has the PNG image that’s used as an icon.

3 Likes

That’s a great start - thank you!

Unfortunately, the $PATH argument just points me to a XML file, instead of being the path of where the exported files are, and the command line starts up in a completely unrelated directory:

So, I’d have to write some code to open up that XML file, parse out where the actual exported files are (luckily, that information is in that XML file), and then perform the necessary rename operation that I’m after.

My coding skills are just too rusty at this point for this to make any sense to invest my time into, so I’ll just keep doing the rename manually.

Or am I just being dense and am missing some really obvious solution here to be able to simply execute a one-line command-line command (“ren *.wav *.WAV”) in the location that the files were exported to (that’s the important part, and that would be the Mixdown directory of the current project)?

I don’t think the script format is officially documented, in fact, it was in collaboration with a number of users here that we figured this out.

My example was mainly a way to play around and explore the environment in an effort to better understand the mechanism. I realise I forgot to supply the PNG image for the icon, so that may have caused it to choke. I’ve attached that now to my first post. Unzip the contents into the folder and you’ll have what I have, which does work for me.

All it does is open a command prompt and echo what it has received in the environment variable passed via the “Argument” parameter, and leave the command prompt window open so I can explore the environment. What you’ll need to do is probably call a batch file.

Make sure you’re putting it in the correct folder, on Windows (at least) there are another two folders of the same name. The quickest way to get to that folder is to use:
%PROGRAMDATA%\Steinberg\Audio Export Post Process Scripts
… so Windows+R and type that in.

There’s another example here which you’ll find useful.

1 Like

Thanks - you already answered my next question (“where can I find the official documentation of this?”), with the answer being “there isn’t any!” :slight_smile:

In one of the threads you referenced, somebody else mentioned that you’ll need to do some programming to extract the path to the exported files from the XML file that Cubase generates.

If I end up writing just such a script after all (which I’m sure will be useful for others who are trying to do some sort of post-processing of exported files), I’ll post it here.

Yes, it’s awkward on several counts, because that XML file is just a temporary file as well. As best I can figure it out, the (called) process’s current directory will be also be unpredictable, and seems to be the folder of the last VSTi that gets rendered… yours landed in Retrologue’s folder, mine in HALion’s, so it will differ depending on what’s in the project.

So the requirement for the called executable would be:
– get the XML file name, which is passed as the argument
– parse the XML to get a list of the exported file name(s)
– do your stuff with each one

Yep, the XML lives in the temporary file directory (so you better process it straightaway), and yes, the path where you end up seems pretty random (I’ve landed in both the Retrologue and Halion folders).

Either way, I spent the better part of today getting this to work. Here’s how:

Make this file called UppercaseWAVExtension.aepp and put it into “C:\ProgramData\Steinberg\Audio Export Post Process Scripts”:

<?xml version="1.0" encoding="UTF-8"?>
<AudioExportPostProcess>
   <Description>Uppercase WAV extension</Description>
   <Icon>CommandLine.png</Icon>
   <Executable>
      <Path>C:\WINDOWS\system32\cmd.exe</Path>
      <Argument>/c UppercaseWAVExtension $PATH</Argument>
   </Executable>
   <RunOnce>true</RunOnce>
   <WaitDone>true</WaitDone>
</AudioExportPostProcess>

Make this file called UppercaseWAVExtension.bat and put it anywhere that’s part of your Windows PATH environment variable so it can be found from anywhere:

@echo off
setlocal enabledelayedexpansion

set xmlFile="%~1

tidy -xml -wrap -modify -quiet %1

for /f "tokens=2 delims=><" %%a in ('type "%xmlFile%" ^| find /i "<Path>"') do (
	set "filePath=%%a"
	set "fileExt=!filePath:~-4!"
	if /i "!fileExt!"==".wav" (
		set "newPath=!filePath:.wav=.WAV!"
		move "!filePath!" "!newPath!"
	)
)

Lastly, download the tidy.exe XML prettifier at http://www.html-tidy.org/ (it’s in the https://github.com/htacg/tidy-html5/releases/download/5.8.0/tidy-5.8.0-win64.zip ZIP file) and put it again somewhere into your Windows PATH so the script can find it. This is necessary because Cubase makes a XML file that doesn’t contain any newline characters, making it difficult to parse, so I’m prettifying it first with this tool as part of that batch file.

That should do it - you can now select this post processing as part of your Export functionality and will end up with uppercase-extension .WAV files!

You also now have a script that deals with extracting the path out of the Cubase-generated XML file, and that will iterate through that XML file, allowing you to do whatever you want to each file. And as a bonus, you’ll end up with a more human-readable XML file as well.

All this will hopefully come in handy for others!

3 Likes

Didn’t know about the possibility to make your own Export Processing Scripts… excellent!

I just couldn’t help myself and rewrote the extension uppercase script in powershell (removing the need of installing tidy) and making it generic for all extensions (assuming that the last part after a dot is the extension) :wink:

<?xml version="1.0" encoding="UTF-8"?>
<AudioExportPostProcess>
   <Description>Uppercase Extension</Description>
   <Icon>CommandLine.png</Icon>
   <Executable>
      <Path>C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe</Path>
      <Argument>"C:\scripts\UppercaseExtension.ps1" "$PATH"</Argument>
   </Executable>
   <RunOnce>true</RunOnce>
   <WaitDone>true</WaitDone>
</AudioExportPostProcess>
Param(
	[Parameter(Position=0)]
	[string]
	$inputfile
)

[XML]$xml = get-content $inputfile;

foreach ( $path in $xml.AudioExportDescription.Track.Path ) {
	$out = $path.split(".")
	if ( $out.Count -eq 1 ) {
		# do not rename files without an extension
		continue
	}
	$out[-1] = $out[-1].toUpper();
	$outpath = $out -join "."
	move-item $path $outpath
}

I had to disable Windows Ransomware Protection for it to work, though, because else it wouldn’t let powershell rename the files.

2 Likes

Great work, both if you!

@Timo00, well done, I admire you’re tenacity with batch files, not one of my favourites!
@fese, you beat me to it – I was also thinking about a PowerShell solution.

PowerShell is now cross-platform, so could also be a solution for macOS (and even Cubendo for Linux, when that’s released :slight_smile: ).

1 Like

All this is awesome, and the kind of interactions I crave when I hang out in online forums!

Now let’s hope that this undocumented API/functionality will not get deprecated, but instead elevated to a formal part of Cubase, incl. documentation!

1 Like

So cool, yes.

I’m pretty sure it will never go away – it’s a very durable kind of feature depending only on long-standard practices e.g., piping a command to a process.

I found another use case for the audioprocess scripts for me: creating an mp3 in my dropbox folder for the exported files. If anyone is interested, here are the scripts:
MP3toDropbox.zip (810 Bytes)
You need to have ffmpeg for Windows installed (Download FFmpeg) and then edit the path to that in the mp3todropbox.ps1 at line 12:

&C:\path\to\ffmpeg.exe -y -i $path  -b:a 256k  -id3v2_version 3 -write_id3v1 1 -metadata artist="username" -metadata title="$title" -metadata date=$year "${env:USERPROFILE}\Dropbox\Public\Audio\$title.mp3"

You can easily modify this for other cloud services, or output formats by editing the last parameter of this line.

1 Like