如何從 macOS 命令行播放聲音

使用內建的 afplay 命令: afplay file.mp3 這裡還有一些來自 tldr.sh 的其他選項: afplay 命令行音頻播放器。 更多信息:https://ss64.com/osx/afplay.html。 - 播放聲音文件(等待播放結束): afplay path/to/file - 以2倍速播放聲音文件(播放速度): afplay --rate 2 path/to/file - 以一半的速度播放聲音文件: afplay --rate 0.5 path/to/file - 播放聲音文件的前 N 秒: afplay --time seconds path/to/file 你還可以使用 say 命令讓你的 Mac 說話: say "test" say -v Fred "Isn't it nice to have a computer that will talk to you?"