R is a cool sound editor!

September 7, 2011

(This article was first published on Statistic on aiR, and kindly contributed to R-bloggers)

Capabilities of R are definitely unless! After my previous posts about some easy image editing in R (they are here, and here), now is the time to explore if R is capable of sound editing!

Just for fun, here I created a function that receives a phone number (or another sequence of numbers), and returns the equivalent melody you can listen if you press that sequence on your house’ phone… =D

It requires the sound library, and here’s the code.

Now you can simply create your phone melody =)

s2 <- PlayTel("556c885a4623#")

You can listen to it with the command:


(NOTE: in Windows 7 I was unable to find a wave player that works on batch mode – i.e. mplay32.exe. So this command doesn’t work on Windows 7. It works on Windows XP)

You can save the output using the command:

saveSample(s2, "tel.wav")

(This command works on Windows 7)

Here is an example of the output:

Have fun!! =)

To leave a comment for the author, please follow the link and comment on their blog: Statistic on aiR.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)