# histograms library(audio) n<-44100 rate<-22050 # white noise with standard deviation 1 e<-array(NA_real_,n) wait<-readline("press enter to start recording") res<-record(e,rate,1) print("recording 2s sample ... ") wait<-readline("Please wait for the recording to finish, then press enter") me<-mean(e) sde<-sd(e) print(paste("mean and stddev. of recorded time series e: ",round(me,4), round(sde,4))) time<-seq(1,n,1)/rate plot(time,e,type='l') wait<-readline("Press enter for histogram") xbreaks<-seq(-10,10,0.5) hist(e,breaks=xbreaks) wait<-readline("Press enter to hear the recorded sample") play(e,rate=rate) outfile<-readline("enter file name for recorded sample (.csv will be added)") write.csv(cbind(time,e),file=paste("data/",outfile,".csv",sep=''))