[R] Writing audio files (.wav) in a different directory

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Thu Jan 31 07:50:31 CET 2013

Put the directory name into the filename string. The syntax for doing that is somewhat OS dependent, but for most cases you can use "/" as the separator. You really should Google "file path" and your OS and learn how to do this, because it is broadly applicable outside of R (not an R-help question). Look for info on "absolute path" and "relative path".
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

Humberto Mohr <humberto.mohr at gmail.com> wrote:

>I'm trying to export a .wav file using the writeWave function from
>package in a different folder than the default getwd().
>After reading through the manuals of some audio packages I couldn't
>it out.
>I'm picking one 3-hour .wav file and asking the function to take a
>of 1 minute (from minute 100 to minute 101 of the 3-hour file) and
>it in an object "rec".
>Here is what I'm doing:
> filename<-"QUm0B24x_SMS05_20100831_052100.wav"
> min.ini<-100
> min.fin<-101
> library(tuneR)
> rec<-readWave(filename,min.ini,min.fin,"minutes")
> writeWave(rec,"cut1.wav")
>It is writing the file in the same directory of the "filename" object.
>I want to do is to write the "cut1.wav" file in a different folder.
>Any suggestions?
>Thanks in advance!

More information about the R-help mailing list