--- /dev/null
+linux: $(wildcard *.c) $(wildcard *.h) $(wildcard render/*.c) \
+ $(wildcard render/*.h)
+ gcc *.c *.h render/*.c render/*.h -std=c99 -o \
+ colon3utau -lm -D LINUX -Wall -Wno-unused-label
+ @echo "compiled without .exe"
+
+win: $(wildcard *.c) $(wildcard *.h) $(wildcard render/*.c) \
+ $(wildcard render/*.h)
+ gcc *.c *.h render/*.c render/*.h -std=c99 -o \
+ colon3utau -lm -D WINDOWS
+ @echo "compiled with .exe"
#ifdef LINUX
#define DEFAULT_WAVTOOL "./test/colon3wavtool"
#define DEFAULT_RESAMPLER "./test/colon3sampler"
-#define DEFAULT_VOICEBANK "/home/p-t/voice/teto/cv"
+#define DEFAULT_VOICEBANK "/home/p-t/Documents/voice/teto/cv-utf-8"
#endif /* LINUX */
struct oto_line *find_oto_line(char *oto_dir, char *lyric);
-static char curr_note_file[10]; // n0000.wav\0
+static char curr_note_file[64] = {'\0'}; // n0000.wav\0
static int notes_done = 0;
int process_note (struct USTinfo *settings, struct USTnote *note)
{
struct oto_line *oto = find_oto_line(settings->voicedir, note->lyric);
+ ä("found the oto!", "process_note()");
call_resampler(settings, note, oto);
call_wavtool (settings, note, oto);
{
//resampler <in> <out> <midi> <velocity> <flags> <oto[1]> <length>
//<oto[2]> <oto[3]> <volume> <modulation> <!tempo> <pitchbend>
- sprintf(curr_note_file, "n%04d.wav", notes_done);
+ sprintf(curr_note_file, "/home/p-t/projects/colon3utau/test/n%04d.wav", notes_done);
notes_done++;
+ ä("setup note file!", "call_resampler()");
char *resampler = s->resampler;
- char *infile = o->filename;
- char *outfile = "out.wav";
+ int infile_len_req = add_path(s->voicedir, o->filename, NULL);
+ char *infile = malloc(infile_len_req);
+ add_path(s->voicedir, o->filename, infile);
+ char *outfile = curr_note_file;
char *midi = midi_int_to_text(n->midinote);
float vel = n->velocity;
char *flags = n->flags;
int volume = n->intensity;
float modu = n->modulation;
float tempo = s->tempo;
+ ä("setup arguments!", "call_resampler()");
/* Do pitchbend later */
int len_req = snprintf( NULL, 0,
"\"%s\" \"%s\" \"%s\" %s %f \"%s\" %f %d %f %f %d %f %f",
resampler, infile, outfile, midi, vel, flags, oto1, len,
oto2, oto3, volume, modu, tempo);
+ ä("got length required!!", "call_resampler()");
+;
+ int error = system(call_string);
char *call_string = malloc(len_req + 3);
+ ä("allocated string for calling resampler", "call_resampler()");
snprintf(call_string, len_req + 1,
"\"%s\" \"%s\" \"%s\" %s %f \"%s\" %f %d %f %f %d %f %f",
resampler, infile, outfile, midi, vel, flags, oto1, len,
oto2, oto3, volume, modu, tempo);
- system(call_string);
+ ä("wrote string for calling resampler", "call_resampler()");
+ ä(call_string, "call_resampler()");
+ int error = system(call_string);
+ if (error == -1) {
+ ä("error in calling resampler!!! :(", "call_resampler()");
+ };
+ fprintf(stderr, "resampler return: %d", error);
+ ä("called resampler!", "call_resampler()");
+ free(call_string);
};
int call_wavtool (struct USTinfo *s, struct USTnote *n, struct oto_line *o)
//1. get all the parts :D
char *wavtool_path = s->wavtool;
char *outfile_path = "temp.wav";
- char *infile_path = "out.wav";
+ char *infile_path = curr_note_file;
float offset = o->offset;
int length = n->length;
float *e = n->envelope;
+ ä("got parts", "call_wavtool()");
//2. make string
int len_req = snprintf( NULL, 0,
"\"%s\" \"%s\" \"%s\" %f %d %f %f %f %f %f %f %f %f %f %f",
wavtool_path, outfile_path, infile_path, offset, length,
e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9]);
- char *call_string = malloc(len_req + 3);
+ ä("got length required", "call_wavtool()");
+ char *call_string = malloc(len_req + 3); /* Failing???? */
+ /* Oh no am i out of memory or smth... */
+ /* idt so... */
+ /* ok it's also not actually calling resampler or it's failing... that
+ * might be my resampler tho
+ *
+ * yea it's my resampler loll time to find one that works
+ *
+ * ok actually no im processing the UST wrong... skulk */
+ ä("allocated string", "call_wavtool()");
snprintf(call_string, len_req + 1,
"\"%s\" \"%s\" \"%s\" %f %d %f %f %f %f %f %f %f %f %f %f",
wavtool_path, outfile_path, infile_path, offset, length,
e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9]);
- system(call_string);
+ int error = system(call_string);
+ free(call_string);
};
sprintf(oto_path, "%s/oto.ini", oto_dir);
fp = fopen(oto_path, "r");
+ free(oto_path);
char c; int f = 0; int i = 0; int p = 0; /* p is the part */
while ((c = getc(fp)) != EOF) {
FILE *fp;
fp = fopen(UST, "r");
if (fp == NULL) goto error;
- printf("got UST");
+ ä("got UST", "process_ust()");
- char c;
+ char c = ' ';
int i = 0;
char buffer[256];
- struct USTnote *curr_note = {0};
- *curr_note = (struct USTnote) {
+ USTnote curr_note = /* {0};
+ *curr_note = (struct USTnote)*/ {
0,
NULL,
60,
};
- struct USTinfo *settings = {0};
- *settings = (struct USTinfo){
+ USTinfo settings = /*{0};
+ *settings = (struct USTinfo)*/{
120.0,
1,
"New Project",
1
};
- while ((true) && ((c = getc(fp)) != EOF)) {
-
- switch (mode) {
- case MODE_NEW_LINE:
+ while ((1) && ((c = getc(fp)) != EOF)) {
+ char charthing[2] = {c, '\0'};
+ ä(charthing, "process_ust()");
+switch (mode) {
+ case MODE_NEW_LINE:
switch (c) {
case '[':
- printf("new heading!!");
+ ä("new heading!!", "process_ust()");
mode = MODE_HEADING;
break;
case '\n':
fseek(fp, -1, SEEK_CUR);
switch (curr_heading) {
case HEADING_VERSION:
+ fseek(fp, 1, SEEK_CUR);
break;
case HEADING_SETTINGS:
- add_ust_setting(fp, settings);
+ add_ust_setting(fp, &settings);
break;
case HEADING_NOTE:
- add_note_setting(fp, curr_note);
+ add_note_setting(fp, &curr_note);
break;
default:
break;
break;
};
break;
- case MODE_HEADING:
+ case MODE_HEADING:
switch (c) {
case '#':
break;
break;
case ']':
buffer[i] = '\0';
+ i = 0;
if (strcmp(buffer, "VERSION") == 0) {
curr_heading = HEADING_VERSION;
} else if (strcmp(buffer, "SETTING") == 0) {
//do nothing
} else {
curr_heading = HEADING_NOTE;
- if (curr_note) {
- printf("time to process a note!!");
- process_note(settings, curr_note);
+ if (&curr_note != NULL) {
+ ä("time to process a note!!", "ust_process()");
+ process_note(&settings, &curr_note);
};
};
break;
break;
};
break;
- default:
- printf("v strange error, why is mode not what it should be?? (ust_process.c)");
- break;
+ default:
+ ä("v strange error, why is mode not what it should be??", "ust_process.c");
+ break;
};
};
};
};
value[i] = '\0';
+ mode = MODE_NEW_LINE;
return 1;
};
--- /dev/null
+[#VERSION]
+UST Version1.2
+[#SETTING]
+Tempo=120.00
+Tracks=1
+ProjectName=New Project
+VoiceDir=%VOICE%重音テト音声ライブラリー
+OutFile=
+CacheDir=test.cache
+Tool1=D:\projects\colon3wavtool\colon3wavtool.exe
+Tool2=resampler.exe
+Mode2=True
+[#0000]
+Length=480
+Lyric=ど
+NoteNum=60
+PreUtterance=
+Intensity=100
+Modulation=0
+[#0001]
+Length=480
+Lyric=れ
+NoteNum=62
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0002]
+Length=480
+Lyric=み
+NoteNum=64
+PreUtterance=94
+VoiceOverlap=35
+Velocity=70
+Intensity=100
+Modulation=0
+Flags=g10
+StartPoint=30
+Envelope=51,0,35,43,106,100,0,%,0,0
+VBR=95.5,180,35,20,20,0.0,0,39
+[#0003]
+Length=480
+Lyric=ふぁ
+NoteNum=65
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43;0.0
+PBW=84,53,10,16,19,15,19,17,10,10,10,10,10,19,15,19,115
+PBY=0.0,2.5,0.7,0.0,5.7,8.8,13.2,15.0,8.8,8.2,3.2,-0.6,-8.7,-2.5,-1.2,-19.3,0.0
+PBM=,,s,s,s,s,s,s,s,s,s,s,s,s,s,,
+[#0004]
+Length=480
+Lyric=そ
+NoteNum=67
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-45;0.0
+PBW=89,80,125,53,134,0
+PBY=0.0,-0.6,-18.7,-14.3,30.7,0.0
+PBM=,,,,,
+[#0005]
+Length=480
+Lyric=ら
+NoteNum=69
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-45
+PBW=89
+Envelope=0,139,0,0,190,105,40,%,70,209,41
+[#0006]
+Length=480
+Lyric=てぃ
+NoteNum=71
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-45
+PBW=89
+StartPoint=800
+[#0007]
+Length=480
+Lyric=ど
+NoteNum=72
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0008]
+Length=480
+Lyric=R
+NoteNum=60
+PreUtterance=
+[#0009]
+Length=480
+Lyric=ど
+NoteNum=72
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0010]
+Length=480
+Lyric=てぃ
+NoteNum=71
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0011]
+Length=480
+Lyric=ら
+NoteNum=69
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-45
+PBW=89
+[#0012]
+Length=480
+Lyric=そ
+NoteNum=67
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-45
+PBW=89
+[#0013]
+Length=480
+Lyric=ふぁ
+NoteNum=65
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0014]
+Length=480
+Lyric=み
+NoteNum=64
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0015]
+Length=480
+Lyric=れ
+NoteNum=62
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0016]
+Length=480
+Lyric=ど
+NoteNum=60
+PreUtterance=
+Intensity=100
+Modulation=0
+[#TRACKEND]
--- /dev/null
+[#VERSION]
+UST Version1.2
+[#SETTING]
+Tempo=120.00
+Tracks=1
+ProjectName=New Project
+VoiceDir=%VOICE%\8fd\89¹\83e\83g\89¹\90º\83\89\83C\83u\83\89\83\8a\81[
+OutFile=
+CacheDir=test.cache
+Tool1=D:\projects\colon3wavtool\colon3wavtool.exe
+Tool2=resampler.exe
+Mode2=True
+[#0000]
+Length=480
+Lyric=\82Ç
+NoteNum=60
+PreUtterance=
+Intensity=100
+Modulation=0
+[#0001]
+Length=480
+Lyric=\82ê
+NoteNum=62
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0002]
+Length=480
+Lyric=\82Ý
+NoteNum=64
+PreUtterance=94
+VoiceOverlap=35
+Velocity=70
+Intensity=100
+Modulation=0
+Flags=g10
+StartPoint=30
+Envelope=51,0,35,43,106,100,0,%,0,0
+VBR=95.5,180,35,20,20,0.0,0,39
+[#0003]
+Length=480
+Lyric=\82Ó\82\9f
+NoteNum=65
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43;0.0
+PBW=84,53,10,16,19,15,19,17,10,10,10,10,10,19,15,19,115
+PBY=0.0,2.5,0.7,0.0,5.7,8.8,13.2,15.0,8.8,8.2,3.2,-0.6,-8.7,-2.5,-1.2,-19.3,0.0
+PBM=,,s,s,s,s,s,s,s,s,s,s,s,s,s,,
+[#0004]
+Length=480
+Lyric=\82»
+NoteNum=67
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-45;0.0
+PBW=89,80,125,53,134,0
+PBY=0.0,-0.6,-18.7,-14.3,30.7,0.0
+PBM=,,,,,
+[#0005]
+Length=480
+Lyric=\82ç
+NoteNum=69
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-45
+PBW=89
+Envelope=0,139,0,0,190,105,40,%,70,209,41
+[#0006]
+Length=480
+Lyric=\82Ä\82¡
+NoteNum=71
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-45
+PBW=89
+StartPoint=800
+[#0007]
+Length=480
+Lyric=\82Ç
+NoteNum=72
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0008]
+Length=480
+Lyric=R
+NoteNum=60
+PreUtterance=
+[#0009]
+Length=480
+Lyric=\82Ç
+NoteNum=72
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0010]
+Length=480
+Lyric=\82Ä\82¡
+NoteNum=71
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0011]
+Length=480
+Lyric=\82ç
+NoteNum=69
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-45
+PBW=89
+[#0012]
+Length=480
+Lyric=\82»
+NoteNum=67
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-45
+PBW=89
+[#0013]
+Length=480
+Lyric=\82Ó\82\9f
+NoteNum=65
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0014]
+Length=480
+Lyric=\82Ý
+NoteNum=64
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0015]
+Length=480
+Lyric=\82ê
+NoteNum=62
+PreUtterance=
+Intensity=100
+Modulation=0
+PBS=-43
+PBW=84
+[#0016]
+Length=480
+Lyric=\82Ç
+NoteNum=60
+PreUtterance=
+Intensity=100
+Modulation=0
+[#TRACKEND]
"C9", "C#9", "D9", "D#9", "E9", "F9", "F#9", "G9"
};
-char *midi_int_to_text(int midi) {
+char *midi_int_to_text(int midi)
+{
return midi_key[midi];
};
+int add_path(char *d, char *f, char b[])
+{
+ int b_i = 0;
+ int i = 0;
+ for (i = 0; d[i] != '\0'; i++) {
+ if (b) b[b_i] = d[i];
+ b_i++;
+ };
+ if (d[i-1] != '/') {
+ if (b) b[b_i] = '/';
+ b_i++;
+ };
+ for (i = 0; f[i] != '\0'; i++) {
+ if (b) b[b_i] = f[i];
+ b_i++;
+ };
+ if (b) b[b_i] = '\0';
+ return b_i + 3;
+};
int same(char *a, char *b);
int midi_text_to_int(char *midi);
char *midi_int_to_text(int midi);
+int add_path(char *dir, char *file, char *b);
//base64.c
int encode_pitch_array_base_64(char buffer[],int data[], int data_length);
char *encode_int_to_base64(int input);
-
//render
int Render(int argc, char *argv[]);