Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DokuFFTPACK DokuUSBDevice DokuUSBHost DokuUSBHostWithIso mbed
Fork of Peach_AudioChannelDividerAndCompensator by
You are viewing an older revision! See the latest version
Homepage
Outline¶
This is audio channel dividing filter for multi-way multi-amp systems with compensation for system response. This program uses 32768 taps of real time 6ch floating point FIR (by FFT and superimpose) for correct compensation of low frequency. GR-Peach receives stereo audio stream (48ksps 16bit) from USB host as a USB device (USB1). and divide up them into six channel (Low,Mid,High each L,R). Then outputs them to the multi-channel USBDAC as a USB host (USB0). 32767 taps of FIR coefficient is given by the files in the USB MSD (USB0).
Sorry¶
This cord works but it is under construction now. I would like to receive analog audio signal (e.c.Phone jack of smart phone) but audio stream from USBDAC can not be received. So I receive audio stream from the USB master.
GR-Peach's superabundant process power solves real time 6ch/32kTaps floating point audio FIR in textbook method. without any optimization ! Nonetheless it is better to use NEON SIMD engine to solve FFT. But I don't know how to FFT over 4096 points using cmsis_dsp_neon library. (and don't know FIR_f32 filter functions can work in so many (65536) points...?)

Connection¶
To use this program, connect USB1 of GR-Peach to the PC, USB0 of GR-Peach to a self powered USBHUB, a multi-channel USBDAC(CM6206 chip inside / e.c.DN-USBSA6CHOPThttp://www.donya.jp/site/item/item_20087.html) to the USBHUB, a USB mass storage device (coefficient files are saved) to the USBHUB as shown above.
Filter setting¶
You can get your favorite cross-over and compensation characteristics modifying FIR coefficient files named Fir_Ch0.snd to Fir_Ch5.snd. Coefficient files are signed 16 bit integer raw formatted sound file (without any header) having time domain responses of the FIRs. Coefficient file have 65536 samples of filter response. but second-half portion of the file (32768 samples) must be zero to work superimpose correctly. If you want minimum phase FIR, filter impulse will be placed at the first sample of the file. If you want liner phase FIR, filter impulse will be placed at 16384 sample of the file.
Sample coefficient files¶
Sample coefficient files are shown below. Store below files in USB mass storage device before running the program. These are files for two way systems. Since flatness of frequency response is archived by the compensation, full range speaker works very well without tweeter. In below files, ch0 and ch1 for full range speakers, ch2 and ch3 for low range speakers (woofers), ch4 and ch5 are not used. Of cause, system compensation coefficient is differ according to speaker unit, speaker enclosure, room, and amplifier. Below samples are for my speakers and room.
Compensated coefficient file with channel divider¶
ch0:full range(high):left:/media/uploads/dokunewon/fir_ch0.snd
ch1:full range(high):right:/media/uploads/dokunewon/fir_ch1.snd
ch2:woofer(mid):left:/media/uploads/dokunewon/fir_ch2.snd
ch3:woofer(mid):right:/media/uploads/dokunewon/fir_ch3.snd
ch4:not_used(low):left:/media/uploads/dokunewon/fir_ch4.snd
ch4:not_used(low):right:/media/uploads/dokunewon/fir_ch5.snd
channel divider without compensation (pushing the user button on the GR-Peach, below coefficients are used)¶
ch0:full range(high):left:/media/uploads/dokunewon/fir_ch0nc.snd
ch1:full range(high):right:/media/uploads/dokunewon/fir_ch1nc.snd
ch2:woofer(mid):left:/media/uploads/dokunewon/fir_ch2nc.snd
ch3:woofer(mid):right:/media/uploads/dokunewon/fir_ch3nc.snd
ch4:not_used(low):left:/media/uploads/dokunewon/fir_ch4nc.snd
ch4:not_used(low):right:/media/uploads/dokunewon/fir_ch5nc.snd
Filter bypass test coefficient¶
/media/uploads/dokunewon/fir_bypass.snd
Measuring system and generating filter coefficient¶
These coefficient files are generated by a home made audio analyzer tool works on PC. I will publish this tool in my home page at a later date. Using this tool, you can configure cross-over frequency and filter dimension for two or three way multi-way multi-amplifier system, measure response of your room and system, generate inverse response transfer function using unique and refined algorithm to create compensation FIR coefficient.
概要¶
システムの特性補償を行なうオーディオチャンネルデバイダです。低音を正確に補正するために、32768タップのFIRを使用しています。GR-Peachの有り余る処理力で、教科書通りのフィルタアルゴリズムが(最適化なしで!)リアルタイムにオーディオ信号を処理します。
本ソフトはオーデイオデバイスとして、48kサンプル16ビットのステレオ音声信号を受信し、システム特性を補償すると同時に左右各3チャンネルに帯域分割して、マルチチャンネルUSBDACに出力します。
おわび¶
このプログラムは一応動くのですが、まだ作成中です。アナログオーディオ信号をUSBDACのLINE-IN端子から入力したいのですが、DACからのオーディオストリームがまだ受信できていません。また、FFTにはNEONエンジンを使った方がよさそうですが、4096ポイントを超えるFFTをcmsis_dsp_neonライブラリで行なう定義方法が分かりません。さらに、FIR_f32フィルタ機能は。32767ポイントなどの多ポイントFIRに使えるのか?どうかも分かりません。要するに、知識不足です。

接続¶
上の図のように、USB1にPCを接続して、好みの音楽を再生します。USB0には(できればセルフパワーの)USBHUBを接続し、HUBには、マルチチャンネルUSBDAC(CM6206を使用した、DN-USBSA6CHOPThttp://www.donya.jp/site/item/item_20087.html)とFIR特性ファイルを記録したUSBメモリを接続します。
フィルタの設定¶
FIR特性ファイル(Fir_Ch0.snd ~ Fir_Ch5.snd)を変更することで、好みの補正やクロスオーバー特性を得ることができます。特性ファイルはFIRの時間領域の応答を記録した16ビット符号付整数形式のヘッダなしモノラルRAW波形データです。特性ファイルには65536サンプルのフィルタ応答が記録されていますが、後ろ半分は重畳処理の都合でゼロとします。
見本の特性ファイル¶
見本の特性ファイルを次に示します。これらは、2ウェイシステム用のファイルです。システム特性の補正によってフラットな周波数特性が実現されるので、トゥイータ無しのフルレンジスピーカーでもとても良い結果が得られます。チャンネル0と1がフルレンジ、2と3がウーファ、4と5は今回使用しません。もちろんシステムの補償はユニット、エンクロジャー、部屋、アンプ等によって変化します。下の例は、私のスピーカーと部屋のためのものです。(フルレンジは、F77G98-6左右各1本、ウーファはF77G98-6左右各8本を使用しています)
チャンネルデバイダの特性(補償付き)¶
ch0:full range(high):left:/media/uploads/dokunewon/fir_ch0.snd
ch1:full range(high):right:/media/uploads/dokunewon/fir_ch1.snd
ch2:woofer(mid):left:/media/uploads/dokunewon/fir_ch2.snd
ch3:woofer(mid):right:/media/uploads/dokunewon/fir_ch3.snd
ch4:not_used(low):left:/media/uploads/dokunewon/fir_ch4.snd
ch4:not_used(low):right:/media/uploads/dokunewon/fir_ch5.snd
チャンネルデバイダの特性(補償なし:ピーチの押しボタンを押すと、こちらの特性に切り替わります)¶
ch0:full range(high):left:/media/uploads/dokunewon/fir_ch0nc.snd
ch1:full range(high):right:/media/uploads/dokunewon/fir_ch1nc.snd
ch2:woofer(mid):left:/media/uploads/dokunewon/fir_ch2nc.snd
ch3:woofer(mid):right:/media/uploads/dokunewon/fir_ch3nc.snd
ch4:not_used(low):left:/media/uploads/dokunewon/fir_ch4nc.snd
ch4:not_used(low):right:/media/uploads/dokunewon/fir_ch5nc.snd
テスト用のバイパスフィルタ¶
/media/uploads/dokunewon/fir_bypass.snd
システムの測定とフィルタ特性の生成¶
上記の特性ファイルは自作のPC用測定分析ツールで生成しています。このツールも将来Webにて公開する予定です。このツールを使用して、クロスオーバーの周波数や次数、システム特性の測定、補償用の逆フィルタの生成が可能です。
