如何在 Mac OS X 中从命令行播放声音?

Kev*_*eid 47 audio command-line macos

我想从 Mac OS X 的命令行播放一个简短的声音文件,独立于任何音频播放器应用程序,以提供长时间工作已完成的通知。

Kev*_*eid 56

有一个内置工具:afplay <sound file>. 手册页没有记录其所有选项,可以通过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
Run Code Online (Sandbox Code Playgroud)

它不会播放多个音频文件。


Kir*_*irk 21

有一次,当工作中断电时,我知道我的防火墙会在重新通电时恢复到最后一个状态(通电),我在 bash 中编写了一个脚本,使用该say命令在通电时唤醒我回来。

  • 我喜欢滥用 `say` 命令。 (13认同)

bla*_*lah 11

你有没有考虑过printf "\a\a\a"echo -e "\a\a\a"