"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따라서 속도는 를 통해 제어되지 않고 이 명령줄 플래그를 사용하여 제어되는 것을 볼 수 있습니다 .

관련 정보