Furigana karaoke syntax

From Aegisub Wiki

Jump to: navigation, search
Sample furigana rendering
Sample furigana rendering

The furigana karaoke syntax is a way of noting furigana into a timed karaoke line. Note that this syntax is not part of the ASS specification and is only usable in conjunction with other software that interprets it, eg. an Automation script.

This syntax is only specified in conjunction with karaoke tags!

Contents

[edit] The syntax

The furigana syntax specifies two semi-separate things.

First, the furigana itself. This is specified by appending a pipe-character and the furigana text to the syllable, like this:

{\k3}振|ふ{\k3}り{\k10}仮|が{\k5}名|な

You can of course also have multiple characters at each side of the pipe-character:

{\k4}変身|か{\k12}わ{\k7}っ{\k7}た
{\k4}お{\k4}茶|ちゃ

The other part is the repeated main text character, the hash-mark. The main text of a syllable can be replaced with a hash-mark (#) to signify the last main-part should be highlighted multiple times in a row. This can be combined with furigana but both can be used independantly of each other. Furigana applied to a repeated main text is joined onto the furigana of the previous syllable.

{\k15}二|ふ{\k15}#|た{\k10}人|り{\k15}だ{\k57}け{\k5}の{\k6}地|ほ{\k5}球|し{\k8}で
{\k5}明日|あ{\k10}#|し{\k5}#|た{\k10}ま{\k7}だ{\k10}会{\k4}う{\k6}時{\k14}#

The above two lines should be rendered like this:

ふた
だけの

and

あした
明日 また会う時

[edit] Automation 4 extension

In the Automation 4/Lua karaskel, the furigana layout engine has been completely rewritten and extended to provide better layouting. One of the main goals was to never have to "compress" the furigana to have it fit, but instead have it "spill" over the edges of the text it belongs to, possibly adding extra spacing in the main text if the furigana would overlap that in adjacent text.

Demonstration of the < flag
Demonstration of the < flag

While this layouting for a large part is automated, sometimes you may need to override how it handles the positioning and spacing, and two flags have been added for this. They are placed immediately after the pipe-character in the first syllable of a furigana-endowed sequence. For example:

{\k80}中|<ちゅ{\k60}#|う{\k60}国|ご{\k60}#|く{\k60}魂|<た{\k60}#|ま{\k60}#|し{\k60}#|い

Here, the flag is the less-than character (<) before た. This flag means that, if the furigana of this sequence is wider than the main text for it, the furigana should spill over to both the left and right sides, instead of only spilling onto the right side. (It effectively ensures the furigana is always centered over the text it applies to.) In this case, it also results in a slight extra space being added between 中国 and 魂 because the two furigana sequences would otherwise overlap.

The second flag has to do with joining of sequences. Continuing with the example above, with the old layout algorithm the furigana for 中 and 国 would be separate, but with the new layout algorithm the two sequences are joined visually, making ちゅうごく one long sequence centered over the two kanji. This happens automatically if you don't explicitly tell otherwise.

Demonstration of the ! flag
Demonstration of the ! flag

The < tag already signifies that a new, separate furigana sequence starts at that syllable, and that the layout engine shouldn't try to join it with any sequence before it, but you don't always want the centering < expresses. To only get the sequence-break, use the ! (exclamation mark) flag. Taking the above example again, to avoid joining ちゅうごく and たましい but not centering たましい either, use:

{\k80}中|<ちゅ{\k60}#|う{\k60}国|ご{\k60}#|く{\k60}魂|!た{\k60}#|ま{\k60}#|し{\k60}#|い

[edit] Programming furigana effects

The way furigana internally are represented in the Automation 3 and Automation 4 karaskel are rather different, meaning that knowing one programming model doesn't imply being able to use the other. The Automation 4 model is however designed to be very easy to use, and should in most cases be no different from creating regular karaoke effects.

[edit] The Automation 3 model

See the furigana demo script, make description here later.

[edit] The Automation 4 model

See the furigana test script for a basic demonstration of furigana usage.

A separate style is used for the base text line and the furigana text line. The furigana style can either be automatically generated by karaskel (pass true as second parameter to karaskel.collect_head) or manually created. The furigana style must be named OriginalStyleName-furigana, ie. "-furigana" appended to the style name, otherwise it won't be detected and used. The furigana style should generally use a half font size of the base style and have smaller border and shadow.

When a properly named furigana-style is detected for a line, the furigana layout algorithm is automatically invoked by the karaskel.preproc_line function.

The furigana data are placed in a table separate from the main syllable data, called line.furi. The furigana parts are numbered 1 to n. Each furigana part has all the same fields as a regular syllable table, and can as such be treated exactly the same, the only exception being the Y positioning. The Y-position is neither stored in regular syllables or furigana parts, though the Y-position for the base text will usually be one of line.middle, line.top or line.bottom. The Y position for furigana will however depend on a number of mostly aesthetic factors. Something based on line.top should usually work well.

Another detail, apart from Y positioning, to remember when using the unified processing for main syllables and furigana is the style. The simple thing to do here is set output_line.style = syl.style.name, where output_line is the line table being generated and syl is the syllable or furigana structure being processed.

Since the Automation 4 furigana model uses a separate style for furigana and does not generate compressed text, there are no extra override tags you have to be aware of putting in the output line for furigana.


The Auto4 kara-templater script will have built-in support for furigana, also supporting using the same templates to generate both main syllables and furigana.

Personal tools