Humberto Mohr
2013-Jan-31 04:45 UTC
[R] Writing audio files (.wav) in a different directory
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! -- *Humberto Mohr* * * Mestrando do PPG-Ecologia do Instituto Nacional de Pesquisas da Amazônia (INPA) Graduate student of the Master Program in Ecology in the National Institute of Amazon Research (INPA) [[alternative HTML version deleted]]
Humberto Mohr
2013-Jan-31 04:53 UTC
[R] Writing audio files (.wav) in a different directory
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! > > -- > *Humberto Mohr* > * > * > Mestrando do PPG-Ecologia do Instituto Nacional de Pesquisas da Amazônia > (INPA) > Graduate student of the Master Program in Ecology in the National > Institute of Amazon Research (INPA) >[[alternative HTML version deleted]]
Jeff Newmiller
2013-Jan-31 06:50 UTC
[R] Writing audio files (.wav) in a different directory
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:
>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!