This example is monitoring taps on touchpad:
xinput test-xi2 --root "AlpsPS/2 ALPS DualPoint TouchPad" \
| grep --line-buffered "EVENT type 15 (RawButtonPress)"| while read line; do
    then paplay --volume 22000 -d $PULSE_SINK $HOME/scripts/data/click.aiff
    fi
done
You can easily modify it for your needs.