C03 BruteFIRの設定

室長:今回はBruteFIRの設定だ。とりあえず設定例を示すぞ。


float_bits: 64;
sampling_rate: 44100;
filter_length: 65536;
overflow_warnings: true;    # echo warnings to stderr if overflow occurs
show_progress: true;        # echo filtering progress to stderr
max_dither_table_size: 0;   # maximum size in bytes of precalculated dither
allow_poll_mode: false;     # allow use of input poll mode
modules_path: ".";          # extra path where to find BruteFIR modules
monitor_rate: false;        # monitor sample rate
powersave: false;           # pause filtering when input is zero
lock_memory: true;          # try to lock memory if realtime prio is set
sdf_length: -1;             # subsample filter half length in samples
convolver_config: "/var/lib/mpd/b_conv1"; # location of convolver config file

coeff "lowl" {
  format: "TEXT";     # file format
  filename: "/home/user1/lowl";
  attenuation: 3.0;   # attenuation in dB
  blocks: -1;         # how long in blocks
  skip: 0;            # how many bytes to skip
  shared_mem: false;  # allocate in shared memory
};

coeff "lowr" {
  format: "TEXT";     # file format
  filename: "/home/user1/lowr";
  attenuation: 3.0;   # attenuation in dB
  blocks: -1;         # how long in blocks
  skip: 0;            # how many bytes to skip
  shared_mem: false;  # allocate in shared memory
};

coeff "midl" {
  format: "TEXT";     # file format
  filename: "/home/user1/midl";
  attenuation: 3.0;   # attenuation in dB
  blocks: -1;         # how long in blocks
  skip: 0;            # how many bytes to skip
  shared_mem: false;  # allocate in shared memory
};

coeff "midr" {
  format: "TEXT";     # file format
  filename: "/home/user1/midr";
  attenuation: 3.0;   # attenuation in dB
  blocks: -1;         # how long in blocks
  skip: 0;            # how many bytes to skip
  shared_mem: false;  # allocate in shared memory
};

coeff "highl" {
  format: "TEXT";     # file format
  filename: "/home/user1/highl";
  attenuation: 3.0;   # attenuation in dB
  blocks: -1;         # how long in blocks
  skip: 0;            # how many bytes to skip
  shared_mem: false;  # allocate in shared memory
};

coeff "highr" {
  format: "TEXT";     # file format
  filename: "/home/user1/highr";
  attenuation: 3.0;   # attenuation in dB
  blocks: -1;         # how long in blocks
  skip: 0;            # how many bytes to skip
  shared_mem: false;  # allocate in shared memory
};

input "lin","rin" {
  device: "file" { path: "/dev/stdin"; };
  sample: "S32_LE";   # sample format
  channels: 2/0,1;    # number of open channels / which to use
  delay: 0,0;         # delay in samples for each channel
  maxdelay: -1;       # max delay for variable delays
  subdelay: 0,0;      # subsample delay in 1/100th sample for each channel
  mute: false,false;  # mute active on startup for each channel
};

output "l","r","sbl","sbr","c","lfe","sl","sr" {
  device: "alsa" { device: "hw:0,3"; };
  sample: "S24_4LE";
  channels: 8/0,1,2,3,4,5,6,7;
  delay: 0,0,124,124,0,0,123,123;         # delay in samples for each channel
  maxdelay: -1;       # max delay for variable delays
  subdelay: 0,0,0,0,0,0,0,0;      # subsample delay in 1/100th sample for each channel
  mute: false,false,false,false,true,true,false,false;
  dither: true;
};

filter "llow" {
  from_inputs: "lin";
  to_outputs: "l";
  coeff: "lowl";
  process: -1;        # process index to run in (-1 means auto)
  delay: 0;           # predelay, in blocks
  crossfade: false;   # crossfade when coefficient is changed
};

filter "rlow" {
  from_inputs: "rin";
  to_outputs: "r";
  coeff: "lowr";
  process: -1;        # process index to run in (-1 means auto)
  delay: 0;           # predelay, in blocks
  crossfade: false;   # crossfade when coefficient is changed
};

filter "lmid" {
  from_inputs: "lin";
  to_outputs: "sl";
  coeff: "midl";
  process: -1;        # process index to run in (-1 means auto)
  delay: 0;           # predelay, in blocks
  crossfade: false;   # crossfade when coefficient is changed
};

filter "rmid" {
  from_inputs: "rin";
  to_outputs: "sr";
  coeff: "midr";
  process: -1;        # process index to run in (-1 means auto)
  delay: 0;           # predelay, in blocks
  crossfade: false;   # crossfade when coefficient is changed
};

filter "lhigh" {
  from_inputs: "lin";
  to_outputs: "sbl";
  coeff: "highl";
  process: -1;        # process index to run in (-1 means auto)
  delay: 0;           # predelay, in blocks
  crossfade: false;   # crossfade when coefficient is changed
};

filter "rhigh" {
  from_inputs: "rin";
  to_outputs: "sbr";
  coeff: "highr";
  process: -1;        # process index to run in (-1 means auto)
  delay: 0;           # predelay, in blocks
  crossfade: false;   # crossfade when coefficient is changed
};

助手:解説おねがいします。

室長:ポイントはnodefaultオプションをつけるので本来ならデフォルト設定にするものもすべて記述しなければならないことと、ファイルの場所を絶対パスにすることだな。あとはmpdで設定したサンプリング周波数とビット数に合わせる。convolver_configの場所はユーザーmpdが書き込める場所にする。

助手:これでようやく再生できますね。ところでbrutefirのエラー出力を見るとwarningが出てますが?

室長:これはプロセスの優先度を変更できなかったという警告だな。安定して再生できればこのままでかまわん。だが優先度を変えたいのならばルート権限で起動するのが手っ取り早い。


sudo chmod u+s /usr/lib/brutefir/brutefir.real

ただしsuidはセキュリティホールになりやすい。家庭内の音楽再生用パソコンならかまわんだろうが注意してくれ。

助手:topコマンドで優先度が変更されれることを確認してみます。

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
1760 root      -5   0 50504  49m  31m S    7  1.3   0:06.07 brutefir.real
1759 root      -5   0 50504  49m  31m S    7  1.3   0:06.05 brutefir.real

USERがroot、PRが-5になって優先度が変更されているのが分かります。

室長:カーネルをlowlatencyやrealtimeに変更するとなお良いぞ。
では次は音楽再生専用PCを作ってみよう。ただし他のサイトのように音質最優先ではなく、利便性重視でゆくぞ。

2013年2月23日

次ページへ

目次へ