Skip to main content

Raspberry Pi 스피커 / 마이크 선택

USB 마이크와 스피커 연결하기 (ALSA)

  1. aplay -l 명령어로 스피커의 카드와 디바이스 번호를 확인
    aplay -l
  2.  arecord -l 명령어로 마이크의 카드와 디바이스 번호를 확인
    arecord -l
  3. .asoundrc 설정파일에 스피커와 마이크의 연결정보를 다음과 같이 작성 
    pcm.!default{ 
      type asym 
      playback.pcm{ 
      type hw 
      card 0 
    } 
    capture.pcm{ 
      type plug 
      slave.pcm "hw:1, 0" 
    } 
    } 
    
    ctl.!default{ 
      type hw 
      card 0 
    } 
  4. speaker-test 애플리케이션으로 스피커를 테스트
    speaker-test -t wav
  5. 마이크 테스트를 위해 녹음
    arecord --format=S16_LE --duration=5 --rate=16000 --file-type=raw out.raw
  6. aplay 애플리케이션으로 녹음된 파일을 재생
    aplay --format=S16_LE --rate=16000 out.raw