[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Work with Audio Files

Lloyd Linklater

12/14/2007 10:37:00 PM

Petr Kout wrote:
> Hi,
>
> I am new to Ruby on Rails and I consider converting my application
> written in Java into Ruby. The question is, however, is there any plugin
> or other way to handle MP3 and other audio files? I need to Ruby to be
> able to tell me how long the uploaded MP3 is and ideally, give me the
> possibility to cut the file on the server if it's too long. I looked all
> over Google, nothing found. Thank you very much for any advice.

http://www.ruby-...topic/...
--
Posted via http://www.ruby-....

7 Answers

Petr Kout

12/14/2007 10:52:00 PM

0

Lloyd Linklater wrote:
> Petr Kout wrote:
>> Hi,
>>
>> I am new to Ruby on Rails and I consider converting my application
>> written in Java into Ruby. The question is, however, is there any plugin
>> or other way to handle MP3 and other audio files? I need to Ruby to be
>> able to tell me how long the uploaded MP3 is and ideally, give me the
>> possibility to cut the file on the server if it's too long. I looked all
>> over Google, nothing found. Thank you very much for any advice.
>
> http://www.ruby-...topic/...

Hi,

thank you for the link, but it's not what I was looking for. I do not
need to play the mp3 file. I need to be able to analyze it on the
backend; that is, to get its length in seconds, and possibly truncate it
(not necessary). I was doing it in Java so far. If I can't do this on
the backend, I can't switch to Ruby, which is what I would love to do.

Thanks.

Peter
--
Posted via http://www.ruby-....

John Joyce

12/14/2007 11:55:00 PM

0

just dig through the gems.
there should be something that deals with id3 tags at the very minimum.
much of the info should really just be part of the file format anyway.
Implementing your own solution should be easy in Ruby, and a great
way to improve your Ruby.
I just googled this string
ruby audio files gem

plenty of stuff there to get you started.

Petr Kout

12/15/2007 12:05:00 AM

0

John Joyce wrote:
> just dig through the gems.
> there should be something that deals with id3 tags at the very minimum.
> much of the info should really just be part of the file format anyway.
> Implementing your own solution should be easy in Ruby, and a great
> way to improve your Ruby.
> I just googled this string
> ruby audio files gem
>
> plenty of stuff there to get you started.

Thank you John,

I will look into the Google search based on your keywords. I did not
exactly know how to put this into Google. The word gem is probably
important 'cause I didn't get the same results as you did before.

Thank you again.

Peter
--
Posted via http://www.ruby-....

Petr Kout

12/15/2007 1:41:00 AM

0

Konrad Meyer wrote:
> Quoth Petr Kout:
>> >
>> Thanks.
>>
>> Peter
>
> There is a great library out in the wild called "metadata" that you can
> use to
> get information about mp3s (as well as many other filetypes) that I
> think is
> available in gem form. You might take a look at that.
>
> If you want to truncate a constant bitrate mp3, AFAIK they are
> structured such
> that you *could* crudely lop off some bytes from the end (channels *
> time_to_clip * bitrate bytes). If not, you'll need to use some sort of
> external mp3 library. I don't know of any that exist with ruby bindings.
> You
> might look at LAME though I'm not sure how much that will do.
>
> HTH,

Okay Konrad, thanks very much! That sounds interesting. I will
definitely look into it. I was thinking that for cutting the mp3, I
might look for some other technology, such as a command line tool for
Linux and run it from inside Ruby on Rails. The metadata library sounds
like exactly what I need. I also need a library to crop pictures, but I
assume that that one should be much easier to find.

Thanks again.

Peter
--
Posted via http://www.ruby-....

John Joyce

12/15/2007 1:48:00 AM

0


On Dec 14, 2007, at 7:12 PM, Konrad Meyer wrote:

> Quoth Petr Kout:
>> Lloyd Linklater wrote:
>>> Petr Kout wrote:
>>>> Hi,
>>>>
>>>> I am new to Ruby on Rails and I consider converting my application
>>>> written in Java into Ruby. The question is, however, is there
>>>> any plugin
>>>> or other way to handle MP3 and other audio files? I need to Ruby
>>>> to be
>>>> able to tell me how long the uploaded MP3 is and ideally, give
>>>> me the
>>>> possibility to cut the file on the server if it's too long. I
>>>> looked all
>>>> over Google, nothing found. Thank you very much for any advice.
>>>
>>> http://www.ruby-forum.com/topic/...
>>
>> Hi,
>>
>> thank you for the link, but it's not what I was looking for. I do not
>> need to play the mp3 file. I need to be able to analyze it on the
>> backend; that is, to get its length in seconds, and possibly
>> truncate it
>> (not necessary). I was doing it in Java so far. If I can't do this on
>> the backend, I can't switch to Ruby, which is what I would love to
>> do.
>>
>> Thanks.
>>
>> Peter
>
> There is a great library out in the wild called "metadata" that you
> can use to
> get information about mp3s (as well as many other filetypes) that I
> think is
> available in gem form. You might take a look at that.
>
> If you want to truncate a constant bitrate mp3, AFAIK they are
> structured such
> that you *could* crudely lop off some bytes from the end (channels *
> time_to_clip * bitrate bytes). If not, you'll need to use some sort of
> external mp3 library. I don't know of any that exist with ruby
> bindings. You
> might look at LAME though I'm not sure how much that will do.
>
> HTH,
> --
> Konrad Meyer <konrad@tylerc.org> http://konrad.sobertil...
Remember, keyword there was CONSTANT bitrate, variable bitrate might
give you more trouble doing that without more care.
Be sure any meta data matches changes or some apps might complain
about the audio file.

pcrawfor

12/15/2007 4:05:00 PM

0

On Dec 14, 5:48 pm, John Joyce <dangerwillrobinsondan...@gmail.com>
wrote:
> On Dec 14, 2007, at 7:12 PM, Konrad Meyer wrote:
>
>
>
> > Quoth Petr Kout:
> >> Lloyd Linklater wrote:
> >>> Petr Kout wrote:
> >>>> Hi,
>
> >>>> I am new to Ruby on Rails and I consider converting my application
> >>>> written in Java into Ruby. The question is, however, is there
> >>>> any plugin
> >>>> or other way to handle MP3 and other audio files? I need to Ruby
> >>>> to be
> >>>> able to tell me how long the uploaded MP3 is and ideally, give
> >>>> me the
> >>>> possibility to cut the file on the server if it's too long. I
> >>>> looked all
> >>>> over Google, nothing found. Thank you very much for any advice.
>
> >>>http://www.ruby-forum.com/topic/...
>
> >> Hi,
>
> >> thank you for the link, but it's not what I was looking for. I do not
> >> need to play the mp3 file. I need to be able to analyze it on the
> >> backend; that is, to get its length in seconds, and possibly
> >> truncate it
> >> (not necessary). I was doing it in Java so far. If I can't do this on
> >> the backend, I can't switch to Ruby, which is what I would love to
> >> do.
>
> >> Thanks.
>
> >> Peter
>
> > There is a great library out in the wild called "metadata" that you
> > can use to
> > get information about mp3s (as well as many other filetypes) that I
> > think is
> > available in gem form. You might take a look at that.
>
> > If you want to truncate a constant bitrate mp3, AFAIK they are
> > structured such
> > that you *could* crudely lop off some bytes from the end (channels *
> > time_to_clip * bitrate bytes). If not, you'll need to use some sort of
> > external mp3 library. I don't know of any that exist with ruby
> > bindings. You
> > might look at LAME though I'm not sure how much that will do.
>
> > HTH,
> > --
> > Konrad Meyer <kon...@tylerc.org>http://konrad.sobertil...
>
> Remember, keyword there was CONSTANT bitrate, variable bitrate might
> give you more trouble doing that without more care.
> Be sure any meta data matches changes or some apps might complain
> about the audio file.

Hey,

There is a useful library ID3Lib that supports reading mp3 tags, and a
ruby wrapper for that library id3lib-ruby that is available as a gem
which I have used to read and modify mp3 files.

Paul

Petr Kout

12/15/2007 5:10:00 PM

0

pcrawfor wrote:
> On Dec 14, 5:48 pm, John Joyce <dangerwillrobinsondan...@gmail.com>
> wrote:
>> >>>> written in Java into Ruby. The question is, however, is there
>>
>> >> Thanks.
>> > structured such
>> Remember, keyword there was CONSTANT bitrate, variable bitrate might
>> give you more trouble doing that without more care.
>> Be sure any meta data matches changes or some apps might complain
>> about the audio file.
>
> Hey,
>
> There is a useful library ID3Lib that supports reading mp3 tags, and a
> ruby wrapper for that library id3lib-ruby that is available as a gem
> which I have used to read and modify mp3 files.
>
> Paul


Hi Paul,

thank you very much. That sounds like exactly what I am looking for.
Were you also able to use the library to modify variable bitrate mp3s?
Do you have any experience with modifying streaming formats with it?
Such as wma? Thanks a lot!

Peter
--
Posted via http://www.ruby-....