On Mac OS X systems you can play an audio file, such as an MP3 file, from a command-line interface, i.e., a shell prompt, which you can get by running the Terminal program found in
/Applications/Utilities
,
by using the audio file play command, afplay
. E.g.:
afplay Waterfalls.mp3
You can terminate the playing of the audio file using Ctrl-C.
You can specify that the audio file only be played for a specific number of
seconds using the -t
or --time
argument. E.g., the
following command would play the specified MP3 file for 10 seconds and then
terminate afplay:
afplay --time 10 Waterfalls.mp3
For help on the command use afplay -h
.
$ afplay -h 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