0

if i run a terminal command to play a sound from a local drive, such as afplay /Users/username/Music/file.aiff it plays.

However, if I try the same thing with a file on iCloud it will not: afplay /Users/username/Library/Mobile Documents/com~apple~CloudDocs/Sounds/file.aiff

And outputs this:

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

any advice?

Tetsujin
  • 115,663
SUBZ3RO
  • 107
  • 1
    Path looks wrong. I don't use iCloud Drive at all so I can't check, but see https://osxdaily.com/2017/11/16/access-icloud-drive-command-line-mac/ Might be as simple as escaping the space with \ – Tetsujin Oct 22 '22 at 10:12
  • I probably forgot how often I posted an answer to similar questions :-) – nohillside Oct 22 '22 at 13:17

1 Answers1

3

As with any shell command, you need to escape the space in the path name:

afplay ~/Library/Mobile\ Documents/com~apple~CloudDocs/Sounds/file.aiff

You also need to make sure that the file to be played is actually downloaded from iCloud. Is there a way via the command line to cause .icloud files to download? has some answers on how to accomplish this.

nohillside
  • 100,768