0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PipeWire でピッチシフト仮想マイクを作る

0
Last updated at Posted at 2026-06-30

PipeWire の Filter-Chain モジュールで外部オーディオプラグインが使えると聞いたのでまずは簡単なピッチシフトで試してみました。

まずはピッチシフトプラグインを用意します。今回はレイテンシを考えて LADSPA の AM pitchshifter を使うことにします。

$ sudo apt install ladspa-sdk swh-plugins

次に自分のマイクのIDを確認します。

$ pw-link -o | grep alsa_input
alsa_input.usb-Razer_Razer_Kraken_Kitty_Edition_00000000-00.analog-stereo:capture_FL
alsa_input.usb-Razer_Razer_Kraken_Kitty_Edition_00000000-00.analog-stereo:capture_FR
alsa_input.pci-0000_00_1f.3.analog-stereo:capture_FL
alsa_input.pci-0000_00_1f.3.analog-stereo:capture_FR

次にピッチシフト後の仮想入力を作る設定を用意します(node.targetは上記で調べた自分のマイクのIDに変更してください)。

~/.config/pipewire/pipewire.conf.d/pitchshifter.conf
context.modules = [
    {
        name = libpipewire-module-filter-chain
        args = {
            node.description = "PitchShifter Sink"
            media.name       = "PitchShifter Sink"
            filter.graph = {
                nodes = [
                    {
                        type = ladspa
                        name = pitch
                        plugin = "am_pitchshift_1433"
                        label = "amPitchshift"

                        control = {
                            "Pitch shift" = 1.2
                            "Buffer size" = 256
                        }
                    }
                ]
                links = []
            }
            audio.channels = 2
            audio.position = [ FL FR ]
            capture.props = {
                node.name   = "pitchshifter_input"
                node.target = "alsa_input.usb-Razer_Razer_Kraken_Kitty_Edition_00000000-00.analog-stereo"
                stream.dont-remix = true
                node.passive = true
                node.latency = "256/48000"
            }
            playback.props = {
                node.name = "pitchshifter_output"
                media.class = "Audio/Source"
                audio.position = [ FL FR ]
                node.latency = "256/48000"
            }
        }
    }
]

その後、pipewire と wireplumber を再起動します。

$ systemctl --user restart pipewire
$ systemctl --user restart wireplumber

以下のコマンドで pipewire が active になっていることを確認してください:

$ systemctl --user status pipewire
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; preset: enabled)
     Active: active (running) since Tue 2026-06-30 13:56:05 JST; 21min ago
[...]

次に PipeWire のループバックを低レイテンシで実行して普通のループバックがうまく動いてるか確認します。

$ sudo renice -19 `pidof pipewire`
$ sudo chrt -r -p 99 `pidof pipewire`
$ export PIPEWIRE_LATENCY="256/48000"
$ pw-loopback -l 0&
$ sudo chrt -r -p 99 $!
$ sudo renice -19 $!

その後、pavucontrolmate-volume-control で入力を PitchShifter Sink に切り替えてピッチシフト後の入力をループバックします。お疲れ様でした。

ループバックの別解

ループバックは pw-loopback よりも直接リンクで繋いだほうが安定します。

$ sudo renice -19 `pidof pipewire`
$ sudo chrt -r -p 99 `pidof pipewire`
$ pw-link "pitchshifter_output:capture_FL" "alsa_output.usb-Razer_Razer_Kraken_Kitty_Edition_00000000-00.analog-stereo:playback_FL"
$ pw-link "pitchshifter_output:capture_FR" "alsa_output.usb-Razer_Razer_Kraken_Kitty_Edition_00000000-00.analog-stereo:playback_FR"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?