日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

sox语音开源库的功能剖析

發(fā)布時間:2023/12/31 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 sox语音开源库的功能剖析 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

sox是一個跨平臺的命令行工具,可以進(jìn)行音頻格式轉(zhuǎn)換,也可以應(yīng)用各種音效到文件中,還支持在大多數(shù)平臺進(jìn)行播放與錄制,堪稱音頻界的瑞士軍刀。接下來,我們詳細(xì)介紹sox庫支持的音頻格式、支持的音效、常用的API、常用的命令行。

目錄

一、支持的音頻格式

二、支持的音效

1、音質(zhì)效果

2、產(chǎn)生效果

3、音量效果

4、編輯效果

5、混音效果

6、音調(diào)/音速效果

7、控制效果

8、專業(yè)混音

9、分析效果

10、信號處理效果

三、常用的API

四、常用的命令行

1、播放音頻

2、格式轉(zhuǎn)換

3、音頻錄制

4、添加音效


一、支持的音頻格式

  • Apple/SGI AIFF files
  • SUN .au files(PCM, u-law, A-law)
  • CDDA (光碟數(shù)字音頻格式)
  • AMR-WB & AMR-NB (需要ibamrwb & libamrnb庫)
  • MP2/MP3 (需要ibmp3lame庫)
  • MP4, AAC, AC3, WAVPACK, AMR-NB files (需要ffmpeg庫)
  • AVI, WMV, Ogg Theora, MPEG video files (需要ffmpeg庫)
  • Ogg Vorbis files (需要Ogg Vorbis庫)
  • FLAC files (需要libFLAC庫)
  • Microsoft .WAV file

二、支持的音效

1、音質(zhì)效果

  • allpass: RBJ all-pass biquad IIR filter
  • bandpass: RBJ band-pass biquad IIR filter
  • bandreject: RBJ band-reject biquad IIR filter
  • band: SPKit resonator band-pass IIR filter
  • bass: Tone control: RBJ shelving biquad IIR filter
  • equalizer: RBJ peaking equalisation biquad IIR filter
  • firfit+: FFT convolution FIR filter using given freq. response
  • highpass: High-pass filter: Single pole or RBJ biquad IIR
  • hilbert: Hilbert transform filter (90 degrees phase shift)
  • lowpass: Low-pass filter: single pole or RBJ biquad IIR
  • sinc: Sinc-windowed low/high-pass/band-pass/reject FIR
  • treble: Tone control: RBJ shelving biquad IIR filter

2、產(chǎn)生效果

  • chorus: Make a single instrument sound like many
  • delay: Delay one or more channels
  • echo: Add an echo
  • echos: Add a sequence of echos
  • flanger: Stereo flanger
  • overdrive: Non-linear distortion
  • phaser: Phase shifter
  • repeat: Loop the audio a number of times
  • reverb: Add reverberation
  • reverse: Reverse the audio?
  • tremolo: Sinusoidal volume modulation

3、音量效果

  • compand: Signal level compression/expansion/limiting
  • contrast: Phase contrast volume enhancement
  • dcshift: Apply or remove DC offset
  • fade: Apply a fade-in and/or fade-out to the audio
  • gain: Apply gain or attenuation; normalise/equalise/balance/headroom
  • loudness: Gain control with ISO 226 loudness compensation
  • mcompand: Multi-band compression/expansion/limiting
  • norm: Normalise to 0dB
  • vol: Adjust audio volume

4、編輯效果

  • pad: Pad (usually) the ends of the audio with silence
  • silence: Remove portions of silence from the audio
  • splice: Perform the equivalent of a cross-faded tape splice
  • trim: Cuts portions out of the audio
  • vad: Voice activity detector

5、混音效果

  • channels: Auto mix or duplicate to change number of channels
  • divide+: Divide sample values by those in the 1st channel
  • remix: Produce arbitrarily mixed output channels
  • swap: Swap stereo channels

6、音調(diào)/音速效果

  • bend: Bend pitch at given times without changing tempo
  • pitch: Adjust pitch (= key) without changing tempo
  • speed: Adjust pitch & tempo together
  • stretch: Adjust tempo without changing pitch
  • tempo: Adjust tempo without changing pitch

7、控制效果

  • dither: Add dither noise to increase quantisation SNR
  • rate: Change audio sampling rate

8、專業(yè)混音

  • deemph: ISO 908 CD de-emphasis (shelving) IIR filter
  • earwax: Process CD audio to best effect for headphone use
  • noisered: Filter out noise from the audio
  • oops: Out Of Phase Stereo (or `Karaoke') effect
  • riaa: RIAA vinyl playback equalisation

9、分析效果

  • noiseprof: Produce a DFT profile of the audio
  • spectrogram: graph signal level vs. frequency & time (需要libpng庫)
  • stat: Enumerate audio peak & RMS levels, freq
  • stats: Multichannel aware `stat'

10、信號處理效果

  • biquad: 2nd-order IIR filter using externally provided coefficients
  • downsample: Reduce sample rate by discarding samples
  • fir: FFT convolution FIR filter using externally provided coefficients
  • upsample: Increase sample rate by zero stuffing

三、常用的API

1、sox_format_init

用于初始化關(guān)聯(lián)文件格式的句柄。如果編譯為動態(tài)庫,它會探測并且初始化所有外部庫,這個方法應(yīng)該在其他操作之前調(diào)用。

2、sox_format_quit

用于反初始化關(guān)聯(lián)文件格式的句柄。

3、sox_open_input

根據(jù)文件路徑打開可讀(輸入)文件。

4、sox_open_output

根據(jù)文件路徑打開可寫(輸出)文件。

5、sox_read

使用格式句柄來讀取指定len的數(shù)據(jù)到buf(數(shù)據(jù)必須轉(zhuǎn)換為32位有符號數(shù))。

6、sox_write

使用格式句柄向buf寫入指定len的數(shù)據(jù)(數(shù)據(jù)必須轉(zhuǎn)換為32位有符號數(shù))。

7、sox_close

關(guān)閉文件句柄。

8、sox_seek

對文件流進(jìn)行seek操作。

9、sox_find_effect

根據(jù)音效名字來查找effect。

10、sox_create_effect

創(chuàng)建并實例化effect。

11、sox_effect_options

用于控制effect的選擇參數(shù)。

12、sox_create_effects_chain

創(chuàng)建effect鏈。

13、sox_delete_effects_chain

刪除effect鏈。

14、sox_add_effect

向effect鏈添加effect。

四、常用的命令行

sox支持音頻播放、格式轉(zhuǎn)換、音頻錄制、添加音效。下面分別進(jìn)行介紹,精彩依然在繼續(xù)。

1、播放音頻

最簡單的播放:play tiger.mp3

連續(xù)播放多個:play tiger.mp3 hello.mp3

控制播放音量:play -v 0.5 tiger.mp3

控制播放速度:play tiger.mp3 tempo 0.5

2、格式轉(zhuǎn)換

使用-c指定聲道數(shù),-r指定采樣率,-b指定采樣位數(shù)。

mp3轉(zhuǎn)為ogg:sox tiger.mp3 -c 2 -r 44100 hello.ogg

2個音頻混音:sox -m tiger.mp3 hello.mp3 mix.mp3

2個音頻拼接:sox tiger.mp3 hello.mp3 concat.mp3

3、音頻錄制

錄制一段10s的音頻:rec -c 2 -r 16000 test.mp3 trim 0 00:10

4、添加音效

1)混響reverb:play tiger.mp3 reverb

2)空靈echo:play tiger.mp3 echo 0.8 0.9 1000 0.6 (gain-in gain-out?<delay decay>)

3)增益gain:play tiger.mp3 gain -l 6

4)轉(zhuǎn)換聲道remix:sox tiger.mp3 mono.mp3 remix 1

5)音調(diào)pitch

? ? ? ? 蘿莉:play tiger.mp3 pitch -q 500

?? ? ? ?大叔:play tiger.mp3 pitch -q -1000

6)搞怪tempo:play tiger.mp3 tempo 2

7)顫抖tremolo:play tiger.mp3 tremolo 3.5 60

8)均衡器equalizer:play tiger.mp3 equalizer 4585 10.17q +9.4 equalizer 5356?4.33q +8.4 equalizer 6627?3.58q +7.5 equalizer 11297?2.62q +6.2

可以到GitHub一起學(xué)習(xí)音視頻:GitHub - xufuji456/FFmpegAndroid: android端基于FFmpeg實現(xiàn)音頻剪切、拼接、轉(zhuǎn)碼、編解碼;視頻剪切、水印、截圖、轉(zhuǎn)碼、編解碼、轉(zhuǎn)Gif動圖;音視頻合成與分離,配音;音視頻解碼、同步與播放;FFmpeg本地推流、H264與RTMP實時推流直播;FFmpeg濾鏡:素描、色彩平衡、hue、lut、模糊、九宮格等;歌詞解析與顯示???????

總結(jié)

以上是生活随笔為你收集整理的sox语音开源库的功能剖析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。