How L & N and ClearPair score pronunciation

I built L & N because I mix up the two sounds myself. That gave me a very specific problem to solve: if I am practising light and say night, the app should tell me what happened. It should not congratulate me because most of the word was close enough.

A simple spelling comparison illustrates the trap. Light and night differ by one letter out of five. Normalized edit similarity gives them 80%. That is a reasonable description of their spelling and a poor answer to the exercise. The one difference is the whole point.

L & N and my newer ClearPair apps approach this with different acoustic methods. Both need to keep word recognition separate from evidence about the sound being practised. Here is how that works, and where I would still be cautious about a score.

These notes describe the October 7 source. Some ClearPair refinements are in a build under store review, so an installed release may not yet include every detail below.

Recognizing a word and assessing a sound

A speech recognizer answers something like, “Which words best explain this recording?” That is useful, but it is not the same question as, “Did this person make the intended contrast?”

For a minimal-pair exercise, I want three pieces of information: whether the recording is usable, which word the recognizer returned, and whether the relevant part of the audio resembles one member of the pair more than the other.

Those observations can disagree. Keeping the transcript visible lets a learner notice a recognition mistake instead of interpreting every low score as a problem with their speech. It also prevents the app from silently replacing a surprising answer with the word it expected.

In L & N, a resolved transcript leads the L/N label. Acoustic evidence contributes to the score. If the recognizer clearly returns the other word in the pair, recognition credit is capped at 30 and the final score at 45. The shared letters cannot turn that attempt into a success.

These are designed feedback rules, not a claim that 45 means a 45% probability of correct pronunciation.

L & N listens closely to the beginning

The onset model examines a short window around the beginning of speech. At 16 kHz, it takes 300 milliseconds of audio, including a 40-millisecond lead-in before the detected onset. Keeping a little audio before the detected start helps avoid discarding a quiet consonant.

The recording becomes a small log-mel representation: 25-millisecond frames, a 10-millisecond hop, 40 frequency bands and 28 time steps. Two small convolutional layers look for patterns in that patch. The network has roughly 9,000 parameters, so this part does not need a large language model.

The scorer blends that output with a simpler acoustic comparison. Low signal quality pulls the evidence toward uncertainty rather than making a quiet recording look confidently wrong. Word recognition remains a separate observation.

The important limitation is in the training data: most training speech came from one English-speaking lecturer. Holding out entire recordings is better than mixing adjacent clips into training and testing, but it still does not establish performance on new speakers, learner accents or Mandarin and Cantonese speech. I would not turn that experiment into a universal accuracy percentage.

ClearPair compares both sides of a pair

ClearPair covers more contrasts, including L/R and different vowels, endings and tones. Its reference-comparison path asks how a recording relates to both displayed alternatives.

The feature extractor divides audio into short overlapping frames and represents their spectral shape with cepstral features. Dynamic time warping aligns those sequences when two people take different amounts of time to say a word. The alignment has bounds and penalties; it cannot stretch or skip arbitrary amounts of audio for free.

That gives two distances: one to the target reference and one to its partner. A small target distance is useful, but not sufficient. If both references sound nearly identical to the comparison, the app has little basis for deciding between them.

There is another trap here. In light and right, much of the word is shared. Averaging similarity over the whole word can bury the short initial difference under a long matching vowel.

The focused comparison aligns the reference pair, finds where they differ within the exercise’s intended region, and gives that region more weight. Both alternatives participate symmetrically. Selecting one as the target must not give it an easier alignment.

For an eligible focused comparison, the intermediate calculation can be summarized as:

margin = (distance_to_partner - distance_to_target)
         / max(0.15, reference_separation)

contrast_index = sigmoid(4 × clamp(margin, -4, 4))

A positive margin favours the target. A margin near zero means that this comparison does not separate the two clearly. The reference scorer combines this with reference fit; the word-feedback layer then handles recognition, disagreement and score caps. This is an intermediate practice index, not the final score or a calibrated probability.

Reference quality matters too. A synthetic voice can produce an unexpected reading, and one voice cannot stand in for every acceptable accent. A sophisticated comparison cannot rescue a bad reference.

When the evidence disagrees

ClearPair’s word-feedback layer retains the recognizer’s actual text. A confident spelling match is not allowed to invent an acoustic measurement. If only word identity is available, sound distances remain absent rather than becoming a perfect zero-distance match.

The reverse case matters as well. A recognizer can collapse two pronunciations to the same spelling. When an independently measured sound contrast is strong enough, the app can retain that evidence while marking the disagreement and limiting the score. It does not rewrite the transcript to make the two observations agree.

Tones need their own treatment. If two isolated level tones are each centered around their own pitch, both can look flat. That does not establish whether one was high and the other low. ClearPair’s register comparison needs usable surrounding speech as a same-speaker baseline; it cannot infer absolute register from two normalized flat lines.

The recording path is part of the algorithm

One L & N Android problem was less glamorous than model design: the waveform recorder and native recognizer could compete for audio input. Android’s audio-input sharing rules make this worth checking before blaming an acoustic model.

The Android repair uses one WebView recording for playback and acoustic analysis, with online word recognition only after consent. In that Android path, an empty transcript does not create a pronunciation score or history entry. Other platform paths differ; “all processing is offline” would be an inaccurate description of L & N.

For someone building a similar tool, I would test the opposite word, silence, noise, quiet speech and repeated record/cancel cycles before polishing the score display. Then test unfamiliar speakers and words, with independent human judgments. Passing synthetic-audio regressions tells you the implementation behaves consistently on those fixtures. It does not tell you how accurately it judges a learner.

What I want from a practice session

I want to hear a contrast, try it, replay my recording and understand the feedback. The number is useful only if it helps me decide what to try next.

L & N also keeps listening practice separate from speaking. In a listening round, the app knows which clip it played and compares that with my answer. No speech recognizer is needed. Getting better at hearing a new example is a different result from getting a higher score on a word I have repeated twenty times.

If L/N is your difficult pair, L & N is on the App Store and Google Play. For English L/R, ClearPair L & R is on Google Play. I build both. Start with the pair you actually confuse, not a bigger collection of exercises than you need.

Leave a Reply