Date: Thu, 31 Dec 2009 13:52:07 -0500 From: Lowell Gilbert <freebsd-questions-local@be-well.ilk.org> To: Gary Kline <kline@thought.org> Cc: FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG> Subject: Re: is there a way to convert an audio file into a char array? Message-ID: <447hs3kmco.fsf@be-well.ilk.org> In-Reply-To: <20091231093637.GA1832@thought.org> (Gary Kline's message of "Thu, 31 Dec 2009 01:36:40 -0800") References: <20091231093637.GA1832@thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Gary Kline <kline@thought.org> writes: > In working toward my goal of writing a keyboard driver with builtin > clicks, I'm investigating different angles. One would be to find > existing audio files and catting then thru /dev/dsp. > > Is there a way of turning any audio file/format into a character > array---in the way that a graphic can be turned into a character > array? > > For example, I turned the graphic of a small arrow to the following: > > unsigned char uparrow_bits[] = { > 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf8, 0x1f, 0xfc, 0x3f, > 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f}; > > Are there tools to do the same with a .au or .wav file? od(1), but that would be silly. Just have your program open the file and read it in. -- Lowell Gilbert, embedded/networking software engineer, Boston area http://be-well.ilk.org/~lowell/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?447hs3kmco.fsf>