• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            牽著老婆滿街逛

            嚴以律己,寬以待人. 三思而后行.
            GMail/GTalk: yanglinbo#google.com;
            MSN/Email: tx7do#yahoo.com.cn;
            QQ: 3 0 3 3 9 6 9 2 0 .

            SPEEX重采樣分析(一)

            轉載自:http://blog.csdn.net/ahyswang/article/details/7675390

            簡介

            • 算法速度快
            • SIMD(SSE)指令支持
            • 低內存
            • 高質量

            該算法是基于最原始的重采樣算法:

               Smith, Julius O. Digital Audio ResamplingHome Page
               Center for Computer Research in Music and Acoustics (CCRMA), 
               Stanford University, 2007.
               Web published at http://www-ccrma.stanford.edu/~jos/resample/.

             

            這里使用cubic   interpolation代替linear interpolation。減少CPU時間,能更好使用SIDM算法。

             

            接口

            speex_resampler_init

            功能

            創建實例

            函數

            SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels,                                           spx_uint32_t in_rate,

            spx_uint32_t out_rate,                                             int quality,                                          

            int *err);

            參數

            nb_channels [in] 通道數

            in_rate     [in] 輸入音頻的采樣率

            out_rate    [in] 輸出音頻的采樣率

            quality     [in] 重采樣質量

            err         [out] 錯誤碼

            返回值

            成功返回實例句柄,失敗返回NULL

            簡介

             

             

             

             

            speex_resampler_init_frac

            功能

            根據input/output比例來創建實例

            函數

            SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,                                                spx_uint32_t ratio_num,    

            spx_uint32_t ratio_den,                                                 spx_uint32_t in_rate,                                                      spx_uint32_t out_rate,                                                  int quality,

            int *err);

            參數

            nb_channels    [in]通道數

            ratio_num      [in]比例分子                  

            ratio_den      [in]比例分母       

            in_rate        [in]輸入的采樣率 

            out_rate       [in]輸出的采樣率

            quality        [in]重采樣質量

            err            [out]錯誤碼

            返回值

            成功返回實例句柄,失敗返回NULL

            簡介

             

             

             

            speex_resampler_destroy

            功能

            銷毀實例

            函數

            void speex_resampler_destroy(SpeexResamplerState *st);

            參數

            St [in] 實例句柄

            返回值

            void

            簡介

            釋放資源

             

             

             

            speex_resampler_process_float

            功能

            重采樣浮點序列

            函數

            int speex_resampler_process_float(SpeexResamplerState *st,                                  

            spx_uint32_t channel_index,                                   const float *in,                                              spx_uint32_t *in_len,

            float *out,                                                   spx_uint32_t *out_len);    

            參數

            St                [in]句柄

            channel_index     [in]通道號

            in                [in]輸入緩存

            in_len           [in]輸入長度(返回處理的采樣數)

            out               [in]輸出緩存

            out_len           [in]輸出長度(返回寫入的采樣數)

            返回值

            錯誤碼

            簡介

            輸入和輸出緩存不能重疊,外部準備緩存

             

             

             

            speex_resampler_process_interleaved_float

            功能

            重采樣交叉的多通道浮點數據(例如:雙通道PCM)

            函數

            int speex_resampler_process_interleaved_float(SpeexResamplerState *st,                                                 

            const float *in,

            spx_uint32_t *in_len,

            float *out,

            spx_uint32_t *out_len);

            參數

            St                [in]句柄

            in                [in]輸入緩存

            in_len           [in]輸入長度(返回處理的采樣數)

            out               [in]輸出緩存

            out_len           [in]輸出長度(返回寫入的采樣數)

            返回值

            錯誤碼

            簡介

             

             

             

             

            注:以上是主要的接口函數

             

            示例

            下面把16K的音頻轉換為8k的音頻

                st = speex_resampler_init(1, 16000, 8000, 10, &err);

             

                do{

                   readlen = fread(in, sizeof(short), 1024, fin);

                   if (readlen > 0)

                   {

                       inlen = readlen;

                       outlen = 1024;

                       ret = speex_resampler_process_int(st, 0, in, &inlen, out, &outlen);

                       if (ret == RESAMPLER_ERR_SUCCESS)

                       {

                          fwrite(out, sizeof(short), outlen, fout);

                       }

                   }

                  

                }while(readlen == 1024);

               

                speex_resampler_destroy(st);

             

            posted on 2013-02-05 12:06 楊粼波 閱讀(5336) 評論(0)  編輯 收藏 引用

            久久久久国色AV免费观看| 国产精品无码久久综合| 久久久久久久久久久久久久| 久久99精品国产一区二区三区| 精品熟女少妇AV免费久久| AV无码久久久久不卡蜜桃 | 亚洲伊人久久成综合人影院 | 欧美激情一区二区久久久| 国产精品亚洲美女久久久| 久久久久久久综合日本亚洲 | 精品久久久久中文字幕日本| 91久久九九无码成人网站| 国产精品一区二区久久| 欧美一区二区久久精品| 97精品依人久久久大香线蕉97 | 99热热久久这里只有精品68| 久久久久久精品免费免费自慰| 久久夜色精品国产亚洲| 波多野结衣久久一区二区| 国内精品久久久久久久久| 国产精品成人99久久久久| 亚洲中文字幕无码一久久区| 麻豆久久| 亚洲中文字幕久久精品无码喷水| 国产精品伊人久久伊人电影| 91久久精一区二区三区大全| 久久亚洲欧美日本精品| 无码人妻久久一区二区三区免费| 精品国产乱码久久久久久1区2区 | 亚洲国产精品高清久久久| 久久精品国产只有精品66| 99久久免费国产精品| 久久国产乱子伦精品免费强| 午夜精品久久久久久中宇| 一本久久知道综合久久| 久久精品aⅴ无码中文字字幕不卡| 色偷偷88欧美精品久久久| 色偷偷久久一区二区三区| 91久久香蕉国产熟女线看| 免费观看久久精彩视频| 久久精品国产免费一区|