getPlayer: Get and set the audio player

Description Usage Arguments Details Value See Also Examples

Description

This allows you to get set the method used to play the result of your sonification. These functions are probably only necessary on Linux, but work on Linux, OS X, and Windows.

Usage

1
2
3
  getPlayer()

  setPlayer(newPlayer)

Arguments

newPlayer

A character string; either "audio::play" to indicate that you are using the play function from the audio package, or the path to media (*.wav) file player. See Details.

Details

By default on Windows and OS X, audio is played with the play function from the audio package. So getPlayer() will return "audio::play".

However, audio's play function does not work well on Linux–for instance, it seems to cause segmentation faults–so the default is aplay, which comes along with many Linux distributions. If you want to use another player, you can use setPlayer() to specify an external wav file player. Then, when print-ing a sonify object, playitbyr will render to a temporary file and then play it using system2.

For external players, I recommend a command-line player to avoid having to wait for a GUI to load up.

Value

setPlayer() is called for its side effect, to set the option for player.

getPlayer() returns the option set by setPlayer().

See Also

print.sonify, playLastRendering

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Get the current player
oldPlayer <- getPlayer()
oldPlayer

## Set the current player to aplay
setPlayer("aplay")
getPlayer()

## Reset player to the old setting
setPlayer(oldPlayer)

playitbyr documentation built on May 2, 2019, 6:08 p.m.