Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!y4g2000prf.googlegroups.com!not-for-mail
From: dbd <dbd@ieee.org>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to change the resolution of audio data using MATLAB?
Date: Wed, 19 Aug 2009 08:44:40 -0700 (PDT)
Organization: http://groups.google.com
Lines: 18
Message-ID: <219d68c6-4a44-4711-bb0f-1a6078f055b2@y4g2000prf.googlegroups.com>
References: <h6gm3a$dbs$1@fred.mathworks.com>
NNTP-Posting-Host: 75.17.143.217
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1250696681 4410 127.0.0.1 (19 Aug 2009 15:44:41 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 19 Aug 2009 15:44:41 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: y4g2000prf.googlegroups.com; posting-host=75.17.143.217; 
	posting-account=E_gaFgoAAACfAhF2MzvkivNAUVGQbrBP
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.20) 
	Gecko/20081217 Firefox/2.0.0.20 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:564477


On Aug 19, 4:02 am, "jean young" <jean_young...@yahoo.com> wrote:
> Hi, I have some audio data stored in .wav file. I got them using wavread function in MATLAB and found the sampling rate is 8-kHz and the resolution is 16 bits. My supervisor asked me to change the resolution to 12 bits and 10 bits then I can see the difference.
>
> The problem is that most softwares (e.g. wavwrite in MATLAB, Cool Edit) only do the transform among 8 bits, 16 bits, 24 bits and 32 bits. Therefore I tried to write code to do this myself (see my code below).
> ...
> Anyone knows better method? Any help is highly appreciated!

A faster approximate method might be:

nbitdata = round(2^(nbit-1)*src)/2^(nbit-1);


Dale B. Dalrymple