starlit  Diff

Differences From Artifact [7fad9bea38]:

To Artifact [ee9864718b]:


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

local function envarg(n, default)
	local v = os.getenv(n)
	if v then return tonumber(v) end
	return default
end

local baseSeed = envarg('starsoul_sfx_vary', 420691917)
local variants = envarg('starsoul_sfx_variants', 4)
local fmt = os.getenv 'starsoul_sfx_fmt' or 'wav'

local rules = {}
local all = {}
if fmt ~= 'ogg' then table.insert(rules,
	'out/starsoul-%.ogg: %.' .. fmt .. '\n' ..
		'\tffmpeg -y -i "$<" "$@"\n')
end
local function rule(out, file, seed)
	if fmt == 'ogg' then
		table.insert(rules, string.format(
			'out/starsoul-%s.ogg: %s.csd digital.orc physical.orc psi.orc dqual.inc\n' ..
			'\tcsound --omacro:seed=%d --format=ogg -o "$@" "$<"\n',
			out, file,
			seed
		))
	else
		table.insert(rules, string.format(
			'%s.%s: %s.csd digital.orc physical.orc psi.orc dqual.inc\n' ..
			'\tcsound --omacro:seed=%d --format=%s -o "$@" "$<"\n',
			out, fmt, file,
			seed, fmt
		))
	end
	table.insert(all, string.format('out/starsoul-%s.ogg', out))
end
for _, v in ipairs(polyfx) do
	local bn = v:match '^(.+).n.csd$'
	for i=1, variants do
		rule(bn .. '.' .. tostring(i), bn .. '.n', baseSeed + 4096*i)
	end
end







|
|
|




|





|












|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

local function envarg(n, default)
	local v = os.getenv(n)
	if v then return tonumber(v) end
	return default
end

local baseSeed = envarg('starlit_sfx_vary', 420691917)
local variants = envarg('starlit_sfx_variants', 4)
local fmt = os.getenv 'starlit_sfx_fmt' or 'wav'

local rules = {}
local all = {}
if fmt ~= 'ogg' then table.insert(rules,
	'out/starlit-%.ogg: %.' .. fmt .. '\n' ..
		'\tffmpeg -y -i "$<" "$@"\n')
end
local function rule(out, file, seed)
	if fmt == 'ogg' then
		table.insert(rules, string.format(
			'out/starlit-%s.ogg: %s.csd digital.orc physical.orc psi.orc dqual.inc\n' ..
			'\tcsound --omacro:seed=%d --format=ogg -o "$@" "$<"\n',
			out, file,
			seed
		))
	else
		table.insert(rules, string.format(
			'%s.%s: %s.csd digital.orc physical.orc psi.orc dqual.inc\n' ..
			'\tcsound --omacro:seed=%d --format=%s -o "$@" "$<"\n',
			out, fmt, file,
			seed, fmt
		))
	end
	table.insert(all, string.format('out/starlit-%s.ogg', out))
end
for _, v in ipairs(polyfx) do
	local bn = v:match '^(.+).n.csd$'
	for i=1, variants do
		rule(bn .. '.' .. tostring(i), bn .. '.n', baseSeed + 4096*i)
	end
end