How to set the path where audio/midi clips are saved?

When creating a new edit, I like to set sub-folders for “Audio” clips, and another for “Midi” clips.
For example;

“C:\MyNewEdit\Audio” and “C:\MyNewEdit\Midi”

Creating the folders is easy, and done.

How do I set these paths within the engine?

What do you mean by “set the paths within the Engine”?

There’s two ways to deal with file resources in the Engine, using the Project class, which is really for multi-Edit based projects and not generally recommended for most people, and then by setting the two

    std::function<juce::File()> editFileRetriever;
    std::function<juce::File (const juce::String&)> filePathResolver;

members of the Edit class which Clips etc. will use to try and convert stored relative paths to File objects they can use.


One final thing to note is that when you create a MIDI clip, the MIDI data is stored with the clip, directly in the ValueTree so there is no link to the original file. You may want to keep the MIDI files around and accessible from your UI so users can use them again but making changes to a MIDI file won’t affect what is played back by an existing MIDI clip.

I was referring to where the recorded audio clip will be saved. I would like it to be saved in “C:\MyEdit\Audio\vocal.wav”, for example, How do I set the default save path?

If you look in to getRecordingFile inside tracktion_WaveInputDevice.cpp and then in to expandPatterns you’ll see how the file to record to are determined.

You’ll probably want to step through that to see how it deviates from what you want but the general idea is that there’s a WaveInputDevice::filenameMask member (with an setFilenameMask accessor) that you can set to change the behaviour in expandPatterns.


Remember that this is very complex though and has to deal with files on different (or even the same) tracks, takes, formats etc.

Use WaveInputDevice::setFilenameMask. The default is %projectdir%/%edit%_%track%_Take_%take%.

Follow macros are available: %projectdir%, %edit%, %track%, %date%, %time%, %take%

Thank you both. I will experiment with WaveInputDevice::setFileNameMask. That looks to be just what I need.