Skip to content

Commit

Permalink
Change how end padding is applied, model JSON now has field to specif…
Browse files Browse the repository at this point in the history
…y it
  • Loading branch information
ZDisket committed Nov 30, 2020
1 parent 2459b8b commit 1914d5c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void Voice::AddPhonemizer(Phonemizer *InPhn)
std::vector<float> Voice::Vocalize(const std::string & Prompt, float Speed, int32_t SpeakerID, float Energy, float F0, int32_t EmotionID)
{

std::string PhoneticTxt = Processor.ProcessTextPhonetic(Prompt,Phonemes,CurrentDict,(ETTSLanguage::Enum)VoxInfo.Language);
std::string PhoneticTxt = Processor.ProcessTextPhonetic(Prompt + VoxInfo.EndPadding,Phonemes,CurrentDict,(ETTSLanguage::Enum)VoxInfo.Language);

TFTensor<float> Mel = MelPredictor.DoInference(PhonemesToID(PhoneticTxt), SpeakerID, Speed, Energy, F0,EmotionID);

Expand Down
3 changes: 2 additions & 1 deletion VoxCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ VoiceInfo VoxUtil::ReadModelJSON(const std::string &InfoFilename)
JS["note"].get<std::string>(),
JS["sarate"].get<uint32_t>(),
Lang,
LanguageNames[Lang]};
LanguageNames[Lang],
" " + JS["pad"].get<std::string>()}; // Add a space for separation since we directly append the value to the prompt

if (Inf.Note.size() > MaxNoteSize)
Inf.Note = Inf.Note.substr(0,MaxNoteSize);
Expand Down
2 changes: 2 additions & 0 deletions VoxCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ struct VoiceInfo{
uint32_t Language;
std::string s_Language;

std::string EndPadding;



};
Expand Down
10 changes: 2 additions & 8 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ void MainWindow::on_btnInfer_clicked()
on_btnLoad_clicked();




// Convert to lowercase here before we add phonemes
QString BeforeInput = ui->edtInput->toPlainText();
QString RawInput = BeforeInput;
Expand All @@ -189,11 +187,6 @@ void MainWindow::on_btnInfer_clicked()








QStringList InputSplits;
QStringList BeforeSplits;

Expand Down Expand Up @@ -251,7 +244,7 @@ void MainWindow::on_btnInfer_clicked()
Dets.Speed = RangeToFloat(ui->sliSpeed->value());
Dets.Energy = RangeToFloat(ui->sliEnergy->value());
Dets.pItem = widItm;
Dets.Prompt = idvInput + " @SIL @END";
Dets.Prompt = idvInput;
Dets.SpeakerID = 0;
Dets.EmotionID = -1;
Dets.Denoise = ui->chkDenoise->isChecked();
Expand Down Expand Up @@ -322,6 +315,7 @@ void MainWindow::PlayBuffer(QBuffer *pBuff,bool ByUser)

pBuff->open(QBuffer::ReadWrite);


StdOutput->start(pBuff);
CanPlayAudio = false;

Expand Down
4 changes: 2 additions & 2 deletions phoneticdict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ bool PhoneticDict::Import(const QString &infn)


if (fi.GetFileLength() == 0){
fi.Close();
return true;
fi.Close();
return true;

}

Expand Down

0 comments on commit 1914d5c

Please sign in to comment.