Karaoke inline-fx (inline effects) is a way of marking up timed karaoke to assign different effects to different parts of a line.

By itself, inline-fx markup doesn’t do anything, it only has an effect when a karaoke effect script that understands it is applied to the timed karaoke.

The markup

Inline-fx tags are (otherwise invalid) ASS override tags of the form \-effectname, where effectname is the name of the inline-fx defined.

Like normal override tags, an inline-fx tag affects the syllable it is placed in and every following syllable, until the next syllable with an inline-fx tag in it.

At the start of each line the inline-fx is reset to nothing.

Example

Here is a timed karaoke line with inline-fx markup:

{\k40}zu{\k20}t{\k42}to {\k32\-paint}e{\k17}ga{\k45}i{\k32}te{\k26}ta {\k24\-cloud}yu{\k55}me

These syllables get inline-fx assigned like this:

SyllableInline-fx
zu(blank)
t(blank)
to(blank)
epaint
gapaint
ipaint
tepaint
tapaint
yucloud
mecloud

Usage in Karaoke Templater

If you use Karaoke Templater to create effects, you can use the fx modifier on templates to make that template affect only syllables with a specific inline-fx. It isn’t possible (directly) to match only syllables with blank inline-fx.

Example

With the sample timed karaoke from above, you could have the following templates:

template syl: {base effect applied for all syllables}
template syl fx paint: {overlay effect applied only to the ‘paint’ syllables}
template syl fx cloud: {overlay effect applied only to the ‘cloud’ syllables}

The idea here is to have a base effect and then some of the syllables get some more effects on top of that.

Example

It is possible to match only syllables with blank inline-fx in kara-templater by using an fxgroup that enables or disables basing on inline-fx. You can also use _fxgroup_s to have templates that run for multiple inline-fx.

code syl: fxgroup.blankfx = (syl.inline_fx == “”)
template syl fxgroup blankfx: {effect only applied on blank inline-fx syllables}

The important thing is that the code line runs per syllable and runs before any per-syllable templates that must use it.

Usage in Lua scripts

The inline-fx tags are parsed by karaskel.preproc_line_text so they will only work if you have applied at least that much karaskel pre-processing on your subtitle lines.

The inline-fx for a syllable is then available as syl.inline_fx, which you can compare to a string to conditionally apply effects.

Example

In some code that runs per-syllable in your script:

if syl.inline_fx == "" then
    apply_base_effect(subs, meta, line, syl)
elseif syl.inline_fx == "paint" then
    apply_paint_effect(subs, meta, line, syl)
elseif syl.inline_fx == "cloud" then
    apply_cloud_effect(subs, meta, line, syl)
end

Simply compare the inline-fx name to the various possibilities and run the right effect code.

Example

In some code that runs per-syllable in your script: At top-level of your script:

effects = {}
effects[""] = function(subs, meta, line, syl)
    -- base effect code here
end
effects.paint = function(subs, meta, line, syl)
    -- paint effect code here
end
effects.cloud = function(subs, meta, line, syl)
    -- cloud effect code here
end

Then later, in some per-syllable processing code:

effects[syl.inline_fx](subs, meta, line, syl)

First, a table is created and filled with functions for applying the different effects. The keys used for the table are the names of the possible inline-fx. When the effect has to be applied, the right function is looked up in the effect table and then called.

{::template name=“automation_navbox” /}