Re: [R] Limitations of audio processing in R

2011-09-22 Thread Spencer Graves

Hi, Michael & Ulisses:


ULISSES:  If you haven't already, I suggest you look at the hexView 
package including the R News article cited below and the readRaw 
function in particular.  I just used readRaw(filename, offset=4, 
nbytes=8) to read bytes 5:12 in filename;  in this case, filename was 
*.wma created by the Windows 7 Sound Recorder.



MICHAEL:  Thanks.


  Spencer


On 9/21/2011 4:25 PM, Michael Sumner wrote:

On Thu, Sep 22, 2011 at 8:08 AM, Spencer Graves
  wrote:

A more general question:  What tools are available in R for reading parts of
binary files?  'scan' allows you to 'skip' a certain number of records and
read the next 'nlines'.  Unfortunately, scan only seems to work for text
files not binary, and I cannot find a comparable function that would work
for binary files.  I tried library(sos);  (rb<- findFn('read binary')).
  This produced 299 matches.  Something there might solve the problem, but I
haven't taken the time to study it carefully.  I hope someone else will
know.


  Spencer


?readBin and ?seek

Also see "Viewing Binary Files with the hexView Package" in RNews
Volume 7/1, April 2007.

http://www.r-project.org/doc/Rnews/Rnews_2007-1.pdf

Cheers, Mike.



On 9/21/2011 2:15 PM, Ken wrote:

Also with Linux you can add more swap memory(which I'm pretty sure R
spills into if it hasn't reached it's  internal limits on 32 bit
installations). Windows pagefile is kind of obnoxious.
Ken Hutchison

On Sep 21, 2554 BE, at 5:05 PM, (Ted Harding)
  wrote:


Hi Ulisses!
Yes, "get more creative" -- or "get more memory"!

On the "creative" side, it may be worth thinking about
using an independent (non-R) audio file editor. I'm
writing from the standpoint of a Linux/Unixoid user
here -- I wouldn;t know how to set ebout this in WIndows.

You could use R to create a shell script which would run
the editor in such a way as to extract your 6 random samples,
and save them, where the script would be fed with the
randomly-chosen 5-minute intervals decided by R. This
could be done under the control of R, so you could set
it up for your 1500 or so sets of samples, which (with
the right editing program) could be done quite quickly.

On Linux (also available for Windows) a flexible audio
editor is 'sox' -- see:

  http://en.wikipedia.org/wiki/SoX

To take, say, a 5-minute sample starting at 1 hour,
10 min and 35sec into the audio file "infile.wav",
and save this as "outfile.wav", you can execute

  sox infile.wav outfile.wav trim 01:10:35 00:05:00

and such a command could easily be generated by R and
fed to a shell script (or simply executed from R by
using the system() command). My test just now with
a 5-minute long sample from a .wav file was completed
in about 5 seconds, so it is quite efficient.

There is a huge number of options for 'sox', allowing
you to manipulate almost any aspect of the editing.

Hoping this helps,
Ted.


On 21-Sep-11 19:55:22, R. Michael Weylandt wrote:

If you are running Windows it may be as simple as using
memory.limit() to allow R more memory -- if you are on
another OS, it may be possible to get the needed memory
by deleting various things in your workspace and running
gc()

Of course, if your computer's memory is<3GB, you are
probably going to have trouble with R's keeping all objects
in memory and will have to get more creative.

Michael

On Wed, Sep 21, 2011 at 3:43 PM, Ulisses.Camargo<
moliterno.cama...@gmail.com>wrote:


Hello everybody

I am trying to process audio files in R and had some problems
with files size. I´m using R packages 'audio' and 'sound'.
I´m trying a really simple thing and it is working well with
small sized .wav files. When I try to open huge audio files
I received this error message: "cannot allocate vector of
size 2.7 Gb". My job is open in R a 3-hour .wav file, make six
5-minute random audio subsamples, and than save these new files.
I have to do the same process +1500 times. My problems is not
in build the function to do the job, but in oppening the 3-hour
files. Does anybody knows how to handle big audio files in R?
Another package that allows me to do this work? I believe
this is a really simple thing, but I really don´t know what
to do to solve that memory problem.

Thank you very much for your answers,
all the best!

Ulisses


E-Mail: (Ted Harding)
Fax-to-email: +44 (0)870 094 0861
Date: 21-Sep-11   Time: 22:05:55
-- XFMail --

__
R-help@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.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-pr

Re: [R] Limitations of audio processing in R

2011-09-22 Thread Jeff Newmiller
1) I don't know about automated clipping using Audacity.

2) en.wiktionary.org/wiki/for_the_win
---
Jeff Newmiller The . . Go Live...
DCN: 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.

Spencer Graves  wrote:

Hi, Carl:


1. I've used Audacity and it seemed fine -- though I haven't 
used it much.


2. What's FTW? (None of the Wikipedia disambiguation entries 
seemed to fit.)


Thanks,
Spencer


On 9/22/2011 2:41 PM, Carl Witthoft wrote:
> With all due respect to those of us (including me) who love R, when 
> it comes to audio processing w/ freeware,
>
> Audacity FTW.
>
> 'nuff said
>
> Carl
>
>
> -- 
> Spencer Graves, PE, PhD
> President and Chief Technology Officer
> Structure Inspection and Monitoring, Inc.
> 751 Emerson Ct.
> San José, CA 95126
> ph: 408-655-4567
> web: www.structuremonitoring.com

_

R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Limitations of audio processing in R

2011-09-22 Thread Spencer Graves

Hi, Carl:


  1.  I've used Audacity and it seemed fine -- though I haven't 
used it much.



  2.  What's FTW?  (None of the Wikipedia disambiguation entries 
seemed to fit.)



  Thanks,
  Spencer


On 9/22/2011 2:41 PM, Carl Witthoft wrote:
With all due respect to those of us (including me) who love R,  when 
it comes to audio processing w/ freeware,


Audacity   FTW.

'nuff said

Carl


--
Spencer Graves, PE, PhD
President and Chief Technology Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567
web:  www.structuremonitoring.com


__
R-help@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.


Re: [R] Limitations of audio processing in R

2011-09-22 Thread Carl Witthoft
With all due respect to those of us (including me) who love R,  when it 
comes to audio processing w/ freeware,


Audacity   FTW.

'nuff said

Carl

--
-
Sent from my Cray XK6

__
R-help@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.


Re: [R] Limitations of audio processing in R

2011-09-22 Thread Uwe Ligges

Or if people want to do it the R way:

Use the tuneR package and its readWave function that supports reading 
parts of Wave files if the whole file is not relevant. You can specify 
it in many units, see its help page. tuneR has also the tools to cut, 
merge etc. Wave files and analyse it with basic tools.


If you want to deal with the whole thing in R: In CD quality this is 
roughly 2GB: 3 hours x 60 minutes x 60 seconds x 44100 samples x 2 
channels x 2 bytes and you need at least 6 GB to do sensible things with it.


Best,
Uwe Ligges








On 22.09.2011 00:26, Ulisses Camargo wrote:

Dear Ted,
Thank you very much about your answer, it really helped. Now I am working on
the function that will do all the job with sox help.
All the best,
Ulisses

2011/9/21 Ted Harding


Hi Ulisses!
Yes, "get more creative" -- or "get more memory"!

On the "creative" side, it may be worth thinking about
using an independent (non-R) audio file editor. I'm
writing from the standpoint of a Linux/Unixoid user
here -- I wouldn;t know how to set ebout this in WIndows.

You could use R to create a shell script which would run
the editor in such a way as to extract your 6 random samples,
and save them, where the script would be fed with the
randomly-chosen 5-minute intervals decided by R. This
could be done under the control of R, so you could set
it up for your 1500 or so sets of samples, which (with
the right editing program) could be done quite quickly.

On Linux (also available for Windows) a flexible audio
editor is 'sox' -- see:

  http://en.wikipedia.org/wiki/SoX

To take, say, a 5-minute sample starting at 1 hour,
10 min and 35sec into the audio file "infile.wav",
and save this as "outfile.wav", you can execute

  sox infile.wav outfile.wav trim 01:10:35 00:05:00

and such a command could easily be generated by R and
fed to a shell script (or simply executed from R by
using the system() command). My test just now with
a 5-minute long sample from a .wav file was completed
in about 5 seconds, so it is quite efficient.

There is a huge number of options for 'sox', allowing
you to manipulate almost any aspect of the editing.

Hoping this helps,
Ted.


On 21-Sep-11 19:55:22, R. Michael Weylandt wrote:

If you are running Windows it may be as simple as using
memory.limit() to allow R more memory -- if you are on
another OS, it may be possible to get the needed memory
by deleting various things in your workspace and running
gc()

Of course, if your computer's memory is<3GB, you are
probably going to have trouble with R's keeping all objects
in memory and will have to get more creative.

Michael

On Wed, Sep 21, 2011 at 3:43 PM, Ulisses.Camargo<
moliterno.cama...@gmail.com>  wrote:


Hello everybody

I am trying to process audio files in R and had some problems
with files size. I惴 using R packages 'audio' and 'sound'.
I惴 trying a really simple thing and it is working well with
small sized .wav files. When I try to open huge audio files
I received this error message: "cannot allocate vector of
size 2.7 Gb". My job is open in R a 3-hour .wav file, make six
5-minute random audio subsamples, and than save these new files.
I have to do the same process +1500 times. My problems is not
in build the function to do the job, but in oppening the 3-hour
files. Does anybody knows how to handle big audio files in R?
Another package that allows me to do this work? I believe
this is a really simple thing, but I really donæ„’ know what
to do to solve that memory problem.

Thank you very much for your answers,
all the best!

Ulisses



E-Mail: (Ted Harding)
Fax-to-email: +44 (0)870 094 0861
Date: 21-Sep-11   Time: 22:05:55
-- XFMail --







__
R-help@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.


__
R-help@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.


Re: [R] Limitations of audio processing in R

2011-09-21 Thread Michael Sumner
On Thu, Sep 22, 2011 at 8:08 AM, Spencer Graves
 wrote:
> A more general question:  What tools are available in R for reading parts of
> binary files?  'scan' allows you to 'skip' a certain number of records and
> read the next 'nlines'.  Unfortunately, scan only seems to work for text
> files not binary, and I cannot find a comparable function that would work
> for binary files.  I tried library(sos);  (rb <- findFn('read binary')).
>  This produced 299 matches.  Something there might solve the problem, but I
> haven't taken the time to study it carefully.  I hope someone else will
> know.
>
>
>      Spencer
>

?readBin and ?seek

Also see "Viewing Binary Files with the hexView Package" in RNews
Volume 7/1, April 2007.

http://www.r-project.org/doc/Rnews/Rnews_2007-1.pdf

Cheers, Mike.


>
> On 9/21/2011 2:15 PM, Ken wrote:
>>
>> Also with Linux you can add more swap memory(which I'm pretty sure R
>> spills into if it hasn't reached it's  internal limits on 32 bit
>> installations). Windows pagefile is kind of obnoxious.
>>    Ken Hutchison
>>
>> On Sep 21, 2554 BE, at 5:05 PM, (Ted Harding)
>>  wrote:
>>
>>> Hi Ulisses!
>>> Yes, "get more creative" -- or "get more memory"!
>>>
>>> On the "creative" side, it may be worth thinking about
>>> using an independent (non-R) audio file editor. I'm
>>> writing from the standpoint of a Linux/Unixoid user
>>> here -- I wouldn;t know how to set ebout this in WIndows.
>>>
>>> You could use R to create a shell script which would run
>>> the editor in such a way as to extract your 6 random samples,
>>> and save them, where the script would be fed with the
>>> randomly-chosen 5-minute intervals decided by R. This
>>> could be done under the control of R, so you could set
>>> it up for your 1500 or so sets of samples, which (with
>>> the right editing program) could be done quite quickly.
>>>
>>> On Linux (also available for Windows) a flexible audio
>>> editor is 'sox' -- see:
>>>
>>>  http://en.wikipedia.org/wiki/SoX
>>>
>>> To take, say, a 5-minute sample starting at 1 hour,
>>> 10 min and 35sec into the audio file "infile.wav",
>>> and save this as "outfile.wav", you can execute
>>>
>>>  sox infile.wav outfile.wav trim 01:10:35 00:05:00
>>>
>>> and such a command could easily be generated by R and
>>> fed to a shell script (or simply executed from R by
>>> using the system() command). My test just now with
>>> a 5-minute long sample from a .wav file was completed
>>> in about 5 seconds, so it is quite efficient.
>>>
>>> There is a huge number of options for 'sox', allowing
>>> you to manipulate almost any aspect of the editing.
>>>
>>> Hoping this helps,
>>> Ted.
>>>
>>>
>>> On 21-Sep-11 19:55:22, R. Michael Weylandt wrote:

 If you are running Windows it may be as simple as using
 memory.limit() to allow R more memory -- if you are on
 another OS, it may be possible to get the needed memory
 by deleting various things in your workspace and running
 gc()

 Of course, if your computer's memory is<3GB, you are
 probably going to have trouble with R's keeping all objects
 in memory and will have to get more creative.

 Michael

 On Wed, Sep 21, 2011 at 3:43 PM, Ulisses.Camargo<
 moliterno.cama...@gmail.com>  wrote:

> Hello everybody
>
> I am trying to process audio files in R and had some problems
> with files size. I´m using R packages 'audio' and 'sound'.
> I´m trying a really simple thing and it is working well with
> small sized .wav files. When I try to open huge audio files
> I received this error message: "cannot allocate vector of
> size 2.7 Gb". My job is open in R a 3-hour .wav file, make six
> 5-minute random audio subsamples, and than save these new files.
> I have to do the same process +1500 times. My problems is not
> in build the function to do the job, but in oppening the 3-hour
> files. Does anybody knows how to handle big audio files in R?
> Another package that allows me to do this work? I believe
> this is a really simple thing, but I really don´t know what
> to do to solve that memory problem.
>
> Thank you very much for your answers,
> all the best!
>
> Ulisses
>>>
>>> 
>>> E-Mail: (Ted Harding)
>>> Fax-to-email: +44 (0)870 094 0861
>>> Date: 21-Sep-11                                       Time: 22:05:55
>>> -- XFMail --
>>>
>>> __
>>> R-help@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.
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide

Re: [R] Limitations of audio processing in R

2011-09-21 Thread Ulisses Camargo
Dear Ted,
Thank you very much about your answer, it really helped. Now I am working on
the function that will do all the job with sox help.
All the best,
Ulisses

2011/9/21 Ted Harding 

> Hi Ulisses!
> Yes, "get more creative" -- or "get more memory"!
>
> On the "creative" side, it may be worth thinking about
> using an independent (non-R) audio file editor. I'm
> writing from the standpoint of a Linux/Unixoid user
> here -- I wouldn;t know how to set ebout this in WIndows.
>
> You could use R to create a shell script which would run
> the editor in such a way as to extract your 6 random samples,
> and save them, where the script would be fed with the
> randomly-chosen 5-minute intervals decided by R. This
> could be done under the control of R, so you could set
> it up for your 1500 or so sets of samples, which (with
> the right editing program) could be done quite quickly.
>
> On Linux (also available for Windows) a flexible audio
> editor is 'sox' -- see:
>
>  http://en.wikipedia.org/wiki/SoX
>
> To take, say, a 5-minute sample starting at 1 hour,
> 10 min and 35sec into the audio file "infile.wav",
> and save this as "outfile.wav", you can execute
>
>  sox infile.wav outfile.wav trim 01:10:35 00:05:00
>
> and such a command could easily be generated by R and
> fed to a shell script (or simply executed from R by
> using the system() command). My test just now with
> a 5-minute long sample from a .wav file was completed
> in about 5 seconds, so it is quite efficient.
>
> There is a huge number of options for 'sox', allowing
> you to manipulate almost any aspect of the editing.
>
> Hoping this helps,
> Ted.
>
>
> On 21-Sep-11 19:55:22, R. Michael Weylandt wrote:
> > If you are running Windows it may be as simple as using
> > memory.limit() to allow R more memory -- if you are on
> > another OS, it may be possible to get the needed memory
> > by deleting various things in your workspace and running
> > gc()
> >
> > Of course, if your computer's memory is <3GB, you are
> > probably going to have trouble with R's keeping all objects
> > in memory and will have to get more creative.
> >
> > Michael
> >
> > On Wed, Sep 21, 2011 at 3:43 PM, Ulisses.Camargo <
> > moliterno.cama...@gmail.com> wrote:
> >
> >> Hello everybody
> >>
> >> I am trying to process audio files in R and had some problems
> >> with files size. I惴 using R packages 'audio' and 'sound'.
> >> I惴 trying a really simple thing and it is working well with
> >> small sized .wav files. When I try to open huge audio files
> >> I received this error message: "cannot allocate vector of
> >> size 2.7 Gb". My job is open in R a 3-hour .wav file, make six
> >> 5-minute random audio subsamples, and than save these new files.
> >> I have to do the same process +1500 times. My problems is not
> >> in build the function to do the job, but in oppening the 3-hour
> >> files. Does anybody knows how to handle big audio files in R?
> >> Another package that allows me to do this work? I believe
> >> this is a really simple thing, but I really don愒 know what
> >> to do to solve that memory problem.
> >>
> >> Thank you very much for your answers,
> >> all the best!
> >>
> >> Ulisses
>
> 
> E-Mail: (Ted Harding) 
> Fax-to-email: +44 (0)870 094 0861
> Date: 21-Sep-11   Time: 22:05:55
> -- XFMail --
>



-- 
Ulisses Moliterno de Camargo
Instituto Nacional de Pesquisas da Amazônia

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Limitations of audio processing in R

2011-09-21 Thread Ted Harding
Once again, I would myself be inclined to farm this out
(in Linux) to the tools which come with the system. In this
case the command "dd" is useful (though one may need to be
careful about setting the options.

For instance,

  dd -bs=1 skip=54321 count=31415 if=infile of=outfile

would (having set block-size to bs=1 byte) copy count=31415
bytes (blocks) from the input file "infile" (if=infile),
starting at but position 54322 (skip=54321), and write
the result to "outfile" (of=outfile).

Ted.

On 21-Sep-11 22:08:02, Spencer Graves wrote:
> A more general question:  What tools are available in R for reading 
> parts of binary files?  'scan' allows you to 'skip' a certain number of
> records and read the next 'nlines'.  Unfortunately, scan only seems to 
> work for text files not binary, and I cannot find a comparable function
> that would work for binary files.  I tried library(sos);  (rb <- 
> findFn('read binary')).  This produced 299 matches.  Something there 
> might solve the problem, but I haven't taken the time to study it 
> carefully.  I hope someone else will know.
> 
> 
>Spencer
> 
> 
> On 9/21/2011 2:15 PM, Ken wrote:
>> Also with Linux you can add more swap memory(which I'm pretty sure R
>> spills into if it hasn't reached it's  internal limits on 32 bit
>> installations). Windows pagefile is kind of obnoxious.
>> Ken Hutchison
>>
>> On Sep 21, 2554 BE, at 5:05 PM, (Ted
>> Harding)  wrote:
>>
>>> Hi Ulisses!
>>> Yes, "get more creative" -- or "get more memory"!
>>>
>>> On the "creative" side, it may be worth thinking about
>>> using an independent (non-R) audio file editor. I'm
>>> writing from the standpoint of a Linux/Unixoid user
>>> here -- I wouldn;t know how to set ebout this in WIndows.
>>>
>>> You could use R to create a shell script which would run
>>> the editor in such a way as to extract your 6 random samples,
>>> and save them, where the script would be fed with the
>>> randomly-chosen 5-minute intervals decided by R. This
>>> could be done under the control of R, so you could set
>>> it up for your 1500 or so sets of samples, which (with
>>> the right editing program) could be done quite quickly.
>>>
>>> On Linux (also available for Windows) a flexible audio
>>> editor is 'sox' -- see:
>>>
>>>   http://en.wikipedia.org/wiki/SoX
>>>
>>> To take, say, a 5-minute sample starting at 1 hour,
>>> 10 min and 35sec into the audio file "infile.wav",
>>> and save this as "outfile.wav", you can execute
>>>
>>>   sox infile.wav outfile.wav trim 01:10:35 00:05:00
>>>
>>> and such a command could easily be generated by R and
>>> fed to a shell script (or simply executed from R by
>>> using the system() command). My test just now with
>>> a 5-minute long sample from a .wav file was completed
>>> in about 5 seconds, so it is quite efficient.
>>>
>>> There is a huge number of options for 'sox', allowing
>>> you to manipulate almost any aspect of the editing.
>>>
>>> Hoping this helps,
>>> Ted.
>>>
>>>
>>> On 21-Sep-11 19:55:22, R. Michael Weylandt wrote:
 If you are running Windows it may be as simple as using
 memory.limit() to allow R more memory -- if you are on
 another OS, it may be possible to get the needed memory
 by deleting various things in your workspace and running
 gc()

 Of course, if your computer's memory is<3GB, you are
 probably going to have trouble with R's keeping all objects
 in memory and will have to get more creative.

 Michael

 On Wed, Sep 21, 2011 at 3:43 PM, Ulisses.Camargo<
 moliterno.cama...@gmail.com>  wrote:

> Hello everybody
>
> I am trying to process audio files in R and had some problems
> with files size. I´m using R packages 'audio' and 'sound'.
> I´m trying a really simple thing and it is working well with
> small sized .wav files. When I try to open huge audio files
> I received this error message: "cannot allocate vector of
> size 2.7 Gb". My job is open in R a 3-hour .wav file, make six
> 5-minute random audio subsamples, and than save these new files.
> I have to do the same process +1500 times. My problems is not
> in build the function to do the job, but in oppening the 3-hour
> files. Does anybody knows how to handle big audio files in R?
> Another package that allows me to do this work? I believe
> this is a really simple thing, but I really don´t know what
> to do to solve that memory problem.
>
> Thank you very much for your answers,
> all the best!
>
> Ulisses
>>> 
>>> E-Mail: (Ted Harding)
>>> Fax-to-email: +44 (0)870 094 0861
>>> Date: 21-Sep-11   Time: 22:05:55
>>> -- XFMail --
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do rea

Re: [R] Limitations of audio processing in R

2011-09-21 Thread Spencer Graves
A more general question:  What tools are available in R for reading 
parts of binary files?  'scan' allows you to 'skip' a certain number of 
records and read the next 'nlines'.  Unfortunately, scan only seems to 
work for text files not binary, and I cannot find a comparable function 
that would work for binary files.  I tried library(sos);  (rb <- 
findFn('read binary')).  This produced 299 matches.  Something there 
might solve the problem, but I haven't taken the time to study it 
carefully.  I hope someone else will know.



  Spencer


On 9/21/2011 2:15 PM, Ken wrote:

Also with Linux you can add more swap memory(which I'm pretty sure R spills 
into if it hasn't reached it's  internal limits on 32 bit installations). 
Windows pagefile is kind of obnoxious.
Ken Hutchison

On Sep 21, 2554 BE, at 5:05 PM, (Ted Harding)  wrote:


Hi Ulisses!
Yes, "get more creative" -- or "get more memory"!

On the "creative" side, it may be worth thinking about
using an independent (non-R) audio file editor. I'm
writing from the standpoint of a Linux/Unixoid user
here -- I wouldn;t know how to set ebout this in WIndows.

You could use R to create a shell script which would run
the editor in such a way as to extract your 6 random samples,
and save them, where the script would be fed with the
randomly-chosen 5-minute intervals decided by R. This
could be done under the control of R, so you could set
it up for your 1500 or so sets of samples, which (with
the right editing program) could be done quite quickly.

On Linux (also available for Windows) a flexible audio
editor is 'sox' -- see:

  http://en.wikipedia.org/wiki/SoX

To take, say, a 5-minute sample starting at 1 hour,
10 min and 35sec into the audio file "infile.wav",
and save this as "outfile.wav", you can execute

  sox infile.wav outfile.wav trim 01:10:35 00:05:00

and such a command could easily be generated by R and
fed to a shell script (or simply executed from R by
using the system() command). My test just now with
a 5-minute long sample from a .wav file was completed
in about 5 seconds, so it is quite efficient.

There is a huge number of options for 'sox', allowing
you to manipulate almost any aspect of the editing.

Hoping this helps,
Ted.


On 21-Sep-11 19:55:22, R. Michael Weylandt wrote:

If you are running Windows it may be as simple as using
memory.limit() to allow R more memory -- if you are on
another OS, it may be possible to get the needed memory
by deleting various things in your workspace and running
gc()

Of course, if your computer's memory is<3GB, you are
probably going to have trouble with R's keeping all objects
in memory and will have to get more creative.

Michael

On Wed, Sep 21, 2011 at 3:43 PM, Ulisses.Camargo<
moliterno.cama...@gmail.com>  wrote:


Hello everybody

I am trying to process audio files in R and had some problems
with files size. I´m using R packages 'audio' and 'sound'.
I´m trying a really simple thing and it is working well with
small sized .wav files. When I try to open huge audio files
I received this error message: "cannot allocate vector of
size 2.7 Gb". My job is open in R a 3-hour .wav file, make six
5-minute random audio subsamples, and than save these new files.
I have to do the same process +1500 times. My problems is not
in build the function to do the job, but in oppening the 3-hour
files. Does anybody knows how to handle big audio files in R?
Another package that allows me to do this work? I believe
this is a really simple thing, but I really don´t know what
to do to solve that memory problem.

Thank you very much for your answers,
all the best!

Ulisses


E-Mail: (Ted Harding)
Fax-to-email: +44 (0)870 094 0861
Date: 21-Sep-11   Time: 22:05:55
-- XFMail --

__
R-help@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.

__
R-help@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.



--
Spencer Graves, PE, PhD
President and Chief Technology Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567
web:  www.structuremonitoring.com

__
R-help@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.


Re: [R] Limitations of audio processing in R

2011-09-21 Thread Ken
Also with Linux you can add more swap memory(which I'm pretty sure R spills 
into if it hasn't reached it's  internal limits on 32 bit installations). 
Windows pagefile is kind of obnoxious.
   Ken Hutchison 

On Sep 21, 2554 BE, at 5:05 PM, (Ted Harding)  wrote:

> Hi Ulisses!
> Yes, "get more creative" -- or "get more memory"!
> 
> On the "creative" side, it may be worth thinking about
> using an independent (non-R) audio file editor. I'm
> writing from the standpoint of a Linux/Unixoid user
> here -- I wouldn;t know how to set ebout this in WIndows.
> 
> You could use R to create a shell script which would run
> the editor in such a way as to extract your 6 random samples,
> and save them, where the script would be fed with the
> randomly-chosen 5-minute intervals decided by R. This
> could be done under the control of R, so you could set
> it up for your 1500 or so sets of samples, which (with
> the right editing program) could be done quite quickly.
> 
> On Linux (also available for Windows) a flexible audio
> editor is 'sox' -- see:
> 
>  http://en.wikipedia.org/wiki/SoX
> 
> To take, say, a 5-minute sample starting at 1 hour,
> 10 min and 35sec into the audio file "infile.wav",
> and save this as "outfile.wav", you can execute
> 
>  sox infile.wav outfile.wav trim 01:10:35 00:05:00 
> 
> and such a command could easily be generated by R and
> fed to a shell script (or simply executed from R by
> using the system() command). My test just now with
> a 5-minute long sample from a .wav file was completed
> in about 5 seconds, so it is quite efficient.
> 
> There is a huge number of options for 'sox', allowing
> you to manipulate almost any aspect of the editing.
> 
> Hoping this helps,
> Ted.
> 
> 
> On 21-Sep-11 19:55:22, R. Michael Weylandt wrote:
>> If you are running Windows it may be as simple as using
>> memory.limit() to allow R more memory -- if you are on
>> another OS, it may be possible to get the needed memory
>> by deleting various things in your workspace and running
>> gc()
>> 
>> Of course, if your computer's memory is <3GB, you are
>> probably going to have trouble with R's keeping all objects
>> in memory and will have to get more creative.
>> 
>> Michael
>> 
>> On Wed, Sep 21, 2011 at 3:43 PM, Ulisses.Camargo <
>> moliterno.cama...@gmail.com> wrote:
>> 
>>> Hello everybody
>>> 
>>> I am trying to process audio files in R and had some problems
>>> with files size. I´m using R packages 'audio' and 'sound'.
>>> I´m trying a really simple thing and it is working well with
>>> small sized .wav files. When I try to open huge audio files
>>> I received this error message: "cannot allocate vector of
>>> size 2.7 Gb". My job is open in R a 3-hour .wav file, make six
>>> 5-minute random audio subsamples, and than save these new files.
>>> I have to do the same process +1500 times. My problems is not
>>> in build the function to do the job, but in oppening the 3-hour
>>> files. Does anybody knows how to handle big audio files in R?
>>> Another package that allows me to do this work? I believe
>>> this is a really simple thing, but I really don´t know what
>>> to do to solve that memory problem.
>>> 
>>> Thank you very much for your answers,
>>> all the best!
>>> 
>>> Ulisses
> 
> 
> E-Mail: (Ted Harding) 
> Fax-to-email: +44 (0)870 094 0861
> Date: 21-Sep-11   Time: 22:05:55
> -- XFMail --
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] Limitations of audio processing in R

2011-09-21 Thread Ted Harding
Hi Ulisses!
Yes, "get more creative" -- or "get more memory"!

On the "creative" side, it may be worth thinking about
using an independent (non-R) audio file editor. I'm
writing from the standpoint of a Linux/Unixoid user
here -- I wouldn;t know how to set ebout this in WIndows.

You could use R to create a shell script which would run
the editor in such a way as to extract your 6 random samples,
and save them, where the script would be fed with the
randomly-chosen 5-minute intervals decided by R. This
could be done under the control of R, so you could set
it up for your 1500 or so sets of samples, which (with
the right editing program) could be done quite quickly.

On Linux (also available for Windows) a flexible audio
editor is 'sox' -- see:

  http://en.wikipedia.org/wiki/SoX

To take, say, a 5-minute sample starting at 1 hour,
10 min and 35sec into the audio file "infile.wav",
and save this as "outfile.wav", you can execute

  sox infile.wav outfile.wav trim 01:10:35 00:05:00 

and such a command could easily be generated by R and
fed to a shell script (or simply executed from R by
using the system() command). My test just now with
a 5-minute long sample from a .wav file was completed
in about 5 seconds, so it is quite efficient.

There is a huge number of options for 'sox', allowing
you to manipulate almost any aspect of the editing.

Hoping this helps,
Ted.


On 21-Sep-11 19:55:22, R. Michael Weylandt wrote:
> If you are running Windows it may be as simple as using
> memory.limit() to allow R more memory -- if you are on
> another OS, it may be possible to get the needed memory
> by deleting various things in your workspace and running
> gc()
> 
> Of course, if your computer's memory is <3GB, you are
> probably going to have trouble with R's keeping all objects
> in memory and will have to get more creative.
> 
> Michael
> 
> On Wed, Sep 21, 2011 at 3:43 PM, Ulisses.Camargo <
> moliterno.cama...@gmail.com> wrote:
> 
>> Hello everybody
>>
>> I am trying to process audio files in R and had some problems
>> with files size. I´m using R packages 'audio' and 'sound'.
>> I´m trying a really simple thing and it is working well with
>> small sized .wav files. When I try to open huge audio files
>> I received this error message: "cannot allocate vector of
>> size 2.7 Gb". My job is open in R a 3-hour .wav file, make six
>> 5-minute random audio subsamples, and than save these new files.
>> I have to do the same process +1500 times. My problems is not
>> in build the function to do the job, but in oppening the 3-hour
>> files. Does anybody knows how to handle big audio files in R?
>> Another package that allows me to do this work? I believe
>> this is a really simple thing, but I really don´t know what
>> to do to solve that memory problem.
>>
>> Thank you very much for your answers,
>> all the best!
>>
>> Ulisses


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 21-Sep-11   Time: 22:05:55
-- XFMail --

__
R-help@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.


Re: [R] Limitations of audio processing in R

2011-09-21 Thread R. Michael Weylandt
If you are running Windows it may be as simple as using memory.limit() to
allow R more memory -- if you are on another OS, it may be possible to get
the needed memory by deleting various things in your workspace and running
gc()

Of course, if your computer's memory is <3GB, you are probably going to have
trouble with R's keeping all objects in memory and will have to get more
creative.

Michael

On Wed, Sep 21, 2011 at 3:43 PM, Ulisses.Camargo <
moliterno.cama...@gmail.com> wrote:

> Hello everybody
>
> I am trying to process audio files in R and had some problems with files
> size. I´m using R packages 'audio' and 'sound'. I´m trying a really simple
> thing and it is working well with small sized .wav files. When I try to
> open
> huge audio files I received this error message: "cannot allocate vector of
> size 2.7 Gb". My job is open in R a 3-hour .wav file, make six 5-minute
> random audio subsamples, and than save these new files. I have to do the
> same process +1500 times. My problems is not in build the function to do
> the
> job, but in oppening the 3-hour files. Does anybody knows how to handle big
> audio files in R? Another package that allows me to do this work? I believe
> this is a really simple thing, but I really don´t know what to do to solve
> that memory problem.
>
> Thank you very much for your answers,
> all the best!
>
> Ulisses
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Limitations-of-audio-processing-in-R-tp3831192p3831192.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.