Skip to content

Determine Audio Hardware Information and Configure

Fyzel edited this page Aug 17, 2024 · 2 revisions

Note: this is an optional configuration, if you have a microphone to activate recording when sound occurs.

If this step is skipped, comment the last line in the /etc/motionplus/motionplus.conf to disable the sound configuration.

sudo vi /etc/motionplus/motionplus.conf

Comment out the sound file loading with a semi-colon (;)

;*************************************************
; Device config files - One for each device.
;*************************************************
camera /etc/motionplus/camera1.conf
; camera /usr/local/etc/motionplus/camera2.conf
; camera /usr/local/etc/motionplus/camera3.conf
;sound /etc/motionplus/sound.conf

Step 1 - Determine the USB audio device

cat /proc/asound/cards

Step 2 - Record a test audio file

arecord --device=hw:2,0 --format S16_LE --rate 44100 -cq test.wav

Step 3 - Play the test audio file

aplay test.wav

You should hear the recorded audio, if not select a different sound device.

Step 4 - Configure the MotionPlus sound configuration

Update the file /etc/motionplus/sound.conf

sudo vi /etc/motionplus/sound.conf

Enter the device_id and snd_device values identified above in the configuration file. A sample file is available here.

; /usr/local/etc/motionplus/sound1.conf
;
; This config file was generated by motionplus 0.2.0-git-20240802-2b7b758

;*************************************************
; Configuration options specific to sound device 1
;*************************************************

device_id 5

;*************************************************
;*****   Sound
;*************************************************
snd_device hw:2,0
snd_params source=alsa,channel=1

snd_alerts alert_id=01,volume_level=01,volume_count=10,freq_low=3398,freq_high=3399,alert_nm=water_alert
snd_alerts alert_id=02,volume_level=01,volume_count=10,freq_low=3187,freq_high=3188,alert_nm=smoke_alarm1
snd_alerts alert_id=03,volume_level=01,volume_count=10,freq_low=3375,freq_high=3376,alert_nm=smoke_alarm2
snd_alerts alert_id=04,volume_level=01,volume_count=200,freq_low=679.6875,freq_high=679.6875,trigger_threshold=100,alert_nm=doorbell

snd_window hamming

snd_show on

Next Step: Testing MotionPlus