Re: converting unsigned short sample to signed short sample
Arthurc <[email protected]> Wed, 14 Mar 2012 14:58:48 +0800
| Newsgroups | gmane.comp.audio.compression.speex.devel |
|---|---|
| Message-ID | <[email protected]> |
The subtraction actually will introduce a constant y offset to the signal. Your question really depends on what your hardware expect. If it expect unsigned, you need to add the 32767 back. Regards Arthur On 2012年3月14日, at 下午2:28, Mashal al-shboul <[email protected]> wrote: > Thanks a lot for replying, > The question now is , after subtracting 32767 from each unsigned sample, will the new signed samples represent the same original voice ? > For explanation, assume "Hi" is said in 8000 unsigned sample ,if i subtract 32767 from each sample and play the resulting 8000 sample as signed PCM samples,will they be "Hi" ?! > > Forgive me about my questions , but it's important for me and i am new to the stuff > Best Regards, > Mash'al > > From: Arthurc <[email protected]> > To: Mashal al-shboul <[email protected]> > Sent: Wednesday, March 14, 2012 5:58 AM > Subject: Re: [Speex-dev] converting unsigned short sample to signed short sample > > I assumed that you have unsigned input from your sound card / codec, etc. > Actually, it is unlikely in today's hardware platform for audio application. > > If that is really the case, you can just do.. > > short output = ((long) input) - 32767 > > Well, maybe it is possible to do some bit manipulation to achieve the same thing. > > Regards > Arthur > > On 2012年3月14日, at 上午11:21, Mashal al-shboul <[email protected]> wrote: > >> Hi All, >> I would like to get your help in my problem, >> >> we know that Speex codec takes samples of type short (signed), range:-2^15 to2^15 -1 , my problem is that i have samples of type >> unsigned short ,range: 0 to 2^16 -1. so, what should i do in order to apply speex on my unsigned samples ?. >> There is a proposed solution to subtract 2^15-1 from each unsigned short to get it signed short, my question: is this method safe in keeping the samples meaningful for speex's processing algorithms?. >> i hope i receive help from you. Thanks in advance >> >> Regards, >> Mash'al >> _______________________________________________ >> Speex-dev mailing list >> [email protected] >> http://lists.xiph.org/mailman/listinfo/speex-dev > > _______________________________________________ Speex-dev mailing list [email protected] http://lists.xiph.org/mailman/listinfo/speex-dev