beepr (version 1.3)

beep: Play a short sound

Description

beep plays a short sound which is useful if you want to get notified, for example, when a script has finished. As an added bonus there are a number of different sounds to choose from.

Usage

beep(sound = 1, expr = NULL)

Arguments

sound

character string or number specifying what sound to be played by either specifying one of the built in sounds, specifying the path to a wav file or specifying an url. The default is 1. Possible sounds are:

  1. "ping"

  2. "coin"

  3. "fanfare"

  4. "complete"

  5. "treasure"

  6. "ready"

  7. "shotgun"

  8. "mario"

  9. "wilhelm"

  10. "facebook"

  11. "sword"

If sound does not match any of the sounds above, or is a valid path or url, a random sound will be played. Currently beep can only handle http urls, https is not supported.

expr

An optional expression to be excecuted before the sound.

Details

If beep is not able to play the sound a warning is issued rather than an error. This is in order to not risk aborting or stopping the process that you wanted to get notified about.

Examples

Run this code
# NOT RUN {
# Play a "ping" sound
beep()

# }
# NOT RUN {
# Play a fanfare instead of a "ping".
beep("fanfare")
# or
beep(3)

# Play a random sound
beep(0)

# Update all packages and "ping" when it's ready
update.packages(ask=FALSE); beep()
# }

Run the code above in your browser using DataCamp Workspace