Skip to content

fix(EnglishCpVPhonemizer): assign this.singer before ReadDictionaryAndInit#2060

Open
yaaayaaa wants to merge 1 commit intostakira:masterfrom
yaaayaaa:fix/cpv-setsinger-init-order
Open

fix(EnglishCpVPhonemizer): assign this.singer before ReadDictionaryAndInit#2060
yaaayaaa wants to merge 1 commit intostakira:masterfrom
yaaayaaa:fix/cpv-setsinger-init-order

Conversation

@yaaayaaa
Copy link
Copy Markdown

Problem

EnglishCpVPhonemizer.SetSinger() calls ReadDictionaryAndInit() before
assigning this.singer. ReadDictionaryAndInit() loads the base dictionary
which references singer.Found — a NullReferenceException is thrown,
caught silently inside ReadDictionary, leaving dict null.

Subsequent Process() calls then return a single empty-string phoneme
for every input.

Repro

Build OpenUtau.Test and run:

var phonemizer = new EnglishCpVPhonemizer();
phonemizer.SetSinger(anyLoadedSinger);  // dict stays null
var result = phonemizer.Process(note, ...);  // returns [""]

Fix

Swap the two lines in SetSinger so this.singer is set before init.

Impact

Makes EnglishCpVPhonemizer actually work in headless test environments
and any scenario where ReadDictionaryAndInit runs before a real Process.

Discovered during conformance testing against an en_liee voicebank.
Prior to this fix, tests had to use a reflection workaround to set
this.singer before invoking SetSinger.

ReadDictionaryAndInit calls LoadBaseDictionary which references
singer.Found. Without the assignment first, the init-time NPE is
caught silently by ReadDictionary and the phonemizer's dictionary
stays null, causing Process to return [""] for every input.

Symptom: EnglishCpVPhonemizer returns empty phoneme lists in any
environment where SetSinger is called before the first Process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant