A Makefile for UTAU Projects

Update 2019-05-24: Updated Makefile to generate file list automatically (line 2).

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.)

How do I render a UST from the command line…

— 如月飛羽🌈 (@kisaragi_hiu) April 12, 2019

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 = $(patsubst %.ust,%.wav,$(wildcard *.ust))

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 render2. This may not be quite automatic, but it's at least better than manually opening every UST in the project and rendering them.


2

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