「arecord」の基本録音サンプルレート変更

「arecord」の基本録音サンプルレート変更

デフォルトのサンプリングレートを変更しようとしています。録音そしてarecord

arecord test.wav現在は8000Hzで動作します。

arecord test.wav
Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono

rateフラグを使用してサンプルレートを変更できます--rate 44100

arecord --format S16_LE --rate 44100 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono

ただし、で速度を変更してもasound.conf録音には影響はありません(速度は8000Hzに保たれます)。私は何を逃したことがありませんか?

私のものasound.conf

# The IPC key of dmix or dsnoop plugin must be unique
# If 555555 or 666666 is used by other processes, use another one

# use samplerate to resample as speexdsp resample is bad
defaults.pcm.rate_converter "samplerate"

pcm.!default {
    type asym
    playback.pcm "playback"
    capture.pcm "capture"
}

pcm.playback {
    type plug
    slave.pcm "dmixed"
}

pcm.capture {
    type plug
    slave.pcm "array"
}

pcm.dmixed {
    type dmix
    slave.pcm "hw:wm8960soundcard"
    ipc_key 555555
}

pcm.array {
    type dsnoop
    slave {
        pcm "hw:1,0"
        format S16_LE
        rate 44100
        channels 1
    }
    ipc_key 666666
}

出力arecord -L

null
    Discard all samples (playback) or generate zero samples (capture)
jack
    JACK Audio Connection Kit
pulse
    PulseAudio Sound Server
default
eci
eco
usbstream:CARD=Headphones
    bcm2835 Headphones
    USB Stream Output
sysdefault:CARD=wm8960soundcard
    wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
    Default Audio Device
dmix:CARD=wm8960soundcard,DEV=0
    wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
    Direct sample mixing device
dsnoop:CARD=wm8960soundcard,DEV=0
    wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
    Direct sample snooping device
hw:CARD=wm8960soundcard,DEV=0
    wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
    Direct hardware device without any conversions
plughw:CARD=wm8960soundcard,DEV=0
    wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
    Hardware device with all software conversions
usbstream:CARD=wm8960soundcard
    wm8960-soundcard
    USB Stream Output

次へ追加

arecordPJUSA(PJSIP)を使用するときのデフォルトサンプリングレートを変更するには:

PJUSAは起動時にALSAを初期化します。

11:56:12.951     alsa_dev.c  ..ALSA driver found 32 devices
11:56:12.951     alsa_dev.c  ..ALSA initialized

alsa_dev.c横になるpjproject/pjmedia/src/pjmedia-audiodev/alsa_dev.c

デフォルトのサンプルレートは270行で設定されます。

/* Set the default sample rate */
adi->default_samples_per_sec = 8000;

値を必要なサンプリングレートに変更するだけです(マイクがそれをサポートできるはずです)。

ベストアンサー1

作成した文書を読んでくださいarecord(参考資料を参照man arecord)。

-r--rate=#<Hz>サンプリングレート(Hz)。基本速度は8000Hzです。 [...]

asound.confしたがって、速度はを介して制御されず、このコマンドラインフラグを使用して制御されることがわかります。

おすすめ記事