<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:14pt"><div><span style="font-size: 16px;">Hi, I need to resample audio data from 44,1KHz to 48KHz, <br></span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">I have read some examples and I decide to use libswresample</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">for this issue.</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: 16px;">Some code for the resample is this:</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new
 york,times,serif; background-color: transparent; font-style: normal; font-size: 16px;"><span style="font-size: 16px;"><br></span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: 16px;">SwrContext *ctx = NULL;</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal; font-size: 16px;"><span style="font-size: 16px;"><br></span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">ctx = swr_alloc_set_opts(ctx,AV_CH_LAYOUT_STEREO,AV_SAMPLE_FMT_16,48000,</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size:
 medium;">                                         AV_CH_LAYOUT_STEREO,AV_SAMPLE_FMT_16,44100,0,0);</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;"><br></span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">if(swr_init(ctx) < 0)</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;"> <span class="tab">    </span>return -1;</span></div><div style="color:
 rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">.....</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">........<br></span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">int  resample_samples = swr_convert(ctx,(uint8_t**)&pcmBuffer,resamplesize,</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size:
 medium;">                                         (const uint8_t**)&pFrameRawInit->data[0],data_size,0,0);<br></span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;"><br></span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">fwrite(pcmBuffer,resample_samples,1,outfile);</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">......</span></div><div style="color: rgb(0, 0, 0);
 font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">.....</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">swr_free(&ctx);</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;"><br></span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">When I play the pcm data in the with the new sample rate, I can here the sound with the</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span
 style="font-size: medium;">right speed, but there is another noise like a buzz. Has somebody an idea, how can I</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">resample correctly without another sounds, should I use a filter?, If so, where is an example.</span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">I would be really helpfull. And sorry, I dont know if this is the right mailing list for this issue.<br></span></div><div style="color: rgb(0, 0, 0); font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;"><br></span></div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: times new roman,new
 york,times,serif; background-color: transparent; font-style: normal;"><span style="font-size: medium;">arctor</span><br></div></div></body></html>