<!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG-spv-->{"id":1982715,"date":"2021-09-05T09:29:00","date_gmt":"2021-09-05T07:29:00","guid":{"rendered":"http:\/\/nhub.news\/?p=1982715"},"modified":"2021-09-05T11:02:24","modified_gmt":"2021-09-05T09:02:24","slug":"how-to-play-audio-files-in-the-terminal","status":"publish","type":"post","link":"http:\/\/nhub.news\/ru\/2021\/09\/how-to-play-audio-files-in-the-terminal\/","title":{"rendered":"How to play audio files in the Terminal"},"content":{"rendered":"<p style=\"text-align: justify;\"><b>If you\u2019re a command line aficionado and you want to play an audio file, there\u2019s no need to leave the Terminal. There are Terminal commands \u2026<\/b><br \/>\nIf you\u2019re a command line aficionado and you want to play an audio file, there\u2019s no need to leave the Terminal. There are Terminal commands you can use to not just play audio, but to convert files as well. We\u2019ll go over the afplay, afinfo, and afconvert audio commands in this article. There\u2019s not much in the way of help available for these new commands; their man pages are pretty much empty. You can get more help for afplay and afconvert by running them with the -h option (type afplay -h or afconvert -h into Terminal). Thankfully, usage of all three commands is relatively straightforward. To play an audio file, type the afplay command followed by the path of file. For example: afplay \/Users\/macworld\/Desktop\/Opening.aif Once a song starts, you can stop it by pressing Control-C to terminate the afplay command. If you\u2019d like to close the Terminal window after starting a song, you can do so by appending &amp; disown after the path to the audio file. For example: afplay \/Users\/macworld\/Desktop\/Opening.aif &amp; disown However, this makes it tougher to stop playback. You have to open a new Terminal window and then type killall afplay to stop the audio. The command afinfo works much like afplay \u2014just give it the path to an audio file, and you\u2019ll get a slew of information about that file. For example, in Terminal, I entered: afinfo \/Users\/macworld\/Desktop\/Opening.aif And this is what appears in Terminal: The afconvert command is a powerful and complicated one. I won\u2019t even attempt to go into all the details on how it works\u2014because I\u2019m honest enough to admit that I don\u2019t know them all! Read the help file (enter afconvert -h in the Terminal); it provides good detail on how to use this command. You can specify all sorts of options to control the input and output formats. A simple example: afconvert -v -f &#171;mp4f&#187; -d &#171;aac@44100&#187; \/System\/Library\/Sounds\/Basso.aiff ~\/Desktop\/basso_converted.mp4 That will take the Basso system sound and convert it into an MP4 file (encoded with the AAC encoder at a 44.1kHz sample rate, which is stated in straight hz (44100) in the command). The converted file is saved to the Desktop with the name basso_converted.mp4. If you\u2019ve got a lot of audio files to convert, you can use afconvert to automate the process, though this will take a bit more work with shell scripting (as you need a simple loop to loop through the files). What you do with these commands is really only limited by your imagination. If you\u2019d rather not fire up the Music app for some simple audio playback, you can use them that way. If you have remote login (ssh) abilities on another machine in your house or business, you can play a song for a housemate or coworker, perhaps as an alarm clock if they\u2019re oversleeping. While not useful to everyone, perhaps, having tools such as these available for those who need them is one of the reasons macOS appeals to such a diverse audience. Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.<\/p>\n<script>jQuery(function(){jQuery(\".vc_icon_element-icon\").css(\"top\", \"0px\");});<\/script><script>jQuery(function(){jQuery(\"#td_post_ranks\").css(\"height\", \"10px\");});<\/script><script>jQuery(function(){jQuery(\".td-post-content\").find(\"p\").find(\"img\").hide();});<\/script>","protected":false},"excerpt":{"rendered":"<p>If you\u2019re a command line aficionado and you want to play an audio file, there\u2019s no need to leave the Terminal. There are Terminal commands \u2026 If you\u2019re a command line aficionado and you want to play an audio file, there\u2019s no need to leave the Terminal. There are Terminal commands you can use to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1982714,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[93],"tags":[],"_links":{"self":[{"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/posts\/1982715"}],"collection":[{"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/comments?post=1982715"}],"version-history":[{"count":1,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/posts\/1982715\/revisions"}],"predecessor-version":[{"id":1982716,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/posts\/1982715\/revisions\/1982716"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/media\/1982714"}],"wp:attachment":[{"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/media?parent=1982715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/categories?post=1982715"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/tags?post=1982715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}