From owner-freebsd-questions@FreeBSD.ORG Thu Dec 31 18:52:09 2009 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 816571065693 for ; Thu, 31 Dec 2009 18:52:09 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from mail4.sea5.speakeasy.net (mail4.sea5.speakeasy.net [69.17.117.6]) by mx1.freebsd.org (Postfix) with ESMTP id 5A49A8FC08 for ; Thu, 31 Dec 2009 18:52:09 +0000 (UTC) Received: (qmail 27523 invoked from network); 31 Dec 2009 18:52:08 -0000 Received: from dsl092-078-145.bos1.dsl.speakeasy.net (HELO be-well.ilk.org) ([66.92.78.145]) (envelope-sender ) by mail4.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 31 Dec 2009 18:52:08 -0000 Received: by be-well.ilk.org (Postfix, from userid 1147) id B666A50825; Thu, 31 Dec 2009 13:52:07 -0500 (EST) From: Lowell Gilbert To: Gary Kline References: <20091231093637.GA1832@thought.org> Date: Thu, 31 Dec 2009 13:52:07 -0500 In-Reply-To: <20091231093637.GA1832@thought.org> (Gary Kline's message of "Thu, 31 Dec 2009 01:36:40 -0800") Message-ID: <447hs3kmco.fsf@be-well.ilk.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: FreeBSD Mailing List Subject: Re: is there a way to convert an audio file into a char array? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2009 18:52:09 -0000 Gary Kline 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/