Article View: borland.public.cppbuilder.multimedia
Article #384Re: zero value with samples
From: Tom|420
Date: Tue, 26 Oct 2004 02:28
Date: Tue, 26 Oct 2004 02:28
50 lines
3043 bytes
3043 bytes
Fraser Ross wrote: > "Mark Jacobs" > >>This is what I use for 8-bit samples :- >> >>int lv=(int)((unsigned char)wvhdr->lpData[0])-128; >>-- > > > That isn't an answer to my question. BTW I don't think the cast to int is > necessary. > > My former suggestion of 128 positive values and 128 negative values and > using 0 as if it is the midpoint seems to be the norm. > > Fraser. > > Yes, that answers your question, and actually in a very clear manner. Recorded audio samples are either unsigned 8-bit or signed 16-bit. If there is an exception to the rule, I've never heard of it. When dealing with signed 16-bit samples no problem. When dealing with unsigned 8-bit values there is an issue, which you seem to know of. Most audio transformation algorythms are designed for signed wave forms and feeding them with an unsigned wave form would result in strange result (although some music enthousiasts like strange result). Therefore you want to convert the unsigned wave form into a signed one. To do this you substract 128 ((2^8)/2) from you unsigned samples as you transfer them into a signed container. No mathematician could deny that formula, it's basic arythmetic. Knowing the middle-point is irrelevant. There is no middle-point in an audio sample. If you believe a middle-point would be a point of silence you are off-track. Don't forget to transfer your samples into unsigned container when done processing before you try to play it back. Mark Jacobs answer is the only good answer to your question. If you don't trust that answer do some research (although you will probably find that audio experts don't publish much free stuff on the net -- actualy they don't even publish much for-a-fee stuff anywhere). Hope this helps and have fun with your audio samples, Tom :)
Technical Details
Message-ID:
<417db647$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!195.5.65.34.MISMATCH!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4166532e@newsgroups.borland.com> <4167c2a9@newsgroups.borland.com> <4167e397@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10d0fc,c5ac5258fa1a1e59 X-Google-Attributes: gid10d0fc,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 25 Oct 2004 22:28:29 -0400 From: Tom|420 <tom420.duhamel@gmail.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.multimedia Subject: Re: zero value with samples References: <4166532e@newsgroups.borland.com> <4167c2a9@newsgroups.borland.com> <4167e397@newsgroups.borland.com> In-Reply-To: <4167e397@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.70.225.215 Message-ID: <417db647$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1098757703 69.70.225.215 (25 Oct 2004 19:28:23 -0700) Lines: 50 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!195.5.65.34.MISMATCH!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail