SOUNDTOH(1)

πŸ“¦ version 1.9.5, in fedora 43, fedora 44

πŸ’– SOUNDTOH πŸ’–

okay bestie, gather round, because this one is genuinely so fun β€” it's soundtoh, a little utility from the General Commands Manual crowd, and it does exactly one thing but it does it beautifully. ✨


🌸 NAME 🌸

soundtoh β€” convert a sound file to a C language header file πŸŽ€


✨ SYNOPSIS ✨

soundtoh filename

that's it. one argument. no notes. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the vibe: soundtoh takes a sound file in a format that the Network Audio System library supports and turns it into a header file β€” yes, like an actual C header, the kind you pull in with the #include pre-processor directive. so you can literally hardcode a bark into your program. iconic behavior, no cap. 🐢

the resulting output goes straight to standard output. like, it just prints the whole header at you. and the output looks something like this:

/* bark */

#define barkDataFormat   AuFormatULAW8
#define barkSampleRate   8000
#define  barkNumTracks   1
#define barkNumSamples \
    (sizeof(barkSamples) / sizeof(barkSamples[0]) / barkNumTracks)

static char *barkComment = "terrier bark";

static unsigned char barkSamples[] =
{
    0x57, 0x52, 0x51, 0x55, 0x5d, 0x72, 0xe5, 0xdc,
    0xdc, 0xe2, 0xed, 0x76, 0x61, 0x5b, 0x59, 0x5e,
                              .
                              .
                              .
    0x66, 0xf0, 0xde, 0xe0, 0xf1, 0x6d, 0x67, 0x6a,
    0x77, 0xee, 0xe5, 0xe6, 0xf1, 0x71, 0x6b,
};

look at that. the comment, the defines, the whole sample array β€” chef's kiss. πŸ§‘πŸ³πŸ’‹

and a lil heads up, bestie: 16-bit samples will be converted appropriately depending upon the endianess of the host machine. so like, the bytes get arranged the way your machine wants them. it's giving considerate. 🫢


πŸ‘‘ SEE ALSO πŸ‘‘

go read that one next, iykyk. πŸ’œ


Copyright 1993, 1994 Network Computing Devices, Inc.


⭐ AUTHOR ⭐

Greg Renda, Network Computing Devices, Inc.


and that's the whole page, bestie!! this lil masterpiece is version 1.9.5, and honestly? it ate. go convert a sound file. slay. πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from