How to play audio files from command line

audiocommand line

I'm looking for a simple command line tool to play audio files for the command line, I'm looking to play .wav files. I'd also like to be able to stream audio from http and pipe it into this tool. Does anyone have a tool that works?

Best Answer

You can use afplay to play audio files from the command line. Just run afplay in Terminal without any argument to display the internal help file.

$ afplay
Usage:
afplay [option...] audio_file

Options: (may appear before or after arguments)
  {-v | --volume} VOLUME
    set the volume for playback of the file
  {-h | --help}
    print help
  { --leaks}
    run leaks analysis
  {-t | --time} TIME
    play for TIME seconds
  {-r | --rate} RATE
    play at playback rate
  {-q | --rQuality} QUALITY
    set the quality used for rate-scaled playback (default is 0 - low quality, 1 - high quality)
  {-d | --debug}
    debug print output
$