Add wavsmpl.
This commit is contained in:
parent
37232c84e5
commit
7008244a2d
3 changed files with 133 additions and 63 deletions
98
README.md
98
README.md
|
|
@ -1,62 +1,42 @@
|
|||
Random single-file programs I've written in my spare time for small tasks.
|
||||
|
||||
* bleep: I got bored and decided to write a pc speaker music program.
|
||||
* ckmextract: Extracts ESP and BSA from Skyrim steam workshop mod archives.
|
||||
* cube2enviro: A simple GL 4.4 program. Loads a cubemap and draws a flattened
|
||||
hemisphere environment map that can be used in Unreal.
|
||||
* ddsinfo: Shows contents of a DDS header.
|
||||
* dood: Reads an ENDOOM lump and mirrors every word "down the middle".
|
||||
* dtexdupes: Small tool I've used once or twice to clean up my doom projects of
|
||||
duplicate textures.
|
||||
* fmod\_playbank (formerly fuck\_fmod): Tool for playback of .fsb files.
|
||||
* fuzz: A fancy blocky noise filter using proto-AliceGL designs.
|
||||
* glfuzz: OpenGL version of the filter.
|
||||
* iwad64ex: A small, failed experiment for ripping the Hexen 64 IWAD.
|
||||
* lutconv: A program for converting various "3D" LUT textures to actual 3D LUTs
|
||||
in DDS volume maps. Successor to mkvolume. Used for MariENB. Plus two
|
||||
additional tools for "deconverting" volume maps, and one for smoothing them
|
||||
out to reduce potential banding.
|
||||
* mazestuff: A dungeon generator for roguelikes. This was made as part of a
|
||||
commission for a friend, hence the very detailed comments.
|
||||
* memrd/memsk/memwr: Quick 'n dirty tools for memory manipulation on running
|
||||
programs.
|
||||
* mkfont: A tool I use to convert UE fonts exported with UTPT into fonts for
|
||||
GZDoom. Requires ImageMagick to be installed.
|
||||
* mkgauss: Make an array of gaussian blur kernel values with passed radius and
|
||||
sigma. Used for shader development.
|
||||
* mksoundwad: Program used during the early days of Tim Allen Doom. Deprecated
|
||||
as notsanae now also replaces sounds through an OpenAL hook.
|
||||
* mkssao: Make an array of SSAO samples. Also for shader development.
|
||||
* mkvolume: Old program for making LUT volume maps.
|
||||
* mkwall: A program I use on a daily basis to set my wallpaper on every Linux
|
||||
machine.
|
||||
* osnorm: Experiment for generating object-space normals from an .obj model.
|
||||
* pcxpalex.c: Extracts the palette from PCX images.
|
||||
* pframes: Short utility for automating long FrameIndex lists for MODELDEF.
|
||||
* schange: Program used along with mkwall to update the wallpaper on screen
|
||||
geometry changes.
|
||||
* skse_cosave: Experiment for dumping information in SKSE co-saves.
|
||||
* soapstone: Random soapstone messages from all 3 dark souls games. Messages
|
||||
can be generated in bulk.
|
||||
* totty: Sends text from stdin to tty1. Used to send certain commands when
|
||||
remoting into a Raspberry Pi.
|
||||
* u95/u083/u086extract: Programs for extracting data from Unreal alpha
|
||||
packages. This and other Unreal tools might be shifted to another repo.
|
||||
* udmfvis: dmvis clone in C for UDMF maps. No external dependencies.
|
||||
* ufontext: companion to mkfont, for extracting UE fonts. Currently does not
|
||||
yet extract the textures themselves.
|
||||
* umxunpack: Extractor for music in UE archives, with support for Unreal 227's
|
||||
UMX files containing vorbis audio.
|
||||
* unrundeleter: WIP program to unset the bDeleteMe flag on stuff in UE1 maps.
|
||||
Yes, some mappers are so hellbent on preventing modification that they delete
|
||||
all brushes after baking the geometry.
|
||||
* usndextract: Extracts sounds from UE archives.
|
||||
* utxextract: Extracts textures from UE archives.
|
||||
* vc2sdl: Passes the contents of the VC4 framebuffer to a SDL window. Was used
|
||||
for video playback experiments on a Raspberry Pi with a SPI LCD.
|
||||
* wavrip: Cheap WAV file extractor that naively searchs for RIFF headers.
|
||||
* withhands: Talk like W.D. Gaster.
|
||||
* zimagekver: Quick program to extract version info from an ARM Linux kernel
|
||||
image.
|
||||
* **bleep:** I got bored and decided to write a pc speaker music program.
|
||||
* **ckmextract:** Extracts ESP and BSA from Skyrim steam workshop mod archives.
|
||||
* **cube2enviro:** A simple GL 4.4 program. Loads a cubemap and draws a flattened hemisphere environment map that can be used in Unreal.
|
||||
* **ddsinfo:** Shows contents of a DDS header.
|
||||
* **dood:** Reads an ENDOOM lump and mirrors every word "down the middle".
|
||||
* **dtexdupes:** Small tool I've used once or twice to clean up my doom projects of duplicate textures.
|
||||
* **fmod\_playbank (formerly fuck\_fmod):** Tool for playback of .fsb files.
|
||||
* **fuzz:** A fancy blocky noise filter using proto-AliceGL designs.
|
||||
* **glfuzz:** OpenGL version of the filter.
|
||||
* **iwad64ex:** A small, failed experiment for ripping the Hexen 64 IWAD.
|
||||
* **lutconv:** A program for converting various "3D" LUT textures to actual 3D LUTs in DDS volume maps. Successor to mkvolume. Used for MariENB. Plus two additional tools for "deconverting" volume maps, and one for smoothing them out to reduce potential banding.
|
||||
* **mazestuff:** A dungeon generator for roguelikes. This was made as part of a commission for a friend, hence the very detailed comments.
|
||||
* **memrd/memsk/memwr:** Quick 'n dirty tools for memory manipulation on running programs.
|
||||
* **mkfont:** A tool I use to convert UE fonts exported with UTPT into fonts for GZDoom. Requires ImageMagick to be installed.
|
||||
* **mkgauss:** Make an array of gaussian blur kernel values with passed radius and sigma. Used for shader development.
|
||||
* **mksoundwad:** Program used during the early days of Tim Allen Doom. Deprecated as notsanae now also replaces sounds through an OpenAL hook.
|
||||
* **mkssao:** Make an array of SSAO samples. Also for shader development.
|
||||
* **mkvolume:** Old program for making LUT volume maps.
|
||||
* **mkwall:** A program I use on a daily basis to set my wallpaper on every Linux machine.
|
||||
* **osnorm:** Experiment for generating object-space normals from an .obj model.
|
||||
* **pcxpalex:** Extracts the palette from PCX images.
|
||||
* **pframes:** Short utility for automating long FrameIndex lists for MODELDEF.
|
||||
* **schange:** Program used along with mkwall to update the wallpaper on screen geometry changes.
|
||||
* **skse_cosave:** Experiment for dumping information in SKSE co-saves.
|
||||
* **soapstone:** Random soapstone messages from all 3 dark souls games. Messages can be generated in bulk.
|
||||
* **totty:** Sends text from stdin to tty1. Used to send certain commands when remoting into a Raspberry Pi.
|
||||
* **u95/u083/u086extract:** Programs for extracting data from Unreal alpha packages. This and other Unreal tools might be shifted to another repo.
|
||||
* **udmfvis:** dmvis clone in C for UDMF maps. No external dependencies.
|
||||
* **ufontext:** companion to mkfont, for extracting UE fonts. Currently does not yet extract the textures themselves.
|
||||
* **umxunpack:** Extractor for music in UE archives, with support for Unreal 227's UMX files containing vorbis audio.
|
||||
* **unrundeleter:** WIP program to unset the bDeleteMe flag on stuff in UE1 maps. Yes, some mappers are so hellbent on preventing modification that they delete all brushes after baking the geometry.
|
||||
* **usndextract:** Extracts sounds from UE archives.
|
||||
* **utxextract:** Extracts textures from UE archives.
|
||||
* **vc2sdl:** Passes the contents of the VC4 framebuffer to a SDL window. Was used for video playback experiments on a Raspberry Pi with a SPI LCD.
|
||||
* **wavrip:** Cheap WAV file extractor that naively searchs for RIFF headers.
|
||||
* **wavsmpl:** Extracts loop information from WAV files that have it, because only certain proprietary audio editors support this directly.
|
||||
* **withhands:** Talk like W.D. Gaster.
|
||||
* **zimagekver:** Quick program to extract version info from an ARM Linux kernel image.
|
||||
|
||||
All programs and code here are under the MIT license.
|
||||
All programs and code here are under the MIT license.
|
||||
9
mkfont.c
9
mkfont.c
|
|
@ -6,9 +6,10 @@
|
|||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
if ( argc < 3 ) return 1;
|
||||
if ( argc < 2 ) return 1;
|
||||
char tname[256] = {0};
|
||||
int cell = 0, x = 0, y = 0, w = 0, h = 0;
|
||||
unsigned cell = 0;
|
||||
int x = 0, y = 0, w = 0, h = 0;
|
||||
char cropargs[256] = {0};
|
||||
char cname[256] = {0};
|
||||
char* hargs[7] =
|
||||
|
|
@ -32,8 +33,8 @@ int main( int argc, char **argv )
|
|||
}
|
||||
strcat(tname,".png");
|
||||
if ( (w <= 0) || (h <= 0) ) continue;
|
||||
printf("%d, %s %+d%+d,%d,%d\n",cell,tname,x,y,w,h);
|
||||
sprintf(cname,"%s/%s_%03d.png",argv[1],argv[2],cell);
|
||||
printf("%u, %s %+d%+d,%d,%d\n",cell,tname,x,y,w,h);
|
||||
sprintf(cname,"%s/%04x.png",argv[1],cell);
|
||||
sprintf(cropargs,"%dx%d%+d%+d",w,h,x,y);
|
||||
int pid = fork();
|
||||
if ( !pid ) execvp(hargs[0],hargs);
|
||||
|
|
|
|||
89
wavsmpl.c
Normal file
89
wavsmpl.c
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char magic[4];
|
||||
uint32_t size;
|
||||
char type[4];
|
||||
} riff_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char id[4];
|
||||
uint32_t size;
|
||||
} chunk_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t mf, prod, sp, mnote, mpitch, sfmt, sofs, nloops, sdata;
|
||||
} smpl_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t id, type, start, end, fraction, count;
|
||||
} sloop_t;
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
if ( argc < 2 ) return 1;
|
||||
FILE *fin;
|
||||
for ( int i=1; i<argc; i++ )
|
||||
{
|
||||
if ( !(fin = fopen(argv[i],"rb")) )
|
||||
{
|
||||
fprintf(stderr,"couldn't open %s: %s\n",argv[i],strerror(errno));
|
||||
continue;
|
||||
}
|
||||
riff_t head;
|
||||
if ( fread(&head,1,sizeof(riff_t),fin) != sizeof(riff_t) )
|
||||
{
|
||||
fprintf(stderr,"%s: premature end of file reached reading file header\n",argv[i]);
|
||||
goto skipme;
|
||||
}
|
||||
if ( strncmp(head.magic,"RIFF",4) )
|
||||
{
|
||||
fprintf(stderr,"%s: invalid RIFF header\n",argv[i]);
|
||||
goto skipme;
|
||||
}
|
||||
while ( !feof(fin) )
|
||||
{
|
||||
chunk_t chk;
|
||||
if ( fread(&chk,1,sizeof(chunk_t),fin) != sizeof(chunk_t) )
|
||||
{
|
||||
fprintf(stderr,"%s: premature end of file reached reading chunk header\n",argv[i]);
|
||||
goto skipme;
|
||||
}
|
||||
if ( strncmp(chk.id,"smpl",4) )
|
||||
{
|
||||
printf("Skipping over %.4s chunk (%u bytes)\n",chk.id,chk.size);
|
||||
fseek(fin,chk.size,SEEK_CUR);
|
||||
continue;
|
||||
}
|
||||
printf("smpl chunk found\n");
|
||||
smpl_t smpl;
|
||||
if ( fread(&smpl,1,sizeof(smpl_t),fin) != sizeof(smpl_t) )
|
||||
{
|
||||
fprintf(stderr,"%s: premature end of file reached reading smpl data\n",argv[i]);
|
||||
goto skipme;
|
||||
}
|
||||
printf("%u loops contained\n",smpl.nloops);
|
||||
for ( uint32_t j=0; j<smpl.nloops; j++ )
|
||||
{
|
||||
sloop_t loop;
|
||||
if ( fread(&loop,1,sizeof(sloop_t),fin) != sizeof(sloop_t) )
|
||||
{
|
||||
fprintf(stderr,"%s: premature end of file reached reading smpl loop\n",argv[i]);
|
||||
goto skipme;
|
||||
}
|
||||
printf("ID: %u\n type: %u\n start: %u\n end: %u\n fraction: %u\n count: %u\n",
|
||||
loop.id,loop.type,loop.start,loop.end,loop.fraction,loop.count);
|
||||
}
|
||||
}
|
||||
skipme:
|
||||
fclose(fin);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue