TW201905903A - Audio control device and method thereof - Google Patents
Audio control device and method thereofInfo
- Publication number
- TW201905903A TW201905903A TW106120798A TW106120798A TW201905903A TW 201905903 A TW201905903 A TW 201905903A TW 106120798 A TW106120798 A TW 106120798A TW 106120798 A TW106120798 A TW 106120798A TW 201905903 A TW201905903 A TW 201905903A
- Authority
- TW
- Taiwan
- Prior art keywords
- audio signal
- raspberry
- noise
- echo
- microcomputer
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 14
- 230000005236 sound signal Effects 0.000 claims abstract description 67
- 238000013515 script Methods 0.000 claims abstract description 24
- 230000000694 effects Effects 0.000 claims description 30
- 230000001629 suppression Effects 0.000 claims description 14
- 235000011034 Rubus glaucus Nutrition 0.000 claims description 7
- 235000009122 Rubus idaeus Nutrition 0.000 claims description 7
- 240000007651 Rubus glaucus Species 0.000 claims description 6
- 230000005764 inhibitory process Effects 0.000 claims 1
- 238000010586 diagram Methods 0.000 description 4
- 241000282326 Felis catus Species 0.000 description 1
- 244000235659 Rubus idaeus Species 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
Landscapes
- Circuit For Audible Band Transducer (AREA)
Abstract
Description
本發明是有關於一種控制裝置及其方法,特別是有關於一種音訊控制裝置及其方法。The present invention relates to a control device and method thereof, and more particularly to an audio control device and method therefor.
響度控制是音訊處理不可或缺的一環。音量動態範圍過大的音樂或影片播放時,常為人所詬病之處在於音量大時常會造成驚嚇;又如音量小(如電影對白)的片段常需手動調整音量才能聽清楚,但切換動作場景時,因無法及時調整回原音量而突然被其音效嚇到。Loudness control is an indispensable part of audio processing. When the music or video with too loud volume dynamic range is played, it is often criticized that when the volume is loud, it often causes frightening; for example, the segment with small volume (such as movie dialogue) often needs to manually adjust the volume to hear clearly, but switch the action scene. When it was unable to adjust the original volume in time, it was suddenly scared by its sound.
有鑑於上述習知之問題,本發明的目的在於提供一種音訊控制裝置,用以解決習知技術中所面臨之問題。In view of the above-mentioned problems, it is an object of the present invention to provide an audio control device for solving the problems faced by the prior art.
基於上述目的,本發明係提供一種音訊控制裝置,係包含樹莓派微電腦及音效卡。樹莓派微電腦安裝有音效插件、音效套件及指令層腳本。音效卡連結樹莓派微電腦,且輸入原始音頻訊號,樹莓派微電腦通過音效插件調整原始音頻訊號之輸入音量以產生輸入音頻訊號,且讀取輸入音頻訊號中複數個輸入訊框的其中之一,且對應輸入訊框的複數個取樣產生複數個響度值,依據複數個響度值計算加權平均響度值,再依據加權平均響度值及限制峰值提升輸入音頻訊號之整體音量而產生提升音頻訊號,樹莓派微電腦擷取提升音頻訊號之雜訊音頻訊號,再將雜訊音頻訊號輸入音效套件以產生左右聲道分離且各含1024個頻段雜訊抑制係數之文字檔,樹莓派微電腦依據文字檔且配合音效套件及指令層腳本對提升音頻訊號進行進階雜訊抑制,再由該音效卡輸出。Based on the above object, the present invention provides an audio control device, which comprises a Raspberry Pi microcomputer and a sound card. The Raspberry Pi PC is equipped with audio plug-ins, sound effects kits, and command-level scripts. The sound card is connected to the Raspberry Pi microcomputer and the original audio signal is input. The Raspberry Pi microcomputer adjusts the input volume of the original audio signal through the sound plug-in to generate an input audio signal, and reads one of the plurality of input frames in the input audio signal. And a plurality of samples corresponding to the input frame generate a plurality of loudness values, calculate a weighted average loudness value according to the plurality of loudness values, and then generate a boosted audio signal according to the weighted average loudness value and the limit peak to increase the overall volume of the input audio signal, the tree The Raspberry Pi computer captures the noise signal of the audio signal, and then inputs the noise audio signal into the sound effect kit to generate the text file of the 1024-band noise suppression coefficient separated by the left and right channels. The Raspberry Pi microcomputer is based on the text file. And with the sound effect kit and the command layer script to improve the audio signal for advanced noise suppression, and then output by the sound card.
較佳地,樹莓派微電腦可包含儲存單元,其安裝有作業系統。Preferably, the Raspberry Pi microcomputer can include a storage unit that is equipped with an operating system.
基於上述目的,本發明再提供一種音訊控制方法,適用於音訊控制裝置,音訊控制裝置包含樹莓派微電腦及音效卡,樹莓派微電腦連接音效卡,音訊控制方法包含下列步驟:安裝音效插件、音效套件及指令層腳本。輸入原始音頻訊號。通過音效插件調整原始音頻訊號之輸入音量以產生輸入音頻訊號。讀取輸入音頻訊號中複數個輸入訊框的其中之一。對應輸入訊框的複數個取樣產生複數個響度值。依據複數個響度值計算加權平均響度值。依據加權平均響度值及限制峰值提升輸入音頻訊號之整體音量而產生提升音頻訊號。擷取提升音頻訊號之雜訊音頻訊號。輸入雜訊音頻訊號至音效套件以產生左右聲道分離且各含1024個頻段雜訊抑制係數之文字檔。依據文字檔且配合音效套件及指令層腳本對提升音頻訊號進行進階雜訊抑制後再輸出。Based on the above object, the present invention further provides an audio control method, which is suitable for an audio control device. The audio control device includes a Raspberry Pi microcomputer and a sound card, and the Raspberry Pi microcomputer connects the sound card. The audio control method includes the following steps: installing an audio plug-in, Sound effects suite and command layer scripts. Enter the original audio signal. The input volume of the original audio signal is adjusted by the sound effects plug-in to generate an input audio signal. Read one of the input frames in the input audio signal. A plurality of samples corresponding to the input frame generate a plurality of loudness values. The weighted average loudness value is calculated from a plurality of loudness values. The boosted audio signal is generated by increasing the overall volume of the input audio signal based on the weighted average loudness value and the limit peak. Capture the noise audio signal that enhances the audio signal. The noise audio signal is input to the sound effect kit to generate a text file in which the left and right channels are separated and each has a noise suppression coefficient of 1024 bands. According to the text file and with the sound effect kit and the command layer script, the advanced audio suppression of the audio signal is performed and then output.
承上所述,本發明之音訊控制裝置透過樹莓派微電腦搭配音效模卡,輔以適當系統軟體組態以達到擴大音量及抑制音頻雜音之功效。As described above, the audio control device of the present invention is coupled with a sound effect card through a Raspberry Pi microcomputer, supplemented by an appropriate system software configuration to achieve an effect of expanding the volume and suppressing audio noise.
為利貴審查員瞭解本發明之特徵、內容與優點及其所能達成之功效,茲將本發明配合圖式,並以實施例之表達形式詳細說明如下,而其中所使用之圖式,其主旨僅為示意及輔助說明書之用,未必為本發明實施後之真實比例與精準配置,故不應就所附之圖式的比例與配置關係解讀、侷限本發明於實際實施上的權利範圍。The features, contents, and advantages of the present invention, as well as the advantages thereof, will be understood by the present invention. The present invention will be described in detail with reference to the accompanying drawings. The use of the present invention is not intended to be a limitation of the scope of the present invention, and the scope of the present invention is not limited by the scope and configuration of the accompanying drawings.
本發明之優點、特徵以及達到之技術方法將參照例示性實施例及所附圖式進行更詳細地描述而更容易理解,且本發明或可以不同形式來實現,故不應被理解僅限於此處所陳述的實施例,相反地,對所屬技術領域具有通常知識者而言,所提供的實施例將使本揭露更加透徹與全面且完整地傳達本發明的範疇,且本發明將僅為所附加的申請專利範圍所定義。The advantages and features of the present invention, as well as the technical methods of the present invention, are described in more detail with reference to the exemplary embodiments and the accompanying drawings, and the present invention may be implemented in various forms and should not be construed as limited thereby. The embodiments of the present invention, and the embodiments of the present invention are intended to provide a more complete and complete and complete disclosure of the scope of the present invention, and The scope of the patent application is defined.
請參閱第1圖,其係為本發明之音訊控制裝置之第一方塊圖。如圖所示,本發明之音訊控制裝置100包含了樹莓派微電腦110及音效卡120。Please refer to FIG. 1 , which is a first block diagram of the audio control device of the present invention. As shown, the audio control device 100 of the present invention includes a Raspberry Pi microcomputer 110 and a sound card 120.
續言之,上述所提到之樹莓派微電腦110安裝有音效插件、音效套件及指令層腳本。In other words, the Raspberry Pi microcomputer 110 mentioned above is equipped with an audio plug-in, a sound effect kit, and an instruction layer script.
而,音效卡120連結樹莓派微電腦110,且輸入原始音頻訊號,樹莓派微電腦110通過音效插件調整原始音頻訊號之輸入音量以產生輸入音頻訊號,且讀取輸入音頻訊號中複數個輸入訊框的其中之一,且對應輸入訊框的複數個取樣產生複數個響度值,依據複數個響度值計算加權平均響度值,再依據加權平均響度值及限制峰值提升輸入音頻訊號之整體音量而產生提升音頻訊號,樹莓派微電腦110擷取提升音頻訊號之雜訊音頻訊號,再將雜訊音頻訊號輸入音效套件以產生左右聲道分離且各含1024個頻段雜訊抑制係數之文字檔,樹莓派微電腦110依據文字檔且配合音效套件及指令層腳本對提升音頻訊號進行進階雜訊抑制,再由該音效卡120輸出。The sound card 120 is connected to the raspberry pie microcomputer 110, and the original audio signal is input. The Raspberry Pi microcomputer 110 adjusts the input volume of the original audio signal through the sound plug-in to generate an input audio signal, and reads a plurality of input signals in the input audio signal. One of the frames, and a plurality of samples corresponding to the input frame generate a plurality of loudness values, calculate a weighted average loudness value according to the plurality of loudness values, and then increase the overall volume of the input audio signal according to the weighted average loudness value and the limit peak value. To enhance the audio signal, the Raspberry Pi microcomputer 110 captures the noise signal of the audio signal, and then inputs the noise audio signal into the sound effect kit to generate a text file with left and right channels separated and each containing 1024 frequency band noise suppression coefficients. The Raspberry Pi computer 110 performs advanced noise suppression on the boosted audio signal according to the text file and the sound effect kit and the command layer script, and then outputs the sound card 120.
請參閱第2圖,其係為本發明之音訊控制裝置之第二方塊圖。如圖所示,樹莓派微電腦110包含儲存單元111,其安裝有作業系統。Please refer to FIG. 2, which is a second block diagram of the audio control device of the present invention. As shown, the Raspberry Pi microcomputer 110 includes a storage unit 111 that is equipped with an operating system.
進一步地,本發明旨在透過樹莓派微電腦110搭配音效卡120,輔以適當系統軟體組態以實作攜帶式擴大機(通稱「耳放」)裝置。藉由樹莓派微電腦110作業系統的內建ALSA音效驅動應用程式、LADSPA外掛及Bash流程控制,加上第三方套件如SoX與bc處理運算後,實現均衡響度(Loudness Equalization)效果。Further, the present invention aims to implement a portable amplifier (commonly referred to as an "Amp") device by using a Raspberry Pi microcomputer 110 with a sound card 120, supplemented by an appropriate system software configuration. With the built-in ALSA sound driver application, LADSPA plug-in and Bash flow control of the Raspberry Pi Microcomputer 110 operating system, and third-party suites such as SoX and bc processing, the effect of Loudness Equalization is achieved.
更詳細地說,本發明係採用Raspberry Pi 3(樹莓派微電腦110)搭配Cirrus Logic音效卡(音效卡120)結合使用。首先安裝音效卡120至樹莓派微電腦110之主機板GPIO插槽,並灌入Raspbian作業系統至SD卡(樹莓派微電腦110之儲存單元111),接著開機調整ALSA組態設定。In more detail, the present invention uses a Raspberry Pi 3 (Raspberry Pi Microcomputer 110) in combination with a Cirrus Logic sound card (Audio Card 120). First install the sound card 120 to the motherboard GPIO slot of the Raspberry Pi microcomputer 110, and fill the Raspbian operating system to the SD card (the storage unit 111 of the Raspberry Pi microcomputer 110), and then adjust the ALSA configuration settings.
再採用系統已內建的LADSPA(Linux音效驅動效果插件)之sc4元件(音效插件),先調整原始音頻訊號之輸入音量,再用fastLookaheadLimiter提升整體音量並限制相關峰值後,實作將小聲變大聲而大聲動態保持範圍控制。Then use the system's built-in LADSPA (Linux sound effect plug-in) sc4 component (sound plug-in), first adjust the input volume of the original audio signal, and then use fastLookaheadLimiter to increase the overall volume and limit the correlation peak, the implementation will be small Loud and loud dynamics maintain range control.
接著,擷取雜訊,錄製成.WAV音訊檔作為SoX(音效套件)的Noiserprof輸入來源,以產生一個左右聲道分離,且各含1024個頻段雜訊抑制係數的文字檔。Then, the noise is captured and recorded as a .WAV audio file as the Noiserprof input source of the SoX (sound suite) to generate a text file with left and right channel separations, each containing 1024 frequency band noise suppression coefficients.
再用文字檔搭配SoX的Noisered效果,以及搭配指令層腳本即實現基本的雜訊抑制功能。其中,指令層腳本可為複數個,如下所示(其僅為舉例,並不以此為限): 《init》腳本: #!/bin/bash /home/pi/bin/Reset_paths.sh /home/pi/bin/rpi-cirrus-functions.sh /home/pi/bin/Record_from_Linein.sh /home/pi/bin/Playback_to_Headset.sh sudo modprobe snd-aloop pcm_substreams=1 《leafpad》腳本: sudo leafpad | sudo pcmanfm 《main》腳本: #!/bin/bash IFS=', ' read -r -a noise < "/home/pi/Desktop/target.noise" for ((;;)) do #sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.00003 #sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.1908 sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 1.2 sox "/home/pi/Desktop/bar.wav" -n noiseprof "/home/pi/Desktop/tmp.noise" IFS=', ' read -r -a now < "/home/pi/Desktop/tmp.noise" diff0=$(echo "(${noise[4]})-(${now[4]})"|bc) ratio0=$(echo "scale=6;$diff0 / (${noise[4]})"|bc) diff1=$(echo "(${noise[7]})-(${now[7]})"|bc) ratio1=$(echo "scale=6;$diff1 / (${noise[7]})"|bc) diff2=$(echo "(${noise[10]})-(${now[10]})"|bc) ratio2=$(echo "scale=6;$diff2 / (${noise[10]})"|bc) diff3=$(echo "(${noise[21]})-(${now[21]})"|bc) ratio3=$(echo "scale=6;$diff3 / (${noise[21]})"|bc) diff4=$(echo "(${noise[31]})-(${now[31]})"|bc) ratio4=$(echo "scale=6;$diff4 / (${noise[31]})"|bc) diff5=$(echo "(${noise[90]})-(${now[90]})"|bc) ratio5=$(echo "scale=6;$diff5 / (${noise[90]})"|bc) diff6=$(echo "(${noise[175]})-(${now[175]})"|bc) ratio6=$(echo "scale=6;$diff6 / (${noise[175]})"|bc) diff7=$(echo "(${noise[415]})-(${now[415]})"|bc) ratio7=$(echo "scale=6;$diff7 / (${noise[415]})"|bc) if [[ $(echo "$ratio0 < 0"|bc) -eq 1 ]]; then ratio0=$(echo "($ratio0) * (-1)"|bc) fi if [[ $(echo "$ratio1 < 0"|bc) -eq 1 ]]; then ratio1=$(echo "$ratio1 * (-1)"|bc) fi if [[ $(echo "$ratio2 < 0"|bc) -eq 1 ]]; then ratio2=$(echo "$ratio2 * (-1)"|bc) fi if [[ $(echo "$ratio3 < 0"|bc) -eq 1 ]]; then ratio3=$(echo "($ratio3) * (-1)"|bc) fi if [[ $(echo "$ratio4 < 0"|bc) -eq 1 ]]; then ratio4=$(echo "$ratio4 * (-1)"|bc) fi if [[ $(echo "$ratio5 < 0"|bc) -eq 1 ]]; then ratio5=$(echo "$ratio5 * (-1)"|bc) fi if [[ $(echo "$ratio6 < 0"|bc) -eq 1 ]]; then ratio6=$(echo "$ratio6 * (-1)"|bc) fi if [[ $(echo "$ratio7 < 0"|bc) -eq 1 ]]; then ratio7=$(echo "($ratio7) * (-1)"|bc) fi if [[ $ratio0 == "" ]]; then continue fi if [[ $ratio1 == "" ]]; then continue fi if [[ $ratio2 == "" ]]; then continue fi if [[ $ratio3 == "" ]]; then continue fi if [[ $ratio4 == "" ]]; then continue fi if [[ $ratio5 == "" ]]; then continue fi if [[ $(echo "$ratio5 == .102654"|bc) -eq 1 ]]; then continue fi if [[ $ratio6 == "" ]]; then continue fi if [[ $(echo "$ratio6 == .161569"|bc) -eq 1 ]]; then continue fi if [[ $ratio7 == "" ]]; then continue fi comp0=$(echo "(($ratio0)>=1.2) && (($ratio0)<=3.4)"|bc) comp1=$(echo "(($ratio1)>=1.8) && (($ratio1)<=5.0)"|bc) comp2=$(echo "(($ratio2)>=1.7) && (($ratio2)<=6.1)"|bc) comp3=$(echo "(($ratio3)>=2.1) && (($ratio3)<=6.8)"|bc) comp4=$(echo "(($ratio4)>=3.2) && (($ratio4)<=11.3)"|bc) comp5=$(echo "(($ratio5)>=24) && (($ratio5)<=52)"|bc) comp6=$(echo "(($ratio6)>=12.5) && (($ratio6)<=25)"|bc) comp7=$(echo "(($ratio7)>=2.5) && (($ratio2)<=4.8)"|bc) # comp8=$(echo "(($ratio3)>=1.6) && (($ratio3)<=5.1)"|bc) # comp9=$(echo "(($ratio4)>=2.5) && (($ratio4)<=9.4)"|bc) # if [[ $comp2 -eq 1 ]]; then # continue # fi if [[ $(echo "($comp0) && ($comp1) && ($comp2) && ($comp3) && ($comp4) && ($comp5) && ($comp6) && ($comp7)"|bc) -eq 1 ]]; then amixer -c 0 -- sset "HPOUT1 Digital" playback -120dB else vol=$(cat /home/pi/Desktop/volume.ctl) amixer -c 0 -- sset "HPOUT1 Digital" playback $vol ## echo "$ratio0" >> /home/pi/Desktop/ratio0.txt ## echo "$ratio1" >> /home/pi/Desktop/ratio1.txt ## echo "$ratio2" >> /home/pi/Desktop/ratio2.txt ## echo "$ratio3" >> /home/pi/Desktop/ratio3.txt ## echo "$ratio4" >> /home/pi/Desktop/ratio4.txt ## echo "$ratio5" >> /home/pi/Desktop/ratio5.txt ## echo "$ratio6" >> /home/pi/Desktop/ratio6.txt fi done 《newprobe》腳本: #!/bin/bash # interval=22050Hz/1024=21.533Hz, mono array starts from 2 to 1026. IFS=', ' read -r -a noise < "/home/pi/Desktop/target.noise" for ((;;)) do #sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.00003 #sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.1908 sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.3 sox "/home/pi/Desktop/bar.wav" -n noiseprof "/home/pi/Desktop/tmp.noise" IFS=', ' read -r -a now < "/home/pi/Desktop/tmp.noise" diff0=$(echo "(${noise[415]})-(${now[415]})"|bc) ratio0=$(echo "scale=6;$diff0 / (${noise[415]})"|bc) diff1=$(echo "(${noise[7]})-(${now[7]})"|bc) ratio1=$(echo "scale=6;$diff1 / (${noise[7]})"|bc) diff2=$(echo "(${noise[10]})-(${now[10]})"|bc) ratio2=$(echo "scale=6;$diff2 / (${noise[10]})"|bc) diff3=$(echo "(${noise[21]})-(${now[21]})"|bc) ratio3=$(echo "scale=6;$diff3 / (${noise[21]})"|bc) diff4=$(echo "(${noise[31]})-(${now[31]})"|bc) ratio4=$(echo "scale=6;$diff4 / (${noise[31]})"|bc) if [[ $(echo "$ratio0 < 0"|bc) -eq 1 ]]; then ratio0=$(echo "($ratio0) * (-1)"|bc) fi if [[ $(echo "$ratio1 < 0"|bc) -eq 1 ]]; then ratio1=$(echo "$ratio1 * (-1)"|bc) fi if [[ $(echo "$ratio2 < 0"|bc) -eq 1 ]]; then ratio2=$(echo "$ratio2 * (-1)"|bc) fi if [[ $(echo "$ratio3 < 0"|bc) -eq 1 ]]; then ratio3=$(echo "($ratio3) * (-1)"|bc) fi if [[ $(echo "$ratio4 < 0"|bc) -eq 1 ]]; then ratio4=$(echo "$ratio4 * (-1)"|bc) fi echo "$ratio0" >> /home/pi/Desktop/ratio7.txt # echo "$ratio1" >> /home/pi/Desktop/ratio6.txt # echo "$ratio2" >> /home/pi/Desktop/ratio2.txt # echo "$ratio3" >> /home/pi/Desktop/ratio3.txt # echo "$ratio4" >> /home/pi/Desktop/ratio4.txt done 《noiseprobe》腳本: #!/bin/bash # interval=22050Hz/1024=21.533Hz, mono array starts from 2 to 1026. IFS=', ' read -r -a noise < "/home/pi/Desktop/target.noise" for ((;;)) do #sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.00003 #sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.1908 sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.03 sox "/home/pi/Desktop/bar.wav" -n noiseprof "/home/pi/Desktop/tmp.noise" IFS=', ' read -r -a now < "/home/pi/Desktop/tmp.noise" diff0=$(echo "(${noise[4]})-(${now[4]})"|bc) ratio0=$(echo "scale=6;$diff0 / (${noise[4]})"|bc) diff1=$(echo "(${noise[7]})-(${now[7]})"|bc) ratio1=$(echo "scale=6;$diff1 / (${noise[7]})"|bc) diff2=$(echo "(${noise[10]})-(${now[10]})"|bc) ratio2=$(echo "scale=6;$diff2 / (${noise[10]})"|bc) diff3=$(echo "(${noise[21]})-(${now[21]})"|bc) ratio3=$(echo "scale=6;$diff3 / (${noise[21]})"|bc) diff4=$(echo "(${noise[31]})-(${now[31]})"|bc) ratio4=$(echo "scale=6;$diff4 / (${noise[31]})"|bc) if [[ $(echo "$ratio0 < 0"|bc) -eq 1 ]]; then ratio0=$(echo "($ratio0) * (-1)"|bc) fi if [[ $(echo "$ratio1 < 0"|bc) -eq 1 ]]; then ratio1=$(echo "$ratio1 * (-1)"|bc) fi if [[ $(echo "$ratio2 < 0"|bc) -eq 1 ]]; then ratio2=$(echo "$ratio2 * (-1)"|bc) fi if [[ $(echo "$ratio3 < 0"|bc) -eq 1 ]]; then ratio3=$(echo "($ratio3) * (-1)"|bc) fi if [[ $(echo "$ratio4 < 0"|bc) -eq 1 ]]; then ratio4=$(echo "$ratio4 * (-1)"|bc) fi echo "$ratio0" >> /home/pi/Desktop/ratio5.txt #echo "$ratio1" >> /home/pi/Desktop/ratio1.txt #echo "$ratio2" >> /home/pi/Desktop/ratio2.txt #echo "$ratio3" >> /home/pi/Desktop/ratio3.txt #echo "$ratio4" >> /home/pi/Desktop/ratio4.txt done 《snd-aloop》腳本: #!/bin/bash for ((;;)) do #arecord -M -t wav -f S16_LE -B 0.01 -F 64 -r48000 -c2 -D hw:0 | sox -L -twav -r48000 -c2 - -L -twav -r48000 -c2 - noisered /home/pi/Desktop/mod.prof 0| aplay -B 0.01 -F 64 -M arecord -M -t wav -f S16_LE -B 0.01 -F 64 -r48000 -c2 -D hw:0 | aplay -B 0.01 -F 64 -M done 《start》腳本: /home/pi/Desktop/init.sh sleep 10 ; /home/pi/Desktop/snd-aloop.sh & sleep 15 ; /home/pi/Desktop/main.sh &The text file is paired with SoX's Noisered effect, and the command layer script is used to implement basic noise suppression. Among them, the command layer script can be plural, as shown below (it is only an example, not limited to this): "init" script: #!/bin/bash /home/pi/bin/Reset_paths.sh /home /pi/bin/rpi-cirrus-functions.sh /home/pi/bin/Record_from_Linein.sh /home/pi/bin/Playback_to_Headset.sh sudo modprobe snd-aloop pcm_substreams=1 "leafpad" script: sudo leafpad | sudo pcmanfm "main" script: #!/bin/bash IFS=', ' read -r -a noise < "/home/pi/Desktop/target.noise" for ((;;)) do #sox -r 48000 -t Alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.00003 #sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/ Pi/Desktop/bar.wav" trim 0 0.1908 sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 1.2 sox "/home/pi /Desktop/bar.wav" -n noiseprof "/home/pi/Desktop/tmp.noise" IFS=', ' read -r -a now < "/home/pi/Desktop/tmp.noise" diff0=$( Echo "(${noise[4]})-(${now[4]})"|bc) ratio0=$(echo "scale=6;$diff0 / (${noise[4]})"|bc ) diff1=$(echo "(${noise[7]})-(${now[7]})"|bc) ratio1=$(e Cho "scale=6;$diff1 / (${noise[7]})"|bc) diff2=$(echo "(${noise[10]})-(${now[10]})"|bc ) ratio2=$(echo "scale=6;$diff2 / (${noise[10]})"|bc) diff3=$(echo "(${noise[21]})-(${now[21] })"|bc) ratio3=$(echo "scale=6;$diff3 / (${noise[21]})"|bc) diff4=$(echo "(${noise[31]})-($ {now[31]})"|bc) ratio4=$(echo "scale=6;$diff4 / (${noise[31]})"|bc) diff5=$(echo "(${noise[90] })-(${now[90]})"|bc) ratio5=$(echo "scale=6;$diff5 / (${noise[90]})"|bc) diff6=$(echo "($ {noise[175]})-(${now[175]})"|bc) ratio6=$(echo "scale=6;$diff6 / (${noise[175]})"|bc) diff7=$ (echo "(${noise[415]})-(${now[415]})"|bc) ratio7=$(echo "scale=6;$diff7 / (${noise[415]})"| Bc) if [[ $(echo "$ratio0 < 0"|bc) -eq 1 ]]; then ratio0=$(echo "($ratio0) * (-1)"|bc) fi if [[ $(echo "$ratio1 < 0"|bc) -eq 1 ]]; then ratio1=$(echo "$ratio1 * (-1)"|bc) fi if [[ $(echo "$ratio2 < 0"|bc) - Eq 1 ]]; then ratio2=$(echo "$ratio2 * (-1)"|bc) fi if [[ $(echo "$ratio3 < 0"|bc) -eq 1 ]]; then ratio3=$( Echo "($ratio3) * (-1)"|bc) fi if [[ $(ech o "$ratio4 < 0"|bc) -eq 1 ]]; then ratio4=$(echo "$ratio4 * (-1)"|bc) fi if [[ $(echo "$ratio5 < 0"|bc) -eq 1 ]]; then ratio5=$(echo "$ratio5 * (-1)"|bc) fi if [[ $(echo "$ratio6 < 0"|bc) -eq 1 ]]; then ratio6=$ (echo "$ratio6 * (-1)"|bc) fi if [[ $(echo "$ratio7 < 0"|bc) -eq 1 ]]; then ratio7=$(echo "($ratio7) * (- 1)"|bc) fi if [[ $ratio0 == "" ]]; then continue fi if [[ $ratio1 == "" ]]; then continue fi if [[ $ratio2 == "" ]]; then Continue fi if [[ $ratio3 == "" ]]; then continue fi if [[ $ratio4 == "" ]]; then continue fi if [[ $ratio5 == "" ]]; then continue fi if [[ $(echo "$ratio5 == .102654"|bc) -eq 1 ]]; then continue fi if [[ $ratio6 == "" ]]; then continue fi if [[ $(echo "$ratio6 == . 161569"|bc) -eq 1 ]]; then continue fi if [[ $ratio7 == "" ]]; then continue fi comp0=$(echo "(($ratio0)>=1.2) && (($ratio0) <=3.4)"|bc) comp1=$(echo "(($ratio1)>=1.8) && (($ratio1)<=5.0)"|bc) comp2=$(echo "(($ratio2)>= 1.7) && (($ratio2)<=6.1)"|bc) comp3=$(echo "(($ratio3)> =2.1) && (($ratio3)<=6.8)"|bc) comp4=$(echo "(($ratio4)>=3.2) && (($ratio4)<=11.3)"|bc) comp5=$( Echo "(($ratio5)>=24) && (($ratio5)<=52)"|bc) comp6=$(echo "(($ratio6)>=12.5) && (($ratio6)<=25) "|bc) comp7=$(echo "(($ratio7)>=2.5) && (($ratio2)<=4.8)"|bc) # comp8=$(echo "(($ratio3)>=1.6) && (($ratio3)<=5.1)"|bc) # comp9=$(echo "(($ratio4)>=2.5) && (($ratio4)<=9.4)"|bc) # if [[ $comp2 - Eq 1 ]]; then # continue # fi if [[ $(echo "($comp0) && ($comp1) && ($comp2) && ($comp3) && ($comp4) && ($comp5) && ($comp6 ) && ($comp7)"|bc) -eq 1 ]]; then amixer -c 0 -- sset "HPOUT1 Digital" playback -120dB else vol=$(cat /home/pi/Desktop/volume.ctl) amixer - c 0 -- sset "HPOUT1 Digital" playback $vol ## echo "$ratio0" >> /home/pi/Desktop/ratio0.txt ## echo "$ratio1" >> /home/pi/Desktop/ratio1.txt ## echo "$ratio2" >> /home/pi/Desktop/ratio2.txt ## echo "$ratio3" >> /home/pi/Desktop/ratio3.txt ## echo "$ratio4" >> /home/ Pi/Desktop/ratio4.txt ## echo "$ratio5" >> /home/pi/Desktop/ratio5.txt ## echo "$ratio6" >> /home/pi/Desktop/ratio6.txt fi done "newprobe" script: #!/bin/bash # interval=22050Hz/1024 =21.533Hz, mono array starts from 2 to 1026. IFS=', ' read -r -a noise < "/home/pi/Desktop/target.noise" for ((;;)) do #sox -r 48000 - t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.00003 #sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home /pi/Desktop/bar.wav" trim 0 0.1908 sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.3 sox "/home/ Pi/Desktop/bar.wav" -n noiseprof "/home/pi/Desktop/tmp.noise" IFS=', ' read -r -a now < "/home/pi/Desktop/tmp.noise" diff0=$ (echo "(${noise[415]})-(${now[415]})"|bc) ratio0=$(echo "scale=6;$diff0 / (${noise[415]})"| Bc) diff1=$(echo "(${noise[7]})-(${now[7]})"|bc) ratio1=$(echo "scale=6;$diff1 / (${noise[7 ]})"|bc) diff2=$(echo "(${noise[10]})-(${now[10]})"|bc) ratio2=$(echo "scale=6;$diff2 / ( ${noise[10]})"|bc) diff3=$(echo "(${noise[21]})-(${now[21]})" |bc) ratio3=$(echo "scale=6;$diff3 / (${noise[21]})"|bc) diff4=$(echo "(${noise[31]})-(${now[ 31]})"|bc) ratio4=$(echo "scale=6;$diff4 / (${noise[31]})"|bc) if [[ $(echo "$ratio0 < 0"|bc) - Eq 1 ]]; then ratio0=$(echo "($ratio0) * (-1)"|bc) fi if [[ $(echo "$ratio1 < 0"|bc) -eq 1 ]]; then ratio1= $(echo "$ratio1 * (-1)"|bc) fi if [[ $(echo "$ratio2 < 0"|bc) -eq 1 ]]; then ratio2=$(echo "$ratio2 * (-1 )"|bc) fi if [[ $(echo "$ratio3 < 0"|bc) -eq 1 ]]; then ratio3=$(echo "($ratio3) * (-1)"|bc) fi if [ [ $(echo "$ratio4 < 0"|bc) -eq 1 ]]; then ratio4=$(echo "$ratio4 * (-1)"|bc) fi echo "$ratio0" >> /home/pi/ Desktop/ratio7.txt # echo "$ratio1" >> /home/pi/Desktop/ratio6.txt # echo "$ratio2" >> /home/pi/Desktop/ratio2.txt # echo "$ratio3" >> / Home/pi/Desktop/ratio3.txt # echo "$ratio4" >> /home/pi/Desktop/ratio4.txt done "noiseprobe" script: #!/bin/bash # interval=22050Hz/1024=21.533Hz, mono Array starts from 2 to 1026. IFS=', ' read -r -a noise < "/home/pi/D Esktop/target.noise" for ((;;)) do #sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.00003 #sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.1908 sox -r 48000 -t alsa hw:1,1 -r 48000 -t wav "/home/pi/Desktop/bar.wav" trim 0 0.03 sox "/home/pi/Desktop/bar.wav" -n noiseprof "/home/pi/Desktop/tmp.noise" IFS=', ' read - r -a now < "/home/pi/Desktop/tmp.noise" diff0=$(echo "(${noise[4]})-(${now[4]})"|bc) ratio0=$( Echo "scale=6;$diff0 / (${noise[4]})"|bc) diff1=$(echo "(${noise[7]})-(${now[7]})"|bc ) ratio1=$(echo "scale=6;$diff1 / (${noise[7]})"|bc) diff2=$(echo "(${noise[10]})-(${now[10] })"|bc) ratio2=$(echo "scale=6;$diff2 / (${noise[10]})"|bc) diff3=$(echo "(${noise[21]})-($ {now[21]})"|bc) ratio3=$(echo "scale=6;$diff3 / (${noise[21]})"|bc) diff4=$(echo "(${noise[31] })-(${now[31]})"|bc) ratio4=$(echo "scale=6;$diff4 / (${noise[31]})"|bc) if [[ $(echo "$ Ratio0 < 0"|bc) -eq 1 ]]; then ratio0=$(echo "($ratio0) * (-1)"|bc) fi if [[ $(echo "$ratio1 < 0"|bc) -eq 1 ]]; then ratio1=$(echo "$ratio1 * (-1)"|bc) fi if [[ $(echo "$ratio2 < 0 "|bc) -eq 1 ]]; then ratio2=$(echo "$ratio2 * (-1)"|bc) fi if [[ $(echo "$ratio3 < 0"|bc) -eq 1 ]]; Then ratio3=$(echo "($ratio3) * (-1)"|bc) fi if [[ $(echo "$ratio4 < 0"|bc) -eq 1 ]]; then ratio4=$(echo "$ Ratio4 * (-1)"|bc) fi echo "$ratio0" >> /home/pi/Desktop/ratio5.txt #echo "$ratio1" >> /home/pi/Desktop/ratio1.txt #echo "$ Ratio2" >> /home/pi/Desktop/ratio2.txt #echo "$ratio3" >> /home/pi/Desktop/ratio3.txt #echo "$ratio4" >> /home/pi/Desktop/ratio4.txt Done "snd-aloop" script: #!/bin/bash for ((;;)) do #arecord -M -t wav -f S16_LE -B 0.01 -F 64 -r48000 -c2 -D hw:0 | sox - L -twav -r48000 -c2 - -L -twav -r48000 -c2 - noisered /home/pi/Desktop/mod.prof 0| aplay -B 0.01 -F 64 -M arecord -M -t wav -f S16_LE -B 0.01 -F 64 -r48000 -c2 -D hw:0 | aplay -B 0.01 -F 64 -M done "start" script: /home/pi/Desktop/init.sh sleep 10 ; /home/pi/Desktop/snd - Aloop.sh & sleep 15 ; /home/pi/Desktop/main.sh &
進一步地,為了實現即時播放功能,使用單純的管線指令將arecord、sox及aplay串連,再透過另外執行的SoX即時回傳Loopback裝置的雜訊抑制係數,再進行運算以進行進階雜訊抑制,使音量藉由amixer即時控制音量輸出,以實時均衡響度之目的。Further, in order to realize the instant play function, arecord, sox and aplay are connected in series using a simple pipeline instruction, and the noise suppression coefficient of the Loopback device is immediately returned through the additionally executed SoX, and then the operation is performed to perform advanced noise suppression. The volume is controlled by the amixer to instantly control the volume output to balance the loudness in real time.
此外,若手機接上樹莓派微電腦110之USB插孔,再接上音效卡120的線路輸入播放時可明顯聽到電流雜音;本發明可調整雜訊聲源錄製檔的增益度,所製作出來的Noiseprof搭配Noisered效果可保留絕大部分的聲音細節,並消除手機停止撥放音樂後仍會出現的低頻雜音較響亮部分。剩餘較不明顯但仍可聽見的雜音則是透過指令層腳本及搭配第三方bc數學運算插件來消除。In addition, if the mobile phone is connected to the USB jack of the Raspberry Pi microcomputer 110, and the line input of the sound card 120 is connected to play, the current noise can be obviously heard; the invention can adjust the gain degree of the noise source recording file, and is produced. Noiseprof's Noisered effect preserves most of the sound detail and eliminates the louder parts of the low-frequency noise that still appear after the phone stops playing music. The remaining less obvious but still audible noise is eliminated through the command layer script and the third-party bc math plugin.
儘管前述在說明本發明之音訊控制裝置的過程中,亦已同時說明本發明之音訊控制方法的概念,但為求清楚起見,以下另繪示流程圖詳細說明。Although the concept of the audio control method of the present invention has been described in the foregoing in the description of the audio control device of the present invention, for the sake of clarity, the flowchart will be described in detail below.
請參閱第3圖,其係為本發明之音訊控制裝置之流程圖。如圖所示,本發明之音訊控制方法,適用於上述之音訊控制裝置,音訊控制裝置包含樹莓派微電腦及音效卡,樹莓派微電腦連接音效卡,音訊控制方法包含下列步驟:Please refer to FIG. 3, which is a flow chart of the audio control device of the present invention. As shown in the figure, the audio control method of the present invention is applicable to the above audio control device. The audio control device includes a Raspberry Pi microcomputer and a sound card, and the Raspberry Pi microcomputer connects the sound card. The audio control method includes the following steps:
在步驟S31中:安裝音效插件、音效套件及指令層腳本。In step S31: an audio plug-in, a sound effect kit, and an instruction layer script are installed.
在步驟S32中:輸入原始音頻訊號。通過音效插件調整原始音頻訊號之輸入音量以產生輸入音頻訊號。In step S32: the original audio signal is input. The input volume of the original audio signal is adjusted by the sound effects plug-in to generate an input audio signal.
在步驟S33中:讀取輸入音頻訊號中複數個輸入訊框的其中之一。In step S33, one of the plurality of input frames in the input audio signal is read.
在步驟S34中:對應輸入訊框的複數個取樣產生複數個響度值。In step S34, a plurality of samples corresponding to the input frame generate a plurality of loudness values.
在步驟S35中:依據複數個響度值計算加權平均響度值。In step S35: the weighted average loudness value is calculated based on the plurality of loudness values.
在步驟S36中:依據加權平均響度值及限制峰值提升輸入音頻訊號之整體音量而產生提升音頻訊號。In step S36, the boosted audio signal is generated according to the weighted average loudness value and the limit peak boosting the overall volume of the input audio signal.
在步驟S37中:擷取提升音頻訊號之雜訊音頻訊號。In step S37, the noise audio signal for boosting the audio signal is captured.
在步驟S38中:輸入雜訊音頻訊號至音效套件以產生左右聲道分離且各含1024個頻段雜訊抑制係數之文字檔。In step S38, the noise audio signal is input to the sound effect kit to generate a text file in which the left and right channels are separated and each has a noise suppression coefficient of 1024 bands.
在步驟S39中:依據文字檔且配合音效套件及指令層腳本對提升音頻訊號進行進階雜訊抑制後再輸出。In step S39, according to the text file and the sound effect kit and the command layer script, the advanced audio signal is suppressed by the audio signal and then output.
本發明之音訊控制方法的詳細說明以及實施方式已於前面敘述本發明之音訊控制裝置時描述過,在此為了簡略說明便不再贅述。The detailed description and embodiments of the audio control method of the present invention have been described above in connection with the audio control device of the present invention, and will not be described again for the sake of brevity.
承上所述,本發明之音訊控制裝置透過樹莓派微電腦搭配音效模卡,輔以適當系統軟體組態以達到擴大音量及抑制音頻雜音之功效。As described above, the audio control device of the present invention is coupled with a sound effect card through a Raspberry Pi microcomputer, supplemented by an appropriate system software configuration to achieve an effect of expanding the volume and suppressing audio noise.
以上所述之實施例僅係為說明本發明之技術思想及特點,其目的在使熟習此項技藝之人士能夠瞭解本發明之內容並據以實施,當不能以之限定本發明之專利範圍,即大凡依本發明所揭示之精神所作之均等變化或修飾,仍應涵蓋在本發明之專利範圍內。The embodiments described above are merely illustrative of the technical spirit and the features of the present invention, and the objects of the present invention can be understood by those skilled in the art, and the scope of the present invention cannot be limited thereto. That is, the equivalent variations or modifications made by the spirit of the present invention should still be included in the scope of the present invention.
100‧‧‧音訊控制裝置100‧‧‧Optical control device
110‧‧‧樹莓派微電腦110‧‧‧Raspberry pie microcomputer
111‧‧‧儲存單元111‧‧‧ storage unit
120‧‧‧音效卡120‧‧‧ sound card
S31至S39‧‧‧步驟Steps S31 to S39‧‧
第1圖係為本發明之音訊控制裝置之第一方塊圖。 第2圖係為本發明之音訊控制裝置之第二方塊圖。 第3圖係為本發明之音訊控制方法之流程圖。Figure 1 is a first block diagram of the audio control device of the present invention. Figure 2 is a second block diagram of the audio control device of the present invention. Figure 3 is a flow chart of the audio control method of the present invention.
Claims (3)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW106120798A TW201905903A (en) | 2017-06-21 | 2017-06-21 | Audio control device and method thereof |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW106120798A TW201905903A (en) | 2017-06-21 | 2017-06-21 | Audio control device and method thereof |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| TW201905903A true TW201905903A (en) | 2019-02-01 |
Family
ID=66213266
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW106120798A TW201905903A (en) | 2017-06-21 | 2017-06-21 | Audio control device and method thereof |
Country Status (1)
| Country | Link |
|---|---|
| TW (1) | TW201905903A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2022156165A1 (en) * | 2021-01-21 | 2022-07-28 | 稿定(厦门)科技有限公司 | Sox-based audio processing method and apparatus |
-
2017
- 2017-06-21 TW TW106120798A patent/TW201905903A/en unknown
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2022156165A1 (en) * | 2021-01-21 | 2022-07-28 | 稿定(厦门)科技有限公司 | Sox-based audio processing method and apparatus |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN104012001B (en) | Bass boost system | |
| TWI384457B (en) | System and method for audio adjustment | |
| US7844452B2 (en) | Sound quality control apparatus, sound quality control method, and sound quality control program | |
| US8682462B2 (en) | Systems and methods for dynamic audio processing | |
| US9756437B2 (en) | System and method for transmitting environmental acoustical information in digital audio signals | |
| US8965181B2 (en) | Automatic announcer voice attenuation in a presentation of a broadcast event | |
| US20150365061A1 (en) | System and method for modifying an audio signal | |
| CN113170260B (en) | Audio processing method, device, storage medium and electronic device | |
| TW201905903A (en) | Audio control device and method thereof | |
| US20190074805A1 (en) | Transient Detection for Speaker Distortion Reduction | |
| CN114025229A (en) | Method and device for processing audio and video files, computing equipment and storage medium | |
| CN116634221A (en) | Multi-channel audio source automatic mixing method, system, device and medium based on Android system | |
| JP2019161333A (en) | Speech processing unit | |
| JP2019161334A (en) | Speech processing unit | |
| JP2019091988A (en) | Voice processing unit and voice processing method | |
| US11206001B2 (en) | Inference and correction of automatic gain compensation | |
| JP6604728B2 (en) | Audio processing apparatus and audio processing method | |
| JP4277609B2 (en) | Audio signal processing apparatus and method, and recording apparatus and method | |
| JP2019016851A (en) | Voice processing apparatus, voice processing method and program | |
| CN116208908A (en) | Recording file playing method and device, electronic equipment and storage medium | |
| CN118151879A (en) | Volume adjustment method, device, equipment and storage medium | |
| JP6226166B2 (en) | Sound playback device | |
| CN120151744A (en) | Audio external speaker control method, device, equipment, storage medium and product | |
| KR20070086355A (en) | Sound reproducing apparatus | |
| JP2010016574A (en) | Audio reproduction system, audio reproduction device, mobile player, and audio reproduction control method |