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

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 31 10:33:49 CET 2013


On 31/01/2013 06:50, Jeff Newmiller wrote:
> 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".

Or see ?file.path in R, which is OS-independent.


> ---------------------------------------------------------------------------
> 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:
>
>> Hi.
>>
>> I'm trying to export a .wav file using the writeWave function from
>> tuneR
>> package in a different folder than the default getwd().
>> After reading through the manuals of some audio packages I couldn't
>> figure
>> it out.
>>
>> I'm picking one 3-hour .wav file and asking the function to take a
>> sample
>> of 1 minute (from minute 100 to minute 101 of the 3-hour file) and
>> saving
>> 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.
>> What
>> I want to do is to write the "cut1.wav" file in a different folder.
>>
>> Any suggestions?
>>
>> Thanks in advance!
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list