-
Notifications
You must be signed in to change notification settings - Fork 11
9 ‐ Output File Names
While working with the Musical Gestures Toolbox, you probably end up generating a lot of videos and images, while tweaking the tools to your needs. For this it is handy to know how the toolbox handles file names. There are basically two parameters to keep in mind: target_name
and overwrite
.
target_name
is what the name of the output file should be. In all cases there are simple default values that will append some suffix to the source file name. Let's say you use average
on dance.avi then by default (with target_name=None
) the output file will be dance_average.png put into the same folder as dance.avi.
If you need a more specific output file name, or perhaps you need to put the results in a different location, you can specify a target_name
. In this case the target name should be a path. Relative and absolute file names both work, but keep in mind that they are independent from your source file location. (So relative paths are still relative to the current working directory of your interpreter as normally.)
Additionally to defining a target output file name and location, you can also decide if subsequent runs of the same process should keep or overwrite earlier results. overwrite
is a boolean parameter, and if it is False
(which is the default setting) then whatever is the target_name
it will be silently incremented if there is already a file in the destination folder having the same name.
For example: you run history
on dance.avi for the first time and you get dance_history.avi. Now you go back to your code, and change the history_length
to 20 (instead of the default 10) frames, to get a longer video delay. If you now run the code again with overwrite=False
you will get dance_history_0.avi as a result, even though the target_name
was "dance_history.avi". With the increment "_0" at the end of the file name we avoided to overwrite dance_history.avi that was already there from the previous run. If we would run the code again, it would produce dance_history_1.avi, then dance_history_2.avi, and so on.
This can be really useful to track your progress and to save several version of the same process with ease. However, if you don't need all the previous result, you can just turn this feature off by specifying overwrite=True
.
A project from the fourMs Lab, RITMO Centre for Interdisciplinary Studies in Rhythm, Time and Motion, Department of Musicology, University of Oslo.