-#include <math.h>
-#include <windows.h>
+/*
+ * insert funny copyright notice here
+ * gpl license stuff
+ * yeahh it's colone3wavtool the really cool and functional wavtool for UTAU singing synthesis program :D
+ * gay
+ *
+ */
+
+#include "wavtool.h"
#define LOGFILE L"C:\\projects\\colon3wavtool\\log.txt"
int main(int argc, char *argv[])
{
+ int input_wave_length = 0;
+ int16_t *input_wave = NULL;
//test ver: just like. log the arguments lol!!
log_args(argc, argv);
+
+ //ok.
+ if (argc >= 3) {
+ input_wave_length = readWave(argv[2], NULL);
+ } else { goto error; };
+
+ if (input_wave_length > 0) {
+ input_wave = GlobalAlloc(0, input_wave_length);
+ } else { goto error; }
+
+ if (input_wave != NULL) {
+ readWave(argv[2], input_wave);
+ };
+
+ error:
+ MessageBox(NULL, "Lmao error w", "colon3wavtool errored", MB_OK | MB_ICONWARNING);
return 0;
};
int log_args(int argc, char *argv[])
{
- /* Doesnt work??
- HANDLE hFile;
-
- hFile = CreateFileW(
- LOGFILE, //name of file (*wchar_t)
- GENERIC_WRITE,
- 0, NULL,
- OPEN_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL
- );
-
- char *c = " ";
- DWORD dwWritten;
- for (int i = 1; i < argc; i++) {
- for (int n = 0; (*c = argv[i][n]) != '\0'; n++) {
- WriteFile(
- hFile,
- c,
- 8,
- &dwWritten,
- NULL
- );
- };
- c = " ";
- WriteFile(
- hFile,
- c,
- 8,
- &dwWritten,
- NULL
- );
- };
- c = "\n";
- WriteFile(
- hFile,
- c,
- 8,
- &dwWritten,
- NULL
- );
- */
-
-
+ /*
for (int i = 1; i < argc; i++) {
MessageBoxA(NULL, argv[i], "argument :3", MB_OK);
};
+ */
+ //so im p sure it's like this:
+ //0: program path (obviously)
+ //1: some temp.wav to append the note to (relative. it doesnt exist at first)
+ //2: note wav file (full, not relative)
+ //3-end: some envelope shit idk. Unimportant probably /j
return 1;
--- /dev/null
+#include "wavtool.h"
+
+int readWave(char *filename, int16_t buffer[]) //if buffer is NULL it only returns the length requried???
+{
+ //haha
+ //ok so expect 16-bit samples, and also the length required should be in BYTES
+ HANDLE fp;
+ char *error_msg = "unknown error in reading wave file";
+ fp = CreateFileA(
+ filename,
+ GENERIC_READ,
+ 0,
+ NULL,
+ OPEN_EXISTING, //if it doesnt exist it's bad :>
+ FILE_ATTRIBUTE_NORMAL,
+ NULL
+ );
+
+ if (fp == INVALID_HANDLE_VALUE) {
+ error_msg = "error opening input wave file";
+ goto error;
+ };
+
+ //get file length and load it ig...
+ DWORD filesize = 0;
+ filesize = GetFileSize(fp, NULL);
+ long unsigned int bytes_read = 0;
+ //ok so first the header...
+ char chunk_id[5] = " ";
+ ReadFile(fp, chunk_id, 4, &bytes_read, NULL);
+ if (strcmp("RIFF", chunk_id)) {
+ error_msg = "input wave file not good :<";
+ goto error;
+ };
+
+
+ return 0;
+
+ error:
+ MessageBoxA(NULL, error_msg, "colon3wavtool error :(((", MB_OK | MB_ICONWARNING);
+ return -1;
+
+};
--- /dev/null
+/*
+ * UTAU wavtool in C
+ * gpl v3+ licensed uwu
+ * by parking_turkeys, Copyright 2026
+ *
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdint.h>
+
+struct riff_chunk {
+ char ckID[4];//NOT ZERO TERMINATED
+ uint32_t ckSize;
+ uint8_t ckData[];//length == ckSize
+};
+
+//ok so first read the whole file into a thingy
+int readWave(char *filename, int16_t buffer[]);