From 6ec56613fd19af64aebff899a3ed49d8e07674d8 Mon Sep 17 00:00:00 2001 From: parking_turkeys Date: Fri, 28 Aug 2026 10:31:47 -0400 Subject: [PATCH] finish up, fix some bugs, make some stuff faster --- Makefile | 3 +++ appendwave.c | 9 ++++----- main.c | 4 +++- readme.txt | 26 ++++++++++++++++++++++++++ readwave.c | 11 ++++------- 5 files changed, 40 insertions(+), 13 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c7ebce9 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +colon3wavtool.exe: $(wildcard *.c) $(wildcard *.h) + gcc *.c *.h -o colon3wavtool.exe -std=c99 -Wall -Werror + @echo "compiled the wavtool! set tool 1 (append) in UTAU to the path of it to use it" diff --git a/appendwave.c b/appendwave.c index 8243055..63f73c0 100644 --- a/appendwave.c +++ b/appendwave.c @@ -34,8 +34,9 @@ int appendWave(int16_t wave[], int wave_length, char *filename) int writeBlankHeader(char *filename) { FILE *fp; - long unsigned int bytes_written; fp = fopen(filename, "wb"); + + const char riff_id[4] = {'R', 'I', 'F', 'F' }; fwrite(riff_id, 4, 1, fp); @@ -99,19 +100,17 @@ static int editHeaderBecauseFileIsLongerUwU(char *fn) { FILE *fp; fp = fopen(fn, "r+b"); - unsigned long int gay = 0; fseek(fp, 0, SEEK_END); uint32_t filesize = ftell(fp); uint32_t riff_data_size = filesize - 8; uint32_t wave_data_size = filesize - 44; - int errored = 0; - errored = fseek(fp, 4, SEEK_SET); //file size - 8 + fseek(fp, 4, SEEK_SET); //file size - 8 fwrite(&riff_data_size, 4, 1, fp); fseek(fp, 40, SEEK_SET); //wave size - fwrite(&riff_data_size, 4, 1, fp); + fwrite(&wave_data_size, 4, 1, fp); fclose(fp); return 1; }; diff --git a/main.c b/main.c index 1dbc9d9..279ac80 100644 --- a/main.c +++ b/main.c @@ -107,10 +107,12 @@ int log_args(int argc, char *argv[]) return 1; }; -int fix_filename(char *filename) { +int fix_filename(char *filename) +{ for (int i = 0; filename[i] != '\0'; i++) { if (filename[i] == '\\') { filename[i] = '/'; }; }; + return 1; }; diff --git a/readme.txt b/readme.txt index db4b6d0..3f1c1c2 100644 --- a/readme.txt +++ b/readme.txt @@ -10,6 +10,7 @@ under the GPLv3+ and the only thing id change it to would be the other one that makes putting it on a network count as distributing. dw this WILL stay free :D) uhhh it's a wavtool. for UTAU. +(a wavtool in utau stiches the pitch-changed notes together into one whole song :D) not tested with openUtau yet because im too lazy tbh uhh tyty for : @@ -42,6 +43,31 @@ notes on the code: written in C. rn it uses the win32 apis but im going to see if writing it in the normal ones will work lol +*** + +how to COMPILE: +uhh run make. idk it works on my laptop :3 (or just like use a c thing to +compile *.c *.h lol) +*** +how to USE: +haha. step 1: install UTAU. NOT OPENUTAU I HAVENT TESTED IT ON OPENUTAU +> please google this it's REALLY annoying +> also only works on windows lmao +> basically you have to change your locale to japan and stuff +step 2: +> go to project settings -> tool 1 (append) and set that to the path to the + colon3wavtool executable +> select all notes and press play :3 + +IMPORTANT NOTES: +ik utau's default resampler doesnt work on windows 11 idk so that might apply +to this too, i dont have access to windows 11. +uhh im making a demo video bc it's SO annoying to install. yeah :D +DO NOT USE THIS WITH UTAULOIDS WHO USE NON-WAV FILES. this does NOT check +whether a file is WAV before using it because it'd take too long to do that +every single time. +Also, the WAV file has to be formed a specific way but like it probably will... +who actually uses wav files with headers over 44 bytes diff --git a/readwave.c b/readwave.c index d236734..b799f2c 100644 --- a/readwave.c +++ b/readwave.c @@ -26,10 +26,8 @@ int readWave(char *filename, int16_t buffer[], int STP_ms) //if buffer is NULL i }; //get file length and load it ig... - int filesize = 0; - fseek(fp, 0, SEEK_END); - filesize = ftell(fp); - fseek(fp, 0, SEEK_SET); //LMAO I FORGOT THIS SOB + fseek(fp, 40, SEEK_SET); //LMAO I FORGOT THIS SOB + /* ykw who needs to read the header. if utau is giving it to me it'd better be ok long unsigned int bytes_read = 0; //ok so first the header... char chunk_id[5] = " "; @@ -86,7 +84,7 @@ int readWave(char *filename, int16_t buffer[], int STP_ms) //if buffer is NULL i if (strcmp(chunk_id, "data")) { error_msg = "input file does not have data chunk right after fmt chunk"; goto error; - }; + }; */ uint32_t data_length; fread(&data_length, 4, 1, fp); //NOW TO READ THE WAVE wwwwwwwwww @@ -97,8 +95,7 @@ int readWave(char *filename, int16_t buffer[], int STP_ms) //if buffer is NULL i fread(buffer, 2,sample_count - STP_samples, fp); }; if (ferror(fp)) { - perror("Error!"); - report_error("Error", "readWave()", "colon3wavtool"); + goto error; }; fclose(fp); -- 2.47.3