DiffSinger Refined Phonemizer Implementation#1840
Conversation
- Add comprehensive G2P dictionary support with replacement types (single, merge, split, many-to-many) - Implement sophisticated phoneme validation and language prefix handling - Add timing-based phoneme processing with duration-dependent modifications - Include word-level phoneme editing capabilities for cross-phoneme modifications - Integrate ONNX machine learning models (linguistic and duration prediction) - Support multi-language models with language ID mapping - Add comprehensive speaker embedding management - Include tensor caching for performance optimization - Implement robust error handling and validation throughout - Add extensive XML documentation for all public APIs This phonemizer provides a robust foundation for DiffSinger voice synthesis with support for complex phoneme transformations and cross-note processing.
Refactored EditTimedPhonemes to accept next note and its first phoneme duration. Updated ProcessPart to collect phoneme timing data in two passes, allowing timing edits with access to neighboring note information
|
Might it make more sense to reverse the order of replacements, or even use the order as listed in the .yaml file for maximum flexibility? For example, this isn't possible if you process single replacements before everything else: replacements:
- {from: [s, p], to: [s, p_]}
- {from: p, to: p_h} |
I don't get what you are trying to say, but this base class follows the replacement order: For more sophisticated or in depth customization, it's better to make inside the phonemizer code |
|
What's the use case of this? |
@yqzhishen you can see it in this PR: #1841 |
|
@overdramatic I don't think these hardcoded linguistic rules are the right philosophy for a machine learning model, which should have context capability. |
|
@yqzhishen can you please tell me what hardcoded linguistic rules do you think it should not be included? Hope this wikipedia page helps you understand why those hardcoded rules is needed: |
|
Please reconsider the decision to close this. It may not seem helpful to languages with simple phonetic rules where everything can be matched precisely to the writing, but the rest of us have been begging for this to merge. |
|
The problem wasn't in G2P; the real problem is that you expected G2P to handle what it shouldn't be responsible for. You proposed 4 categories of linguistic rules:
The PR mainly follows the philosophy of symbolic phonology, proposing explicit knowledge, cascaded inference and universal rules, where correctness is defined by linguists. However, neural acoustics proposes implicit knowledge and end-to-end mapping, where information and context are fundamental concerns, and the behavior is driven by data. I would like to quote Frederick Jelinek, pioneer of modern speech recognition and natural language processing research, for his famous statement,
I hope my explanation help you find the right way to deal with modern singing voice synthesis. |
|
@yqzhishen maybe i'm misunderstanding, but based on the logic being mentioned, shouldn't only the BRAPA phonemizer be denied instead of the API? what if i wanted to set replacements for |
Makes sense, sorry. I will review this when I have time. If there are further discussion around BRAPA, let's move to #1841. |
This isn't entirely correct. I can somewhat agree with point 1. But something like labeling 's' and 'sh' both as 's' just because "the model will learn the difference based on context" feels very silly. When a simple edit in the phonemizer can just turn the 's' into 'sh' BEFORE inference why bother? It's an extremely easy fix and it can be used for multiple languages and multiple use cases, not just BRAPA, and it takes away the guess work for the model (especially when using lower amounts of data). It just gives people more option without having to make an entirely new phonemizer. For example, the new update to the Italian phonemizer broke some things with the previous system, so I'd have to correct all the labels, or I could just use this replacement system (personally I don't agree with the changes, I would prefer the old labeling style). Going back to BRAPA specifically, letting the AI guess things is a bad idea when taking into account that there are different rules in different Brazilian regional dialects (or european Portuguese) that often contradict each other, so this is the best idea, since the alternative would be making many different phonemizers. |
Thank you! |
Updating the timing calculation to proper use millisecond positions instead of tick.
DiffSinger Refined Phonemizer Implementation
Overview
This PR introduces the
DiffSingerRefinedPhonemizer- an abstract base class based onDiffSingerBasePhonemizerandDiffSingerG2pPhonemizer, that provides comprehensive infrastructure for DiffSinger-based phonemizers in OpenUtau. The implementation delivers advanced phoneme processing capabilities with sophisticated phoneme replacement systems based on replacements lists, word-level, timing-based and duration-dependent modificationsKey Features
Benefits
This implementation provides a solid foundation for sophisticated singing synthesis with DiffSinger, supporting complex linguistic phenomena while maintaining performance and extensibility.
Usage
Derive from
DiffSingerRefinedPhonemizerand override:EditPhonemesForWord()for word-level modificationsEditTimedPhonemes()for timing-based transformationsApplyDurationBasedReplacements()for duration-dependent changesFor
dsdict.yamlreplacements:It uses the same rules as
DiffSingerG2pPhonemizerwithfrombeing without the language tag andtowith the tag if the model has multi-dict supportThe phonemizer folows the replacements in logical order: single -> merge -> split -> many-to-many