Google Answers Logo
View Question
 
Q: Reading WMA audio properties from Visual Basic 6.0 ( No Answer,   1 Comment )
Question  
Subject: Reading WMA audio properties from Visual Basic 6.0
Category: Computers > Programming
Asked by: piolet-ga
List Price: $30.00
Posted: 14 Apr 2003 19:32 PDT
Expires: 14 May 2003 19:32 PDT
Question ID: 190561
We need to read the following information from Windows Media Audio
(.WMA) files:
- Song duration (seconds)
- Bitrate (BPS)
- Frequency

The WMA files use the microsoft DRM system, to protect the file, so
that only licensed users/computers will be able to listen to the file.
We don't need to get the sound without the license, we just need to
read that informational fields. Kazaa and other applications do it...
so there must be a way :)

The code should run on Visual Basic 6.0 and require no external DLLs
(except those included with standard windows installations).

Thanks and good luck!
Pablo.

Request for Question Clarification by mathtalk-ga on 16 Apr 2003 13:30 PDT
Hi, piolet-ga:

Please clarify what is meant by "bitrate" and "frequency".  I
understand song duration (though of course it need not be a song that
has been sampled), but I'm unclear on the other two items.

Also, just for the clarity, are you saying that you need to have code
that works independently of the presence of Windows Media Player (an
optional component in Windows installs)?  Which versions of Windows
need to be supported?

TIA, mathtalk-ga

Clarification of Question by piolet-ga on 21 Apr 2003 07:16 PDT
Sorry for not answering before... been AFK ;)
Both frequency and bitrate are factors related to the quality of the
sound:

Frequency is the number of times per second audio is sampled. CD's
have a frequency of 44,100 (44.1 kHz).

Bitrate is the compression level in bits per second; the more it is
compressed, the lower the bitrate, and the lower the quality. 128 kbps
is the most common.

Regarding Windows Media Player, as long as it is the component that
comes with windows, it is ok. It should work for 98, 98 SE, 2000 pro
and and XP home & pro.
If it requires another DLLs but they are not too big, I'll go ahead
with it... I can imagine that Microsoft has released many optional
things about this technology (just looking at Windows Media Player 9
Series).
Answer  
There is no answer at this time.

Comments  
Subject: Re: Reading WMA audio properties from Visual Basic 6.0
From: deefresh-ga on 21 Feb 2005 10:47 PST
 
I realize this is a really old question, but since noone answered...

In your VB project, add a reference to "Windows Media Player".

To get the duration of your WMA file (you can also get the duration of
an MP3) use this function:

Function GetDuration(fullFilePath As String) As String
Dim BasicEdit As WMEncBasicEdit
' Create the WMEncBasicEdit object.
Set BasicEdit = New WMEncBasicEdit
' Specify the input and output files.
BasicEdit.MediaFile = fullFilePath
' Add indexing to the file.
BasicEdit.Index = True
    
GetDuration = BasicEdit.duration
    
Set BasicEdit = Nothing
End Function

Pass in a fully-qualified path to your WMA file (ex.
"c:\wma\somefile.wma") and the function will return the duration of
the file in milliseconds.

If you want the bitrate and frequency instead of the duration, return
the value for BasicEdit.Profile

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy