WavPlayer: Set or Get the System Command for Playing WAV Files

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/sound.R

Description

findWavPlayer returns the most common system commands on your OS for playing wav files.

WavPlayer returns the command that is currently used by play.

setWavPlayer is used to define the command to be used by play.

Usage

1
2
3

Arguments

command

a vector of character strings giving the command to be used as "command wavfile.wav". If it contains more than one string, the commands are tested one after the other, and the first one that works properly will be used for future calls of the play command. If command=NULL,the command findWavPlayer() is used to determine the standard commands for your system.

Details

The play command makes a system call of the form "}command\code{ }wavfile\code{.wav", where 'command' is the string returned by WavPlayer().

The default commands are 'mplay32 /play' (calling the Windows media player) for Win32-systems and 'aplay' and 'mplayer' for Linux systems. Other commands will be added in future versions of this package.

Unfortunately for Windows 7/8/10 no command line tool for playing wav-files is included into the os. However, a suitable tool like 'wv_player.exe' can be installed. To download it, go to http://www.webxpace.com/software/.

But any other program that provides a system call of the above form to play wav files is also fine. Please report additional play commands to the maintainer so that they can be recognized automatically in future versions of this package.

When setWavPlayer is called, it tries to play an empty wav file, using the new command(s). If it fails, no changes are made.

Value

WavPlayer returns the wav play command that is currently used, or NULL, if none is selected yet.

findWavPlayer returns the default commands for your system, or NULL, if no command is known for your system.

Author(s)

Author: Matthias Heymann <mail@MatthiasHeymann.de>

Maintainer: Stefan Langenberg <langenberg@uni-bonn.de>

See Also

play for playing Sample objects or wav files.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
setWavPlayer("playwave")
# tries to set the command "playwave wavfile.wav" as the 
# preference for playing wav files with the play command.
# If successful,
WavPlayer()
# returns the string "playwave" afterwards.

## End(Not run)

sound documentation built on May 2, 2019, 2:10 a.m.

Related to WavPlayer in sound...