forked from ShuhuaGao/vchsm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
43 lines (41 loc) · 1.54 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <cstdio>
#include "../include/vchsm/train_C.h"
#include "../include/vchsm/convert_C.h"
#define VERBOSE_TRUE 1
#define VERBOSE_FALSE 0
int main()
{
// NOTE: change the following directories for the data files according to your actual path.
// train a model with the given 20 source and target speaker's audios
// the audios files are named from 1 to 20
const char* sourceAudioDir = "E:/GitHub/vchsm/Audios/source_train/";
const char* targetAudioDir = "E:/GitHub/vchsm/Audios/target_train/";
const int numTrainSamples = 20;
const char* sourceAudioList[numTrainSamples];
const char* targetAudioList[numTrainSamples];
for (int i = 0; i < numTrainSamples; ++i)
{
char* buff = new char[100];
std::sprintf(buff, "%s%d.wav", sourceAudioDir, i + 1);
sourceAudioList[i] = buff;
buff = new char[100];
std::sprintf(buff, "%s%d.wav", targetAudioDir, i + 1);
targetAudioList[i] = buff;
}
// model file to be generated
const char* modelFile = "E:/GitHub/vchsm/models/Model.dat";
// start training
trainHSMModel(sourceAudioList, targetAudioList, numTrainSamples, 4, modelFile, VERBOSE_TRUE);
// deallocate
for (int i = 0; i < numTrainSamples; ++i)
{
delete[] sourceAudioList[i];
delete[] targetAudioList[i];
}
// perform conversion
const char* testAudio = "E:/GitHub/vchsm/Audios/test/jal_in_42_3.wav";
const char* testAudioConverted = "E:/GitHub/vchsm/Audios/test/jal_in_42_3_c.wav";
convertSingle(modelFile, testAudio, testAudioConverted, VERBOSE_TRUE);
// now we can compare the above audio before and after conversion
std::getchar();
}