Get the volume in percentage from alsamixer
awk -F"[][]" '/dB/ { print $2 }' <(amixer sget Master)
ou can use amixer. It's in the alsa-utils package on ubuntu/debian.
Run it without parameters to get an overview about your devices.
amixer
Then use the set command to set the volumn. For example to set the master channel to 50%:
amixer set Master 50