Getting Data About Your Audio Files (And Not Using Metadata)

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span>
<h1 style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 3pt
<span style="background-color:transparent; font-style:normal; font-family:Arial; color:#000000; font-size:18pt; font-weight:bold Overview</h1>
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:italic; font-family:Tahoma; color:#008080; font-size:10pt; font-weight:bold “Wouldnt it be cool if” ...
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal Ever had one of those thoughts? That’s what this entire post is about: One of those “Wouldn’t it be cool if” moments.
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal I got inspiration from
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/c2ab2c16-31a8-4c43-acb7-478e4c8e2d20" target="_blank
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#0000ff; font-size:10pt; font-weight:normal; text-decoration:underline this post <span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal ,
sort of. It gave me a new twist to an old thought more like it.
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal Early on the OP was asked “<span style="background-color:transparent; font-style:italic; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal how
will you get the data about your music?<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal ” and it went into a whole other direction, but that’s what I’m here to show:
Another way to get the data about your music without dependence on the metadata.
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal The music that I have has fairly extensive tags embedded but as I’ve discovered, that’s not the case with all of them. It’s
a good starting point I suppose but is there another way?
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal Let me jump to the end, then in the next several posts, we’ll dissect the parts of it. My goal was to use “only out of the box
components and methods” and this is what we end up with:
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal Aside from the rudimentary things like song duration, how about if we could get a host of information about the songs, including
the cover art?
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal <img src="http://www.fls-tech.com/VBNet_Forum/02-12-12/Database_ScreenShot01.png
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal As shown in the example above, some also will have a link to additional information. The additional information may even contain
a way to watch a music video for that song like this:
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal <img src="http://www.fls-tech.com/VBNet_Forum/02-12-12/Database_ScreenShot02.png
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal Further, some will even contain what I call “Liner Notes” like this:
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal <img src="http://www.fls-tech.com/VBNet_Forum/02-12-12/Database_ScreenShot03.png
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<img src="http://www.fls-tech.com/VBNet_Forum/02-12-12/Database_ScreenShot04.png <span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal And of course, we’ll give the user a way to play the song using their default player:
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal <img src="http://www.fls-tech.com/VBNet_Forum/02-12-12/Database_ScreenShot05.png
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal If this interests you, read on …
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal This isn’t a new thought at all; I’ve explored this area before. Have a look
http://www.codeproject.com/Articles/36001/Using-Public-Web-Services-to-get-Information-about" target="_blank
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#0000ff; font-size:10pt; font-weight:normal; text-decoration:underline at this on Code Project <span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal .
Now before you go thinking that you’ve found the keys to the kingdom, I should explain a little minor issue about that – it doesn’t work!
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal In that, he relies heavily on three web services:
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal * Amazon Web Service<br/>

<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal * MusicBrainz
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal * LyricWiki
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal Amazon has significantly modified their service such that his methods don’t work now. If you follow the posts following the
thread, you’ll see a few people have tried workarounds but over the years, even those stopped working because apparently they (Amazon) are in a state of flux regarding their API.
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal LyricWiki is still alive and well, but – the music recording industry forced them to no longer offer their service to developers.
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal http://musicbrainz.org/" target="_blank <span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#0000ff; font-size:10pt; font-weight:normal; text-decoration:underline MusicBrainz <span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal
is in fact a heck of a resource and if you’re at all interested in this topic, I would encourage you to have a look around. It’s odd to work with, but it’s chock full of good information and they’re constantly adding to it or so it seems.
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal All that said, this example won’t use any of those but rather a different service all together:
http://www.last.fm/" target="_blank <span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#0000ff; font-size:10pt; font-weight:normal; text-decoration:underline Last Dot FM <span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal .
I can’t say that I know much about them, but I happened onto them a few months back when I was first experimenting with all this stuff.
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal They have an interesting API and if you’re interested in pursuing this, then you’ll need to get your own API key. It’s free
and http://www.last.fm/api" target="_blank <span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#0000ff; font-size:10pt; font-weight:normal; text-decoration:underline is available here <span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal .
Please be sure to read and fully understand their http://www.last.fm/api/tos" target="_blank
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#0000ff; font-size:10pt; font-weight:normal; text-decoration:underline Terms Of Service <span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal ,
including the following:
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt <span style="background-color:#d3d3d3; font-style:italic; font-family:Microsoft Sans Serif; color:#00008b; font-size:10pt; font-weight:normal You are permitted to use the Last.fm Data
solely for non-commercial purposes and for no other purpose and subject always to any limitations or conditions as advised to You by Last.fm at any time. If you are unsure whether your use of the Last.fm Data constitutes non-commercial or commercial use, you
should contact us.
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal and…
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:#d3d3d3; font-style:italic; font-family:Microsoft Sans Serif; color:#00008b; font-size:10pt; font-weight:normal You will not make more than 5 requests per originating IP address per second, averaged over a 5 minute period, without
prior written consent.
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal The last one is an important one. When I first jumped in a few months ago they were more vague, only saying “not too fast”,
so in the code that I’ll show in a bit you’ll see that I only allow their server to be ‘hit’ no faster than once every half second. I see now that I can modify that some but it’s your API key at risk, so – be prudent with your settings.
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal In my program code that I’ll show soon, I have it set up as two distinct areas:
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal Getting The Audio Data From Last.FM
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal Adding It To The Database
<p style="text-align:left; padding-bottom:0pt; text-indent:0pt; margin:0pt 0pt 6pt
<span style="background-color:transparent; font-style:normal; font-family:Tahoma; color:#000000; font-size:10pt; font-weight:normal I’m dividing this into several posts so that I don’t get the “HTML Too Long” message. Keep reading. :)


View the full article
 

Similar threads

Back
Top