<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 牛人業(yè)話(huà) > 提高開(kāi)發(fā)效率和質(zhì)量?用SPICE仿真音效

提高開(kāi)發(fā)效率和質(zhì)量?用SPICE仿真音效

作者:EEPW編譯 時(shí)間:2014-10-27 來(lái)源:電子產(chǎn)品世界 收藏

  我在網(wǎng)上查找原理圖時(shí)想到,如果能在出圖前先用通用模擬電路仿真器()進(jìn)行模擬檢驗,可能會(huì )提高開(kāi)發(fā)效率和質(zhì)量。但由于任何電子模擬器都無(wú)法讀取并輸出音頻文件,所以我用模塊編寫(xiě)程序,實(shí)現讀取波形文件并且輸出一段時(shí)間--電壓點(diǎn)的序列。的文件源裝置能夠讀取這一大串點(diǎn)序列,并輸出和音頻信號相匹配的電壓波形,之后作為效果電路的輸入。

本文引用地址:http://dyxdggzs.com/article/264466.htm

  為了能聽(tīng)到輸出音頻,還需另外一個(gè)程序將輸出跟蹤轉換成波形文件,這里我還是借助于這個(gè)模塊來(lái)實(shí)現。

  

過(guò)載效果器250

  過(guò)載效果器250是最簡(jiǎn)單的之一,以吉他效果而廣為人知。原理圖如圖所示。工作原理很簡(jiǎn)單,首先需要一個(gè)交流耦合電容和偏置電路,因為供電采用單向電壓。

  運算放大器被用作非反相放大器放大微弱的輸入信號。R5電位計控制增益。輸出位置有另外一個(gè)交流耦合電容器和兩個(gè)削波信號二極管。信號幅值越大,二極管的削波和畸變就越明顯。

  測試音頻信號是一段純凈的吉他聲響,來(lái)源于用戶(hù)Khoon命名的freesound.org組織,沒(méi)有專(zhuān)利許可費用,從根本上說(shuō)這個(gè)屬于公用的。

  首先是經(jīng)過(guò)500千歐R5電阻輸出較為緩和的畸變??紤]到運算放大器的放大效應,輸入幅值的選擇尤為重要。這段錄音中輸入幅值為10 毫伏。從波形上我們發(fā)現,削波作用相當明顯,因此在播放前需要檢查輸出音量。

  如下圖所示,逐漸減小R5的阻值會(huì )提高增益和畸變:

  音頻編輯器顯示的失真的頻譜效應:

原始純凈吉他聲信號頻譜


刺耳畸變信號頻譜


  以上分別是原始純凈吉他聲信號和刺耳畸變信號的頻譜,區別不是很明顯。一些低頻信號被交流耦合電容器過(guò)濾,由于畸變新增了高頻信號。能量增加超出了整個(gè)帶寬,但這只是到wav格式聲音文件轉換過(guò)程中的過(guò)渡表象。為了避免削波,這里選擇最大信號增益來(lái)獲取最大樣本值,從而改變信號音量。

  實(shí)際電路與之相比略有不同,不過(guò)這種模擬本身仍然很能說(shuō)明問(wèn)題。

  在所需時(shí)間上,仿真與實(shí)際存在差別。在44100赫茲的采樣頻率下,大約需要5秒來(lái)仿真1秒的音頻文件。如需要長(cháng)時(shí)間的仿真并記錄數據,可以使用聲明記錄下輸出波形。

  模糊效應

模糊電路


  第二部分為模糊電路,除了運算放大器部分被分立晶體管所取代外,其余與之前的失真電路非常相似。

  輸入電壓幅值對這部分電路的輸出影響也很明顯。

  下面是1毫伏輸入幅值下的仿真結果:

  10毫伏輸入幅值仿真結果為:

  由于相似的二極管削波結構,其仿真結果與畸變電路相差不大。

  二極管削波器

  二極管削波器的波形比預想的要平滑得多。當然這也取決于信號電壓和二極管參數。

用一對1N4148進(jìn)行削波之后的1V 400Hz信號仿真


二極管削波之后的正弦波頻譜


  但即便如此,這個(gè)相對平滑的削波信號也包含許多高頻諧波。

  源碼

  源碼參見(jiàn)這里:

  README

  SPICE audio tools

  This repository has two programs for importing wav file to SPICE and

  exporting the output as a wav file.

  1. wavtospice.py

  - This tool converts a wav file with a list of values, which can be read

  using ngspices file source. If wav file has multiple channels only the values

  of the first channel are returned.

  - Usage: python wavtospice.py

  - must have been compiled with xspice support. File source can be used

  like follows:

  a1 %v([in]) filesrc

  .model filesrc filesource (file="values" amploffset=[0] amplscale=[1]

  + timeoffset=0 timescale=1

  + timerelative=false amplstep=false)

  See ngspice manual for possible options.

  2. spicetowav.py

  - This tool converts ngspice output to wav file. Compatibility with other

  simulators is untested.

  - Simulation must be setup to print the output values.

  Run the ngspice in batch mode using the command line flag -b and direct

  output to a file.

  - Usage: python spicetowav.py [clipping voltage].

  Clipping voltage is optional and if it's unspecified wav is written

  with maximum amplitude such that clipping doesn't occur.

  # Example

  Following commands can be used to get output from lowpass filter example file

  when run on Linux:

  $ python wavtospice.py file.wav inputvalues

  $ ngspice -b examples/lowpass.cir > spice_output

  $ python spicetowav.py spice_output output.wav


模擬信號相關(guān)文章:什么是模擬信號




評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>