delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2014/03/29/11:22:31

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-TCPREMOTEIP: 76.119.234.168
X-Authenticated-UID: jpd AT noqsi DOT com
From: John Doty <jpd AT noqsi DOT com>
Mime-Version: 1.0 (Apple Message framework v1085)
Subject: Re: [geda-user] Wav to C array ~ 16 bit to 12 bit
Date: Sat, 29 Mar 2014 11:22:16 -0400
In-Reply-To: <CALSZ9gpoxnz9V-CbisKqmdwQyTtVf6G9nCe2Wt=4p4su-afFBQ@mail.gmail.com>
To: geda-user AT delorie DOT com
References: <CALSZ9gpoxnz9V-CbisKqmdwQyTtVf6G9nCe2Wt=4p4su-afFBQ AT mail DOT gmail DOT com>
Message-Id: <C6BD76D7-BC01-4070-8B18-ED6BCC07EDDC@noqsi.com>
X-Mailer: Apple Mail (2.1085)
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

--Apple-Mail-2--959974817
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii


On Mar 29, 2014, at 10:36 AM, Rob Butts wrote:

> I have a short 8kHz 16 bit wav pcm file that I converted to an 8kHz 16 =
bit unsigned C numerical array.  I'm using a 12 bit dac so I need to =
convert the 16 bit numerical array to a 12 bit numerical array.
> =20
> Before I get started is this just a matter of shifting out the four =
most significant bits of the binary 16 bit value?

"God is in the details."

First of all, sound pressure is relative to ambient static pressure, so =
it's signed. I therefore don't understand how your unsigned values are =
encoded. You may need to add 0x8000 to get the coding you need.

Then, there's the matter of your DAC interface. Is its coding signed or =
offset binary? What's the interface? If it's bytes, you have to worry =
about which byte comes first. In any case, when mapping a total of 16 =
bits to a 12 bit word, you may need to align the most significant bits =
or the least significant bits, depending on the DAC and its interface.

John Doty              Noqsi Aerospace, Ltd.
http://www.noqsi.com/
jpd AT noqsi DOT com



--Apple-Mail-2--959974817
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; =
"><br><div><div>On Mar 29, 2014, at 10:36 AM, Rob Butts wrote:</div><br =
class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><div =
dir=3D"ltr"><div>I have a short 8kHz 16 bit&nbsp;wav pcm file that I =
converted to an 8kHz 16 bit unsigned C numerical array.&nbsp; I'm using =
a 12 bit dac so I need to convert the 16 bit numerical array to a 12 bit =
numerical array.</div>
<div>&nbsp;</div><div>Before I get started is this just a matter of =
shifting out the four most significant bits of the binary 16 bit =
value?</div></div>
</blockquote><br></div><div>"God is in the =
details."</div><div><br></div><div>First of all, sound pressure is =
relative to ambient static pressure, so it's signed. I therefore don't =
understand how your unsigned values are encoded. You may need to add =
0x8000 to get the coding you need.</div><div><br></div><div>Then, =
there's the matter of your DAC interface. Is its coding signed or offset =
binary? What's the interface? If it's bytes, you have to worry about =
which byte comes first. In any case, when mapping a total of 16 bits to =
a 12 bit word, you may need to align the most significant bits or the =
least significant bits, depending on the DAC and its =
interface.</div><br><div>
<span class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><span =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><p style=3D"margin: =
0.0px 0.0px 0.0px 0.0px"><font face=3D"Helvetica" size=3D"3" =
style=3D"font: 12.0px Helvetica">John Doty<span =
class=3D"Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span =
class=3D"Apple-converted-space">&nbsp;</span><span =
class=3D"Apple-converted-tab">&nbsp; &nbsp;<span =
class=3D"Apple-converted-space">&nbsp;</span></span></span>Noqsi =
Aerospace, Ltd.</font></p><p style=3D"margin: 0.0px 0.0px 0.0px =
0.0px"><a href=3D"http://www.noqsi.com/">http://www.noqsi.com/</a></p><p =
style=3D"margin: 0.0px 0.0px 0.0px 0.0px"><font face=3D"Helvetica" =
size=3D"3" style=3D"font: 12.0px Helvetica"><a =
href=3D"mailto:jpd AT noqsi DOT com">jpd AT noqsi DOT com</a></font></p><br =
class=3D"Apple-interchange-newline"></span></span>
</div>
<br></body></html>=

--Apple-Mail-2--959974817--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019