Ruby classes for MP3 de-/encoding

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

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?form_cat=123

or here:

http://rubyforge.org/projects/ruby-mp3info/

Yours,

tom

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

http://ruby-gnome2.sourceforge.jp/

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/~galt/info.rb

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

···

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

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

···

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/~galt/info.rb

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.

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. :slight_smile:

Matt

···

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/~galt/info.rb

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.

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/~galt/info.rb

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

I think you misunderstood my answer. The metadata stuff was meant to be

Seems like I really did! Sorry! :slight_smile:

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. :slight_smile:

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

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

···

On Sun, Nov 23, 2003 at 05:13:01AM +0900, Matthew Berg wrote:

In article 20031122191549.GB3071@tachyon.bsdgeek.net,
[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. :frowning:

Phil

Kind regards,
Dennis Oelkers

···

On Sun, Nov 23, 2003 at 06:22:16AM +0900, Phil Tomson wrote:

Dennis Oelkers dennis@sgi-powered.de wrote:

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

http://dev.faeriemud.org/~deveiant/Lame/

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.

···

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. :frowning:


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

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

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. :slight_smile:

Kind regards,
Dennis Oelkers

···

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!

Erm… I didn’t. I quoted someone else who did.

···

On Nov 23, 2003, at 1:45 PM, Sam Roberts wrote:

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!


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