We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Beats per minute
Page Index Toggle Pages: 1
Beats per minute (Read 415 times)
Beats per minute
Oct 5th, 2008, 10:49pm
 
I am looking for a way to find the current Beats per second or beats per minute. I think Minim should be able to do it but cannot find the correct call.

Does anybody know how I can extract this information from an mp3 in processing?

Thanks

Andy
Re: Beats per minute
Reply #1 - Oct 5th, 2008, 11:07pm
 
FYI, this is not a syntax question, I think if you have asked it in Sound, Music Libraries instead, you would have a better audience (sic).
Don't double post, if needed, the question will be moved. If not, I should have shut up, again... :-P

Anyway, I fear I can't really help you here, I don't even have an idea on how it can be done algorithmically. But I would be curious to know...
Re: Beats per minute
Reply #2 - Oct 6th, 2008, 12:56am
 
Tried asking something in there before with no response, was boring lol.

I am also looking to find out the other meta data from the mp3 file, like the artist name, song title, etc Are there any tools out there that can do it,

Within Processing do I have the ability to use any library which is in a jar format and use it as I would any other Java Appliction?

Thanks

Andy
Re: Beats per minute
Reply #3 - Oct 6th, 2008, 6:05pm
 
Here is a primitive attempt at using an ID3 library I found (there are several, apparently).
Code:
import org.farng.mp3.*;
import org.farng.mp3.id3.*;
import org.farng.mp3.lyrics3.*;


void setup()
{
File sourceFile = new File("E:/Archives/MoonSwing.mp3");
RandomAccessFile raf = null;
MP3File mp3file = null;
ID3v1_1 tag = null;
try
{
raf = new RandomAccessFile(sourceFile, "r");
}
catch (FileNotFoundException fnfe)
{
println("File not found: " + fnfe);
return;
}
/*
try
{
mp3file = new MP3File(sourceFile);
}
catch (IOException ioe)
{
println("IOException: " + ioe);
return;
}
catch (TagException te)
{
println("TagException: " + te);
return;
}
*/
try
{
tag = new ID3v1_1(raf);
}
catch (IOException ioe)
{
println("IOException: " + ioe);
return;
}
catch (TagNotFoundException tnfe)
{
println("TagNotFoundException: " + tnfe);
return;
}
println("Title: " + tag.getSongTitle());
println("Artist: " + tag.getLeadArtist());
println("Album: " + tag.getAlbumTitle());
println("Genre: " + tag.getSongGenre());
}
I used the jar at Java ID3 Tag Library. There might be better libraries, I just took the first found with Google...

You have to put the jar in a code folder in the sketch folder.
Re: Beats per minute
Reply #4 - Oct 6th, 2008, 8:35pm
 
wow thats very kind of you!

Thanks for your help - now just the beats per minute thing, suppose I could write something which simply counts the beats per second on average using the beat detector and thing divide over 60 or something :S

hmm

Re: Beats per minute
Reply #5 - Oct 24th, 2008, 5:18pm
 
<bump>
Page Index Toggle Pages: 1