From: parking_turkeys Date: Fri, 30 Oct 2026 15:01:49 +0000 (-0400) Subject: fixed some bugs. rlly annoying new bug with the UST processing apparently not wrokign X-Git-Url: http://git.p-t.hackclub.app/?a=commitdiff_plain;h=177cd9dfa875c5774b0bfb418f4fdf615455f4e1;p=colon3utau.git fixed some bugs. rlly annoying new bug with the UST processing apparently not wrokign --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e1e0942 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +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" diff --git a/render/render.h b/render/render.h index cc22060..a9aa6cf 100644 --- a/render/render.h +++ b/render/render.h @@ -15,7 +15,7 @@ #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 */ diff --git a/render/tools.c b/render/tools.c index 29dd34f..ced0ca6 100644 --- a/render/tools.c +++ b/render/tools.c @@ -5,12 +5,13 @@ static int call_resampler(struct USTinfo *ust_settings, struct USTnote *note, st 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); @@ -21,11 +22,14 @@ int call_resampler(USTinfo *s, USTnote *n, struct oto_line *o) { //resampler // - 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; @@ -36,18 +40,31 @@ int call_resampler(USTinfo *s, USTnote *n, struct oto_line *o) 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) @@ -57,21 +74,33 @@ 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); }; @@ -95,6 +124,7 @@ struct oto_line *find_oto_line(char *oto_dir, char *lyric) 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) { diff --git a/render/ust_process.c b/render/ust_process.c index 27d36d1..e8a0570 100644 --- a/render/ust_process.c +++ b/render/ust_process.c @@ -24,13 +24,13 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST) 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, @@ -54,8 +54,8 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST) }; - struct USTinfo *settings = {0}; - *settings = (struct USTinfo){ + USTinfo settings = /*{0}; + *settings = (struct USTinfo)*/{ 120.0, 1, "New Project", @@ -66,13 +66,14 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST) 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': @@ -81,12 +82,13 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST) 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; @@ -94,7 +96,7 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST) break; }; break; - case MODE_HEADING: + case MODE_HEADING: switch (c) { case '#': break; @@ -103,6 +105,7 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST) break; case ']': buffer[i] = '\0'; + i = 0; if (strcmp(buffer, "VERSION") == 0) { curr_heading = HEADING_VERSION; } else if (strcmp(buffer, "SETTING") == 0) { @@ -111,9 +114,9 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST) //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; @@ -122,9 +125,9 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST) 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; }; }; @@ -281,6 +284,7 @@ int process_keyval(FILE *fp, char *key, char *value) }; }; value[i] = '\0'; + mode = MODE_NEW_LINE; return 1; }; diff --git a/test/colon3sampler b/test/colon3sampler new file mode 100755 index 0000000..a09c186 Binary files /dev/null and b/test/colon3sampler differ diff --git a/test/colon3wavtool b/test/colon3wavtool new file mode 100755 index 0000000..83605a1 Binary files /dev/null and b/test/colon3wavtool differ diff --git a/test/test-utf-8.ust b/test/test-utf-8.ust new file mode 100644 index 0000000..49fae59 --- /dev/null +++ b/test/test-utf-8.ust @@ -0,0 +1,168 @@ +[#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] diff --git a/test/test.ust b/test/test.ust new file mode 100644 index 0000000..0367318 --- /dev/null +++ b/test/test.ust @@ -0,0 +1,168 @@ +[#VERSION] +UST Version1.2 +[#SETTING] +Tempo=120.00 +Tracks=1 +ProjectName=New Project +VoiceDir=%VOICE%d‰¹ƒeƒg‰¹ºƒ‰ƒCƒuƒ‰ƒŠ[ +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] diff --git a/useful.c b/useful.c index 372ef40..3d1e186 100644 --- a/useful.c +++ b/useful.c @@ -170,8 +170,28 @@ const char *midi_key[128] = { "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; +}; diff --git a/utau.h b/utau.h index 7083112..7a788c1 100644 --- a/utau.h +++ b/utau.h @@ -28,12 +28,12 @@ int ask_for_input(char *prompt, char *buffer, int MAX_INPUT); 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[]);