<div dir="ltr">thanks, but actualy this is not my problem.<div>changing sampling rate may have more problem because of aliasing which need to be removed.</div><br><div class="gmail_quote">On Sat, Jun 26, 2010 at 6:18 PM, Clifton Craig <span dir="ltr"><<a href="mailto:clifton.craig@gmail.com">clifton.craig@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I've done something similar in Groovy/Java using Wave files. In my case I was downsampling from 16bit to 8bit. Here's the core of my conversion logic.<br>
<br>
def convertData(def inputStream, def outputStream) {<br>
boolean otherByte = false<br>
inputStream.eachByte {<br>
if(otherByte) {<br>
//invert high order byte<br>
int inverted = ((int)it) ^ 0x00000080<br>
byte[] toWrite = new byte[1]; toWrite[0] = (byte)inverted<br>
outputStream.write toWrite<br>
otherByte = false<br>
} else otherByte = true<br>
}<br>
}<br>
Basically you need to write every other byte in thePCM sample stream.<br>
<br>
<br>
<br>
Clifton Craig<br>
Software Engineer<br>
<a href="http://codeforfun.wordpress.com" target="_blank">http://codeforfun.wordpress.com</a><br>
<a href="mailto:clifton.craig@gmail.com">clifton.craig@gmail.com</a><br>
<div><div></div><div class="h5"><br>
On Jun 26, 2010, at 9:50 AM, nir elkayam wrote:<br>
<br>
> hi<br>
><br>
> on my device i can sample only at 32khz and want to use speex at 16khz so i need to down-convert the input signal by factor of 2.<br>
> does anyone provide me a reference to some code that does that? are there any trick to do that?<br>
><br>
> i tried to add to subsequent sample but the result was very bad.<br>
> what are the requrment from a decimation filter for audio?<br>
><br>
> thanks,<br>
> nir<br>
</div></div>> _______________________________________________<br>
> Speex-dev mailing list<br>
> <a href="mailto:Speex-dev@xiph.org">Speex-dev@xiph.org</a><br>
> <a href="http://lists.xiph.org/mailman/listinfo/speex-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/speex-dev</a><br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>ניר אלקיים<br>טל: 050-3930056<br><a href="mailto:nir.elkayam@gmail.com">nir.elkayam@gmail.com</a><br><br>
</div>