In the event you’re a command line aficionado and also you wish to play an audio file, there’s no want to go away the Terminal. There are Terminal instructions you should utilize to not simply play audio, however to transform recordsdata as properly.
We’ll go over the
afconvert audio instructions on this article. There’s not a lot in the best way of assist obtainable for these new instructions; their
man pages are just about empty. You will get extra assist for
afconvert by working them with the
-h choice (kind
afplay -h or
afconvert -h into Terminal). Fortunately, utilization of all three instructions is comparatively simple.
Play an audio file
To play an audio file, kind the
afplay command adopted by the trail of file. For instance:
As soon as a track begins, you may cease it by urgent Management-C to terminate the
In the event you’d like to shut the Terminal window after beginning a track, you are able to do so by appending
& disown after the trail to the audio file. For instance:
afplay /Customers/macworld/Desktop/Opening.aif & disown
Nonetheless, this makes it harder to cease playback. It’s important to open a brand new Terminal window after which kind
killall afplay to cease the audio.
Get data on an audio file
afinfo works very similar to
afplay—simply give it the trail to an audio file, and also you’ll get a slew of details about that file. For instance, in Terminal, I entered:
And that is what seems in Terminal:
File kind ID: AIFF
Num Tracks: 1
Information format: 2 ch, 44100 Hz, 'lpcm' (0x0000000E) 16-bit big-endian signed integer
no channel structure.
estimated length: 32.693424 sec
audio bytes: 5767120
audio packets: 1441780
bit fee: 1411200 bits per second
packet measurement higher sure: 4
most packet measurement: 4
audio information file offset: 54
supply bit depth: I16
Covert audio recordsdata
afconvert command is a strong and complex one. I gained’t even try to enter all the small print on the way it works—as a result of I’m sincere sufficient to confess that I don’t know all of them! Learn the assistance file (enter
afconvert -h within the Terminal); it gives good element on how you can use this command.
You’ll be able to specify all types of choices to regulate the enter and output codecs. A easy instance:
afconvert -v -f "mp4f" -d "aac@44100" /System/Library/Sounds/Basso.aiff ~/Desktop/basso_converted.mp4
That can take the Basso system sound and convert it into an MP4 file (encoded with the AAC encoder at a 44.1kHz pattern fee, which is acknowledged in straight hz (44100) within the command). The transformed file is saved to the Desktop with the title basso_converted.mp4.
In the event you’ve bought a whole lot of audio recordsdata to transform, you should utilize
afconvert to automate the method, although it will take a bit extra work with shell scripting (as you want a easy loop to loop by way of the recordsdata).
What you do with these instructions is actually solely restricted by your creativeness. In the event you’d somewhat not hearth up the Music app for some easy audio playback, you should utilize them that approach. In case you have distant login (ssh) skills on one other machine in your home or enterprise, you may play a track for a housemate or coworker, maybe as an alarm clock in the event that they’re oversleeping.
Whereas not helpful to everybody, maybe, having instruments resembling these obtainable for many who want them is likely one of the causes macOS appeals to such a various viewers.
Former Macworld Senior Editor Rob Griffiths based Mac OS X Hints. He is now grasp of ceremonies at Many Tips Software program.