A Makefile for UTAU Projects


C: Tutorials

I'm currently making a new cover using UTAU, after having broken the last streak of covers. This time, I thought I'd try using make to help with rendering.

My biggest obstacle is automating the rendering itself: I don't know if UTAU has a command line interface, and using xdotool proved to be too unreliable when I tried. (It was frustrating.)

As it turned out, automating the rest of the rendering process is still really helpful. Here is the Makefile for UTAU projects[1]:

UTAU = env WINEPREFIX=/home/kisaragi-hiu/.wineprefix/UTAU wine "C:\\Program Files (x86)\\UTAU\\utau.exe"
WAV = V1…R1.wav V2…R2.wav harm.wav intro.wav outro.wav ああ-harm.wav ああ-main.wav intro-harm.wav outro-harm.wav

render: $(WAV)
.PHONY: render

$(WAV): %.wav: %.ust
        $(UTAU) "$(realpath $<)"

Which simply runs $(UTAU) <ust full path> for each UST that's newer than its corresponding output file. The caveat here is that the UST needs to share its name with its output, which has to be set manually.

Now when I run make render, UTAU windows will pop up one by one for me to manually do the render[2]. This may not be quite automatic, but it's at least better than manually opening every UST in the project and rendering them.

[1] References used: Learn X in Y minutes, Use `make`! by freeCodeCamp, and File Name Functions in the manual.

[2] Alt-p g RET if the output file name has been set.