samples=${samples-8000}
player () {
  if [ -t 1 ]; then
    if command -v mpv >/dev/null; then
      mpv --no-video \
          --demuxer=rawaudio \
          --demuxer-rawaudio-format=s16le \
          --demuxer-rawaudio-rate="${samples}" \
          --demuxer-rawaudio-channels=1 \
          --no-terminal -
    elif command -v ffplay >/dev/null; then
      ffplay \
          -v -8 -nodisp -nostats -hide_banner -autoexit \
          -f s16le -ar "${samples}" -ch_layout mono -
    elif command -v aplay >/dev/null; then
      aplay -f S16_LE -r "${samples}" -
    fi
  else
    cat
  fi
}
