Reading in MP3 files in Ruby

A

Andrew Triboletti

Hi all,
I'm pretty new to Ruby, and I came across the Ruby bindings
(http://pablotron.org/software/mb-ruby/) to the musicbrainz project
(musicbrainz.org).

I'd like to use Ruby to generate acoustic fingerprints when fed an MP3
file. Reading over the API, I see this method that looks like it will
do what I want:

/*
* Pass raw PCM data to generate a signature.
*
* Note: MusicBrainz::TRM#pcm_data must be called before this
function.
*
* Returns true if enough data has been sent to generate a signature,
* and false if more data is needed.
*
* Example:
* trm.generate_signature buf, BUFSIZ
*
*/
static VALUE mb_trm_gen_sig(VALUE self, VALUE buf) {


However, I'm not sure how I'd go about passing raw PCM data to Ruby.
Any suggestions?

Thanks alot!
 
S

Simon Strandgaard

Hi all,
I'm pretty new to Ruby, and I came across the Ruby bindings
(http://pablotron.org/software/mb-ruby/) to the musicbrainz project
(musicbrainz.org).

I'd like to use Ruby to generate acoustic fingerprints when fed an MP3
file. Reading over the API, I see this method that looks like it will
do what I want: [snip code]
However, I'm not sure how I'd go about passing raw PCM data to Ruby.
Any suggestions?

If I understand you correct, you want to pass PCM data from a C/C++
extension into Ruby ?

Then I would suggest using SWIG (scalable wrapper interface generator).
Its a RAD tool which can generate the necessary wrapper code for you.
http://www.swig.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top