├── .gitignore ├── UML.vsdx ├── lure.wav ├── .gitmodules ├── executables ├── lure └── lure.exe ├── makefile ├── LICENCE ├── README.md └── src └── main.c /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | *.o 3 | lure 4 | !lure 5 | -------------------------------------------------------------------------------- /UML.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kishlay-notabot/perpetual-energy-machine/HEAD/UML.vsdx -------------------------------------------------------------------------------- /lure.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kishlay-notabot/perpetual-energy-machine/HEAD/lure.wav -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/SAM"] 2 | path = src/SAM 3 | url = https://github.com/vidarh/SAM.git 4 | -------------------------------------------------------------------------------- /executables/lure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kishlay-notabot/perpetual-energy-machine/HEAD/executables/lure -------------------------------------------------------------------------------- /executables/lure.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kishlay-notabot/perpetual-energy-machine/HEAD/executables/lure.exe -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | 2 | CC = gcc 3 | 4 | lure: samlib.o src/main.c 5 | $(CC) -o lure $(CFLAGS) src/main.c samlib.o 6 | 7 | pull: 8 | git submodule update --init 9 | 10 | samlib.o: reciter.o sam.o render.o processframes.o createtransitions.o debug.o 11 | ld -r -o samlib.o processframes.o createtransitions.o reciter.o sam.o render.o debug.o 12 | 13 | %.o: src/SAM/src/%.c 14 | $(CC) $(CFLAGS) -c $< 15 | 16 | clean: 17 | rm *.o 18 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # perpetual-energy-machine 2 | 3 | [https://www.reddit.com/r/ProgrammerHumor/comments/1csgw6d/] 4 | 5 | I hope my personal projects could get atleast 10 percent of the traction this piece of shit has got >:-( 6 | 7 | Users are free to submit design iterations, ideas and feedback to improve this machine's efficiency and raise issues to highlight problems which could be faced. Credit to the original innovation by @mcharytoniuk 8 | 9 | These machine blueprints can be utilized to solve market crises, demand and supply can be equalized. If you suffer from too much competition, install this using our blueprint and developers would be utilized for noble cause. 10 | 11 | If you are here then welcome please star the repo and suscrib ![image](https://github.com/Kishlay-notabot/perpetual-energy-machine/assets/67735128/2033170d-13e8-4ac3-a4a4-3a5871d8d610) 12 | 13 | ![rust](https://github.com/sysadminmann/perpetual-energy-machine/assets/148331787/c234a842-83ad-4949-b1b8-4b200467741a) 14 | 15 | improvements from v1.0 16 | 17 | ![image](https://github.com/sysadminmann/perpetual-energy-machine/assets/148331787/7d22fe77-19c9-4e15-937e-cff0e0e9cdee) 18 | 19 | **INCLUDES .EXE** no smelly nerds here! 20 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "SAM/src/reciter.h" 7 | #include "SAM/src/sam.h" 8 | #include "SAM/src/debug.h" 9 | 10 | // taken from SAM/src/main.c 11 | 12 | int debug = 0; 13 | 14 | // Approximations of some Windows functions to ease portability 15 | #if defined __GNU_LIBRARY__ || defined __GLIBC__ 16 | static int min(int l, int r) { return l < r ? l : r; } 17 | static void strcat_s(char * dest, int size, char * str) { 18 | unsigned int dlen = strlen(dest); 19 | if (dlen >= size-1) return; 20 | strncat(dest+dlen, str, size - dlen - 1); 21 | } 22 | void fopen_s(FILE ** f, const char * filename, const char * mode) { 23 | *f = fopen(filename,mode); 24 | } 25 | #endif 26 | 27 | void WriteWav(char* filename, char* buffer, int bufferlength) { 28 | unsigned int filesize; 29 | unsigned int fmtlength = 16; 30 | unsigned short int format = 1; //PCM 31 | unsigned short int channels = 1; 32 | unsigned int samplerate = 22050; 33 | unsigned short int blockalign = 1; 34 | unsigned short int bitspersample = 8; 35 | 36 | FILE *file; 37 | fopen_s(&file, filename, "wb"); 38 | if (file == NULL) return; 39 | //RIFF header 40 | fwrite("RIFF", 4, 1,file); 41 | filesize=bufferlength + 12 + 16 + 8 - 8; 42 | fwrite(&filesize, 4, 1, file); 43 | fwrite("WAVE", 4, 1, file); 44 | 45 | //format chunk 46 | fwrite("fmt ", 4, 1, file); 47 | fwrite(&fmtlength, 4, 1, file); 48 | fwrite(&format, 2, 1, file); 49 | fwrite(&channels, 2, 1, file); 50 | fwrite(&samplerate, 4, 1, file); 51 | fwrite(&samplerate, 4, 1, file); // bytes/second 52 | fwrite(&blockalign, 2, 1, file); 53 | fwrite(&bitspersample, 2, 1, file); 54 | 55 | //data chunk 56 | fwrite("data", 4, 1, file); 57 | fwrite(&bufferlength, 4, 1, file); 58 | fwrite(buffer, bufferlength, 1, file); 59 | 60 | fclose(file); 61 | } 62 | 63 | int main() { 64 | char* wavfilename = "lure.wav"; 65 | char input[256]; 66 | 67 | strcat_s((char*)input, sizeof(input), "I really really really like C++"); 68 | strcat_s((char*)input, sizeof(input), " "); 69 | strcat_s((char*)input, 256, "["); 70 | if (!TextToPhonemes(input)) return 1; 71 | 72 | SetInput(input); 73 | if (!SAMMain()){ 74 | return 1; 75 | } 76 | 77 | WriteWav(wavfilename, GetBuffer(), GetBufferLength()/50); 78 | } 79 | --------------------------------------------------------------------------------