ReproNim / reprostim

Automated capture of audio-visual stimuli into BIDS datasets
5 stars 3 forks source link

Add recording volume option, set to ~95% of max by default #76

Closed yarikoptic closed 8 months ago

yarikoptic commented 9 months ago

May be this also would help to identify/specify subdevice to be specified in e.g. hw:2,1 where ATM we need to use 1 since no audio recorded on 0.

reprostim@reproiner:~$ amixer -c 2 controls
numid=5,iface=MIXER,name='Line In Capture Switch'
numid=6,iface=MIXER,name='Line In Capture Volume'
numid=2,iface=MIXER,name='HDMI Capture Switch'
numid=3,iface=MIXER,name='HDMI Capture Volume'
numid=1,iface=PCM,name='Capture Channel Map'
numid=4,iface=PCM,name='Capture Channel Map',device=1

and it seems that ours is Line In Capture. I found that recording volume was too low (through listening to recording)

reprostim@reproiner:~$ amixer -c 2 cget name='Line In Capture Volume'
numid=6,iface=MIXER,name='Line In Capture Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
  : values=106,106
  | dBminmax-min=-80.00dB,max=15.00dB
reprostim@reproiner:~$ amixer -c 2 cget name='HDMI Capture Volume'
numid=3,iface=MIXER,name='HDMI Capture Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=86,step=0
  : values=80,80
  | dBminmax-min=-80.00dB,max=6.00dB

I ran alsamixer -c 2 which gave me control over those two recording volumes and setting it for Line In to max improved recording. May be to avoid clipping etc, let's set to 95%:

reprostim@reproiner:~$ amixer -c 2 cset name='Line In Capture Volume' 95%
numid=6,iface=MIXER,name='Line In Capture Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
  : values=121,121
  | dBminmax-min=-80.00dB,max=15.00dB

note: we do record audio but it seems looses a lot of low/mid frequencies ... but seems only when playing with vlc -- ok when playing with xine

vmdocua commented 9 months ago

amixer controls command from ALSA looks very good applying to automatic device detection. While it's true that exists multiple devices/subdevices for USB capture device, ffmpeg probably for audio stream prefer this mixer subdevice, and it printed at the end of "amixer controls" output, like in example above it's "...,device=1".