Play sound

install.packages('tuneR',dep=TRUE,clean=TRUE)

require(tuneR) or

library(tuneR)

play("siren.wav", "play")

#make a simple sine wave and play

t = seq(0, 3, 1/8000) #times in seconds if sample for 3 seconds at 8000Hz

u = (2^15-1)*sin(2*pi*440*t) #440 Hz sine wave that lasts t length seconds (here, 3 seconds)

w = Wave(u, samp.rate = 8000, bit=16) #make the wave variable

play(w, "play" ) #play the wave data by the player, 'play'

library(tuneR)

t = seq(0, 0.5, 1/8000)

u = (2^15-1)*sin(2*pi*440*t)

w = Wave(u, samp.rate = 8000, bit=16)

play(w, "play" )