[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Ruby classes for MP3 de-/encoding

Dennis Oelkers

11/22/2003 6:08:00 PM

Hello folks,

does anyone know of any Ruby collection of classes / modules for
decoding / encoding (maybe liblame bindings?) MP3 data?

I already looked for that on raa, freshmeat & even google, but
without any luck, so any help would be appreciated ...

Kind regards,
Dennis Oelkers


11 Answers

Tom Copeland

11/22/2003 6:27:00 PM

0

> does anyone know of any Ruby collection of classes / modules for
> decoding / encoding (maybe liblame bindings?) MP3 data?
>
> I already looked for that on raa, freshmeat & even google, but
> without any luck, so any help would be appreciated ...

Might be something in RubyForge here:

http://rubyforge.org/softwaremap/trove_list.php?fo...

or here:

http://rubyforge.org/projects/rub...

Yours,

tom



Matthew Berg

11/22/2003 7:04:00 PM

0

On Sat, 2003-11-22 at 13:07, Dennis Oelkers wrote:
> Hello folks,
>
> does anyone know of any Ruby collection of classes / modules for
> decoding / encoding (maybe liblame bindings?) MP3 data?
>
> I already looked for that on raa, freshmeat & even google, but
> without any luck, so any help would be appreciated ...
>
> Kind regards,
> Dennis Oelkers

How about Ruby/GStreamer, rather than using an mp3 specific solution:

http://ruby-gnome2.sourc...

You can do metadata extraction with GStreamer as well, though the
bundled bindings for libgstmediainfo can be slow in certain
circumstances. I have the extraction code I've been working on up here
though:

http://www.gothpoodle.com/~ga...

This should allow you to read id3 or ogg tags at minimum, and i think
wav riff headers though I haven't tested it on that yet.

Matt



Dennis Oelkers

11/22/2003 7:16:00 PM

0

On Sun, Nov 23, 2003 at 04:03:55AM +0900, Matthew Berg wrote:
> You can do metadata extraction with GStreamer as well, though the
> bundled bindings for libgstmediainfo can be slow in certain
> circumstances. I have the extraction code I've been working on up here
> though:
>
> http://www.gothpoodle.com/~ga...
>
> This should allow you to read id3 or ogg tags at minimum, and i think
> wav riff headers though I haven't tested it on that yet.

Thanks for all your help, but it seems as if you misunderstood my question
a bit. I'm not looking for classes to extract metadata information, I want
to encode/decode MP3 data.

Kind regards,
Dennis Oelkers


Matthew Berg

11/22/2003 8:13:00 PM

0

On Sat, 2003-11-22 at 14:15, Dennis Oelkers wrote:
> On Sun, Nov 23, 2003 at 04:03:55AM +0900, Matthew Berg wrote:
> > You can do metadata extraction with GStreamer as well, though the
> > bundled bindings for libgstmediainfo can be slow in certain
> > circumstances. I have the extraction code I've been working on up here
> > though:
> >
> > http://www.gothpoodle.com/~ga...
> >
> > This should allow you to read id3 or ogg tags at minimum, and i think
> > wav riff headers though I haven't tested it on that yet.
>
> Thanks for all your help, but it seems as if you misunderstood my question
> a bit. I'm not looking for classes to extract metadata information, I want
> to encode/decode MP3 data.

I think you misunderstood my answer. The metadata stuff was meant to be
a "you can do this as well" thing. GStreamer is a full multimedia
framework, which *does* do encoding and decoding of mp3 data.

For example, a program to play a music file would look something like
this: (note, this is off the top of my head, I haven't tested it, but if
you need example code there's some up on the Ruby-GNOME2 site and
included with the distribution)

require 'gst'

Gst.init

# element to read a file
src = Gst::ElementFactory.make("filesrc")
# element to decode autodetect and decode formats
spider = Gst::ElementFactory.make("spider")
# element to output to a media decide
sink = Gst::ElementFactory.make("osssink")


# create a pipeline
pipeline = Gst::Pipeline.new
# add the elements
pipeline.add(src, spider, sink)
# link them together
src >> spider >> sink

src.location = ARGV.first

# reset the pipeline and set the state to playing
pipeline.clear
pipeline.play

# keep processing the pipeline until it's finished
while pipeline.iterate do end

exit!

That example will actually handle any supported media type (mp3, ogg,
wav, au, flac, etc), but if you wanted to limit it to mp3 data you could
just use the "mad" element instead of "spider".

Want to output to a file instead? Use a "filesink" element. Want to
reencode to ogg maybe? Put a "oggenc" element before the "filesink".

In other words you can do most anything you want with audio and video
files you'd ever want to do. :)

Matt


Dennis Oelkers

11/22/2003 8:57:00 PM

0

On Sun, Nov 23, 2003 at 05:13:01AM +0900, Matthew Berg wrote:
> I think you misunderstood my answer. The metadata stuff was meant to be

Seems like I really did! Sorry! :)

> a "you can do this as well" thing. GStreamer is a full multimedia
> framework, which *does* do encoding and decoding of mp3 data.
>
[snip]
> In other words you can do most anything you want with audio and video
> files you'd ever want to do. :)

This is really great. Thank you very much for that hint! I'll try GStreamer
ASAP :)

Kind regards (and have a nice weekend),
Dennis Oelkers


ptkwt

11/22/2003 9:01:00 PM

0

In article <20031122191549.GB3071@tachyon.bsdgeek.net>,
Dennis Oelkers <dennis@sgi-powered.de> wrote:
>On Sun, Nov 23, 2003 at 04:03:55AM +0900, Matthew Berg wrote:
>> You can do metadata extraction with GStreamer as well, though the
>> bundled bindings for libgstmediainfo can be slow in certain
>> circumstances. I have the extraction code I've been working on up here
>> though:
>>
>> http://www.gothpoodle.com/~ga...
>>
>> This should allow you to read id3 or ogg tags at minimum, and i think
>> wav riff headers though I haven't tested it on that yet.
>
>Thanks for all your help, but it seems as if you misunderstood my question
>a bit. I'm not looking for classes to extract metadata information, I want
>to encode/decode MP3 data.
>

I would think this would be very compute intensive (all those dicrete
cosine transforms, which as I recall, are performed would take a lot of
time in Ruby). If you want to do this from Ruby, wouldn't it be best to
find an already existing C library and wrap it to create an extension?

Phil

Dennis Oelkers

11/22/2003 9:33:00 PM

0

On Sun, Nov 23, 2003 at 06:22:16AM +0900, Phil Tomson wrote:
> In article <20031122191549.GB3071@tachyon.bsdgeek.net>,
> Dennis Oelkers <dennis@sgi-powered.de> wrote:
[snip]
> >Thanks for all your help, but it seems as if you misunderstood my question
> >a bit. I'm not looking for classes to extract metadata information, I want
> >to encode/decode MP3 data.
> >
>
> I would think this would be very compute intensive (all those dicrete
> cosine transforms, which as I recall, are performed would take a lot of
> time in Ruby). If you want to do this from Ruby, wouldn't it be best to
> find an already existing C library and wrap it to create an extension?

Yes, that's what I was looking for, ruby bindings for a C lib doing MP3
encoding/decoding, but the only thing which is comparable to that is
ruby-gstreamer. I'll evaluate it intensively, if it isn't sufficient for
my task I'll probably write liblame/libwhatever bindings on my own. :(

> Phil

Kind regards,
Dennis Oelkers


Michael Granger

11/23/2003 3:36:00 PM

0

On Nov 22, 2003, at 2:33 PM, Dennis Oelkers wrote:

> Yes, that's what I was looking for, ruby bindings for a C lib doing MP3
> encoding/decoding, but the only thing which is comparable to that is
> ruby-gstreamer. I'll evaluate it intensively, if it isn't sufficient
> for
> my task I'll probably write liblame/libwhatever bindings on my own. :(

I'm working on bindings for libmp3lame. You can see what I have so far
at:

http://dev.faeriemud.org/~deve...

It's not yet complete, as I haven't yet figured out what a good Rubyish
API should look like, but if you're writing your own, it might be a
good starting point. The current code can create encoders and configure
them, and passes all its tests, but can't encode anything yet. =:)

I'd also welcome help if you're so inclined. I don't have this checked
into CVS yet, but I would do so if you (or anyone else) expressed an
interest in lending a hand.

--
Michael Granger <ged@FaerieMUD.org>
Rubymage, Believer, Architect
The FaerieMUD Consortium <http://www.FaerieMU...



Sam Roberts

11/23/2003 8:46:00 PM

0

Quoteing ged@FaerieMUD.org, on Mon, Nov 24, 2003 at 12:36:11AM +0900:
> On Nov 22, 2003, at 2:33 PM, Dennis Oelkers wrote:
>
> >Yes, that's what I was looking for, ruby bindings for a C lib doing MP3
> >encoding/decoding, but the only thing which is comparable to that is
> >ruby-gstreamer. I'll evaluate it intensively, if it isn't sufficient

Why do you say "comparable" to that? Gstreamer is a C lib for doing
audio/video encoding/decoding, and ruby-gsteamer is a ruby binding for
it, seems like exactly what you need!

Sam


Dennis Oelkers

11/23/2003 10:35:00 PM

0

On Mon, Nov 24, 2003 at 05:45:59AM +0900, Sam Roberts wrote:
> Why do you say "comparable" to that? Gstreamer is a C lib for doing
> audio/video encoding/decoding, and ruby-gsteamer is a ruby binding for
> it, seems like exactly what you need!

Yes of course, but I was looking for a smaller lib doing only MP3 en-/decoding,
not a complete "media framework" like gstream. But in fact after evaluating
gstreamer it seems to be even better for my purpose because it fulfills some
features I was looking for too, and offers possibilites to add extra
functionality to my project I didn't think about before. :)

Kind regards,
Dennis Oelkers