SuperAPI AI Directory

lw-tone-check

Writing & research

View repository

Updated 10-16 09:57

About this skill

Tone Check (倒字检测器)

This is the only thing in this library that can be built without any textbook and immediately produces an objective criterion. The tone table and the melodic direction are both determinate data. Its place in this library is like tempo in audio—one of the few quantities that can be measured directly and used for comparison.

Which sections to read by task

Task Read
What dao-zi is §1
How to judge §3
How to read the result §4
Whether this number can serve as a verdict ★ §5 Three boundaries (required reading)
How to fix it once risk is flagged ★ §6 Five ways to fix
Cantonese §7(★ harmonic tone matching is not this tool)

Boundaries

Not covered here Where it belongs
Thirteen rhymes, level and oblique tones, Chinese rhyme tables lw-mandarin
Cantonese harmonic tone matching ★ lw-cantonese(Constraints are stricter, and the writing order is reversed)
Rhyming lw-rhyme
How characters are set to notes (how many characters per line) lw-workflow S2 of §2 + lw-structure
How the melody itself is changed Composition and arrangement(this skill flags the location and writes a message, see lw-workflow §6.2)
How those characters should be sung (breathy voice/dynamics/pitch correction) Voice(recording and vocal coaching)

1. What dao-zi is

When sung, it is heard as a different character.

Every character in Mandarin has a tone contour. If the melodic direction between characters is opposite to the high-low relation of the tones, the character changes in perception—"深爱" (shēn ài) sung as "神爱" (shén ài).

★ In opera, this is called "依字行腔" (setting the tune according to the characters)(also said as 因字行腔, 按字行腔), which is the same problem from the older phrasing on the side of writing the tune: characters have four tones, each of the four tones has a tone value, and the rise and fall of the tune follows the character tones; a simple tune for a pair of upper and lower lines can be sung with widely differing tunes because the characters differ and the feeling differs (Zhang Geng and Guo Hancheng, eds., Zhongguo Xiqu Tonglun, p0506; Liu Jidian, Jingju Yinyue Gailun, p0153). Conversely, if the four tones are not sung correctly and the character sounds go astray, opera calls it倒字, which is a major taboo in singing (Zhongguo Xiqu Tonglun, p0304).

Three corollaries for lyric writing:

  1. In opera, the characters come first and the tune comes after: the person writing the lyrics manages the four tones and rhymes of the characters, and the composer sets the tune according to the characters. This is the case of words first, then music—when the lyrics are handed over, mark the tone contours of the characters (lw-workflow §3), and only then can the composing side follow the characters.
  2. In opera, a single character when sung often has to be extended over several beats(Zhongguo Xiqu Tonglun, p0304), and there is room within the character to trace out the tone contour, so the tune can follow the character. In pop songs, one character per note is the norm, and the tune has no room to yield to the character, so this skill judges bythe interval entering this character(§2); for opera-style melismatic passages, this method will produce false positives (§5.1).
  3. The tunes of local opera genres follow the tone values of the local dialect, when writing lyrics you must take into account the dialect of the genre (《中国戏曲通论》p0257). For lyrics written for a particular genre, or a whole passage borrowing the vocal style of a particular genre, the tones of the characters are judged according to that dialect, not according to Mandarin—this skill only judges Mandarin.

2. ★ The correct model (where the first version went wrong)

What is judged is "the interval by which a character is entered" vs "that character's own tone pattern", notthe relative height of "the previous character's endpoint vs the next character's starting point."

contour  = TONE_PITCH[t][1] - TONE_PITCH[t][0]   # 本字调型:+升 −降 0平
incoming = notes[i] - notes[i - 1]               # 进入本字的音程(半音)

2.1 Why the first version was wrong

The first version judged by relative height, and as a resultmissed the most classic example in the textbooks: the expectation calculated for "深爱→神爱" is +0, so it would never be flagged.

The reason is that in pop songsone character per note is the norm, and there is no tone pattern to speak of within a character—— at this point the listener infers the tone fromthe melodic direction of entry into this character. Entering "深" (yinping, level tone) by an ascending motion makes it heard as yangping = 神.

★ This lesson is worth remembering: When a detector cannot detect the standard textbook case, suspect the model first, not the case.

2.2 The five tones and their constraints

In Yuen Ren Chao's five-level tone marking, take each tone'sstarting pointandendpoint:

Tone Five-level value Tone pattern ★ Constraint
Yinping 1 55 Level Entering it should not have a large leap(a large leap will make a level tone be heard as having a direction)
Yangping 2 35 Rising ★ should not be entered by a descending motion
Shangsheng 3 21 Falling should not be entered by an ascending motion (in connected speechhalf-shangsheng; full shangsheng 214 occurs only in isolated reading and at sentence end)
Qusheng 4 51 Falling ★ should not be entered by an ascending motion
Neutral tone 5 ~3 Level Same as yinping,but with half weight(it is inherently light, short, and easily swallowed)

★★ This is exactly what the old saying means: "Do not set yangping characters to a descending motion, and do not set qusheng characters to an ascending motion."


2.3 ★ How to judge by hand

Check only three types of positions (they are where tone distortion most often occurs, accounting for about 1/5 of all characters):the character on the highest note in each passage, the first character of each sentence, and the landing character of a large leap (≥5 semitones). For each character: look up its tone (§2.2 table) → look at the melodic direction entering it → yangping entered by a descending motion, qusheng entered by an ascending motion, level tone entered by a large leap of ≥3 semitones → mark as risky → read it aloud once。

3. How to judge

Write the lyrics and melody side by side as two lines (character / pitch), check character by character according to the three types of positions in §2.3, and read it aloud once to confirm.

★ After finding risks, first distinguish strict from lenient. Among Xue Fan's eight rules, three are strict (Huang Zhihua, 《文字声律与粤语歌创作》 appendix p0107):

  1. Works closely tied to spoken language and with strong linguistic feel are treated strictly: pop songs, rap, and the like. This rule covers almost all output in this library
  2. Theme lines, climax lines, keywords, and ending lines are treated strictly. This is exactly the additional category to check beyond the three types of positions in §2.3: the position is not high and does not jump, but it is a hook
  3. For two adjacent notes with a large interval and an upward or downward leap, apply the stricter standard. Same rule as the "large-leap landing character" in §2.3

Risks falling under these threemust be changed; the other five lenient cases are in lw-mandarin §3.6; those falling there can be let go and the reason recorded.


4. How to read the results

我深爱你   —— ★ 教科书例:上行大跳进入平调「深」→ 听成「神」
  倒字率 33%  (1/3 对相邻字有风险)
  字      调型    进入    风险   说明
  深       平    +7  0.47 ← 阴平是平调,7 度大跳会带出走向
  爱       降    -2  0.00
  你       降    -1  0.00
Column Meaning
Tone type What contour the character's own tone requires (rising/falling/level)
Entry The actual melodic direction (semitones)
Risk 0–1。The larger the leap, the higher the risk(`min(
Tone-mismatch rate Adjacent character pairs at risk / total pairs

Three scoring rules:

  • Rising tone entered by a downward motion, falling tone entered by an upward motion → risk = magnitude
  • Level tone entered by a leap of ≥3 semitones → risk = magnitude × 0.8
  • Neutral tone → risk × 0.5 again

5. ★★ Three boundaries: don't treat this detector as a judge

This section is the most important part of this skill.

5.1 One character with multiple notes (melisma) is not handled

This tool assumes one character per note. When one character is drawn out over multiple notes,the contour within the character itself can carry the tone type, and the rules differ—— The multi-note case requires note-by-note alignment information, which this method cannot provide.

★ Consequence: For slow songs, lyrical pieces, and passages in operatic style,this tool will produce false positives。

5.2 It does not use context for disambiguation

"Deep love" in "I deeply love you" is almost never misheard, because the context locks in the word. This tool only looks at acoustic-level risk; it does not understand words.

★ Consequence: Common collocations, idioms, and fixed phrases will produce false positives.

5.3 ★ Tone-mismatch risk ≠ wrong

Long notes, stress, and clear articulation can all save it. What is output is "risk," not a "verdict."

⚠ LYR-LINT rule 7 only gives a numerical value; it does not give "pass/fail."

→ Which risks can be let go: the five criteria are in lw-mandarin §3.6; which must be changed: the three are in §3 of this document.

5.4 How to use it overall

★ Treat it as a highlighter, not a judge. It tells you "these characters are worth reading aloud once to listen,"and if reading them aloud is fine, let them go。

Self-check action:

  1. Judge manually according to §2.3 (calculate risk values according to the scoring in §4) → obtain a list of high-risk characters
  2. ★ Sing those lines(or read them aloud)
  3. If it really sounds like another character → change it (§6); if you cannot hear it → in checks.self_audit record a note "manually confirmed"

6. Once risks are marked, five ways to revise

From lowest to highest cost:

# Revision method Cost
1 Replace the character Lowest. Find a synonym with a suitable tone type
2 Adjust word order Low. Move that character to a position where the melodic direction fits
3 Add duration to that character(lengthen it) Medium. ★ After lengthening, the pitch contour can develop within the character itself, and the risk disappears (see §5.1)
4 Change that leap in the melody Medium-high. ★ When the melody comes first and the lyrics after, this is the last resort; when the lyrics come first and the melody after, it is a normal option
5 Accept it —but in checks.self_audit write it instate the reason clearly(e.g. "this deliberate mishearing here is a pun")

★ Rule 1 is always tried first. Chinese has an extremely large number of synonyms, so swapping a character usually solves it, while changing the melody drags in a whole pile of things on the melody, harmony, and arrangement side (those are decisions for composition and arrangement).

★★ Rule 5 is not laziness: real pop songs contain a large number of places that are "technically inverted tones but sound fine" (see §5.2, §5.3).The key is that you know it is there, rather than not having checked.


7. Cantonese: not this tool

★ Cantonese tone-matching is a different matter, and is much stricter.

Mandarin inverted tones Cantonese tone-matching
Number of tones 4 (+ neutral tone) 9
Constraint strength Risk(can be saved) ★ Hard constraint(violating it means a wrong word)
Writing order Lyrics or melody can both come first ★ Melody is fixed first, leaving only a few characters可选 at each position
Judgment method §2.3 manual judgment See lw-cantonese

→ lw-cantonese。Do not substitute the Mandarin set for it.


8. Correspondence with LYR-SPEC fields

Field This skill
prosody.sections[].peak_syllable ★ Which character the highest note falls on—that character's inverted-tone risk must be looked at separately
prosody.sections[].melody_contour Detector input
checks.computed.daozi_rate Detector output
checks.self_audit ★ The manual confirmation in §5.4 step 3 and §6 rule 5 is written here

9. Must pass after use

  • Checked according to §2.3, obtained thenumerical value
  • ★ The high-risk lines have actually been sung/recited through once, not just looking at the numbers
  • For those manually confirmed as fine, in self_audit recordedone sentence
  • For those to be changed,try swapping characters first, and only then touch the melody
  • For passages with one character and multiple notes,know that the detector will false-positive there
  • When a common collocation is flagged red,did not change a word that was originally fine just to make the numbers look good
  • ★ Cantonese did not use this tool as a substitute

Appendix: Sources

  • An adjustable calibration parameter:semitone_per_degree = 2.0 (the coefficient converting the five-level tone values into semitones, "a tone value difference of 1 level ≈ an expected perception of 2 semitones")
  • ⚠ This method does not handle one character with multiple notes; Cantonese tone-matching (§7) has no corresponding judgment method
  • The terms for依字行腔 and inverted tones in opera(§1): Zhang Geng and Guo Hancheng, eds., Zhongguo Xiqu Tonglun, p0257, p0304, p0506; Liu Jidian, Jingju Yinyue Gailun, p0153
  • Thirteen rhymed categories (including the pronunciation used in Peking opera) in lw-mandarin reference §1