lame --decode test.mp3 - | sox - -t raw -r 40000 -f -b 32 -c 1 - | command_to_treat_raw_data.sh
This is super cool stuff! I was trying to do something very similar and ended up doing the same, using this as a verification for correctness. :)