Skip to content

Instantly share code, notes, and snippets.

@Last-Order
Created October 18, 2018 13:56
Show Gist options
  • Save Last-Order/9950953801a7bf61c9852e6f5e337393 to your computer and use it in GitHub Desktop.
Save Last-Order/9950953801a7bf61c9852e6f5e337393 to your computer and use it in GitHub Desktop.
失败的ass yutils音频特效
Comment: 0,0:00:26.86,0:00:28.86,lyric-jp,,0,0,0,code once,wav_reader = _G.Yutils.decode.create_wav_reader("C:/Users/Sora/Desktop/1.wav"); sample_rate = wav_reader.sample_rate(); byte_rate = wav_reader.byte_rate(); bit_depth = wav_reader.bits_per_sample();
Comment: 0,0:00:28.86,0:00:28.86,lyric-jp,,0,0,0,code syl,e = 2.71828; position = wav_reader.position(wav_reader.sample_from_ms(math.round(line.start_time + syl.start_time))); samples = wav_reader.samples_interlaced(wav_reader.sample_from_ms(syl.duration > 0 and syl.duration or 1)); for i=1, samples.n do samples[i] = samples[i] / math.abs(wav_reader.min_max_amplitude()) end freq_analyzer = _G.Yutils.decode.create_frequency_analyzer(samples, sample_rate); freqs = freq_analyzer.frequencies() ; freqs_new = {}; count = 1; weight_max = 0; for i=1, freqs.n do if freqs[i].freq >120 and freqs[i].freq < 600 and math.round(freqs[i].freq) % 5 == 0 then _G.aegisub.log(freqs[i].freq .. ", " .. freqs[i].weight .. "\n") freqs_new[count] = freqs[i]; count = count+1; if freqs[i].weight > weight_max then weight_max = freqs[i].weight end end end
Comment: 0,0:00:28.86,0:00:28.86,lyric-jp,,0,0,0,code syl,colors = {"&H7BCFF3&", "&H0029EAEF", "&H00DB5BCB", "&H00E4DA52", "&H0095D760", "&H005063E7"}
Comment: 0,0:00:28.86,0:00:30.86,lyric-jp,,0,0,0,template noblank notext,!retime("syl", 0, 200)!!relayer(1)!!maxloop(#freqs_new)!{\bord0\shad0\fsc1000\fad(200, 0)\move(!math.min($lleft - 100, 400) + j * (math.max($lright + 100, 1520) - math.min($lleft - 100, 400)) / #freqs_new!, !$y + 71!, !math.min($lleft - 100, 400) + j * (math.max($lright + 100, 1520) - math.min($lleft - 100, 400)) / #freqs_new!, !$y + 71 - (freqs_new[j].weight / weight_max * 150)!, 0, 200)\alpha&HAA&\t(200,201,\alpha&HFF&)\p1}m 0 0 l 1 0 l 1 1 l 0 1
Comment: 0,0:00:28.86,0:00:30.86,lyric-jp,,0,0,0,template noblank notext,!retime("syl", 0, 1000)!!relayer(1)!!maxloop(#freqs_new)!{\bord0\shad0\fsc1000\fad(200, 0)\move(!math.min($lleft - 100, 400) + j * (math.max($lright + 100, 1520) - math.min($lleft - 100, 400)) / #freqs_new!, !$y + 71 - (freqs_new[j].weight / weight_max * 150)!, !math.min($lleft - 100, 400) + j * (math.max($lright + 100, 1520) - math.min($lleft - 100, 400)) / #freqs_new!, !$y + 71!, 200, !line.duration!)\alpha&HAA&\t(\alpha&HFF&)\p1}m 0 0 l 1 0 l 1 1 l 0 1
Comment: 0,0:00:28.86,0:00:30.86,lyric-jp,,0,0,0,template,!retime("syl")!!relayer(2)!{\fad(200, 0)\pos($x, $y)}
Comment: 0,0:00:28.86,0:00:30.86,lyric-jp,,0,0,0,template,!retime("syl2end", 0, 200)!!relayer(2)!{\t(!line.duration - 200!, !line.duration!, \alpha&HFF&)\pos($x, $y)}
Comment: 0,0:00:28.86,0:00:30.86,lyric-cn,,0,0,0,template,!retime("syl")!!relayer(2)!{\fad(200, 0)\pos($x, $y)}
Comment: 0,0:00:28.86,0:00:30.86,lyric-cn,,0,0,0,template,!retime("syl2end", 0, 200)!!relayer(2)!{\t(!line.duration - 200!, !line.duration!, \alpha&HFF&)\pos($x, $y)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment