Learn R Programming

seewave (version 1.7.6)

sox: Calls SoX

Description

This function calls SoX, the Swiss Army knife of sound processing programs.

Usage

sox(command, exename = NULL, path2exe = NULL)

Arguments

command
the SoX command to invoke.
exename
a character string specifying the name of the SoX binary file. If NULL, the default name "sox" will be used for Linux OS and "sox.exe" for Windows OS.
path2exe
a character string giving the path to the SoX binary file. If NULL, the default path "c:\sox-14-4-0\" will be used for Windows OS.

Details

See the documentation of SoX for proper use: http://sox.sourceforge.net/Docs/Documentation

References

SoX website: http://sox.sourceforge.net/

Examples

Run this code
## Generate a simple sound file at 440 Hz
s <- synth(cf=440, f= 8000, d=1, output="Wave")
savewav(s, file="mysound.wav")
## Plays the file
sox("mysound.wav", exe="play")
## Slows down  the  audio  tempo  (but  not  its  pitch)
sox("mysound.wav myslowsound.wav tempo 0.5")
## Cuts the file
sox("myslowsound.wav myslowcuttedsound.wav trim 0.25, 0.75")
## Deletes example files
file.remove("mysound.wav", "myslowsound.wav", "myslowcuttedsound.wav")

Run the code above in your browser using DataLab