Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: MP3 WAV Audio Sound length duration Windows Media Player
http://msdn2.microsoft.com/en-us/windowsmedia/bb190327.aspx
This seems to work for me:
soundfile = "C:\WINDOWS\tada.wav" ;.AVI, .MP3 etc... oWMP = CreateObject("WMPlayer.OCX") objSong = oWMP.newMedia(soundfile) ;Audio Item Attributes ;The following attributes are available for an audio item in Media Library. ; ;AcquisitionTime Attribute ;AlbumID Attribute ;AlbumIDAlbumArtist Attribute ;Author Attribute ;AverageLevel Attribute ;Bitrate Attribute ;BuyNow Attribute ;BuyTickets Attribute ;Copyright Attribute ;CurrentBitrate Attribute ;Duration Attribute ;FileSize Attribute ;FileType Attribute ;Is_Protected ;IsVBR Attribute ;MediaType Attribute ;MoreInfo Attribute ;PeakValue Attribute ;ProviderLogoURL Attribute ;ProviderURL Attribute ;RecordingTime Attribute ;ReleaseDate Attribute ;RequestState Attribute ;SourceURL Attribute ;SyncState Attribute ;Title Attribute ;TrackingID Attribute ;UserCustom1 Attribute ;UserCustom2 Attribute ;UserEffectiveRating Attribute ;UserLastPlayedTime Attribute ;UserPlayCount Attribute ;UserPlaycountAfternoon Attribute ;UserPlaycountEvening Attribute ;UserPlaycountMorning Attribute ;UserPlaycountNight Attribute ;UserPlaycountWeekday Attribute ;UserPlaycountWeekend Attribute ;UserRating Attribute ;UserServiceRating Attribute ;WM/AlbumArtist Attribute ;WM/AlbumTitle Attribute ;WM/Category Attribute ;WM/Composer Attribute ;WM/Conductor Attribute ;WM/ContentDistributor Attribute ;WM/ContentGroupDescription Attribute ;WM/EncodingTime Attribute ;WM/Genre Attribute ;WM/GenreID Attribute ;WM/InitialKey Attribute ;WM/Language Attribute ;WM/Lyrics Attribute ;WM/MCDI Attribute ;WM/MediaClassPrimaryID Attribute ;WM/MediaClassSecondaryID Attribute ;WM/Mood Attribute ;WM/ParentalRating Attribute ;WM/Period Attribute ;WM/ProtectionType Attribute ;WM/Provider Attribute ;WM/ProviderRating Attribute ;WM/ProviderStyle Attribute ;WM/Publisher Attribute ;WM/SubscriptionContentID Attribute ;WM/SubTitle Attribute ;WM/TrackNumber Attribute ;WM/UniqueFileIdentifier Attribute ;WM/WMCollectionGroupID Attribute ;WM/WMCollectionID Attribute ;WM/WMContentID Attribute ;WM/Writer Attribute ;WM/Year Attribute sourceurl = objSong.GetItemInfo("SourceUrl") duration = objSong.GetItemInfo("Duration") artist = objSong.GetItemInfo("Artist") title = objSong.GetItemInfo("Title") album = objSong.GetItemInfo("Album") bitrate = objSong.GetItemInfo("Bitrate") dafilesize = objSong.GetItemInfo("FileSize") dafiletype = objSong.GetItemInfo("FileType") mediatype = objSong.GetItemInfo("MediaType") category = objSong.GetItemInfo("WM/Category") genre = objSong.GetItemInfo("WM/Genre") tracknumber = objSong.GetItemInfo("WM/TrackNumber") year = objSong.GetItemInfo("WM/Year") data = StrCat("SourceUrl = ",sourceurl,@lf,"Title = ", title, @lf, "Duration (in seconds)= ", duration, @lf,"Artist = ", artist, @lf,"Album = ", album,@lf,"Bitrate (bits per second)= ", bitrate,@lf) data = StrCat(data, "FileSize (in bytes)= ", dafilesize, @lf, "FileType = ", dafiletype, @lf,"MediaType = ", mediatype, @lf,"WM/Category = ", category,@lf,"WM/Genre = ", genre,@lf) data = StrCat(data, "WM/TrackNumber = ", tracknumber , @lf, "WM/Year = ", year) Message("Song Info",data) objSong = 0 colMediaCollection = 0 oWMP = 0 exit
And so does this....
soundfile = "C:\WINDOWS\tada.wav" ;.AVI, .MP3 etc... oWMP = CreateObject("WMPlayer.OCX") colMediaCollection = oWMP.MediaCollection objSong = colMediaCollection.Add(soundfile) ;Audio Item Attributes ;The following attributes are available for an audio item in Media Library. ; ;AcquisitionTime Attribute ;AlbumID Attribute ;AlbumIDAlbumArtist Attribute ;Author Attribute ;AverageLevel Attribute ;Bitrate Attribute ;BuyNow Attribute ;BuyTickets Attribute ;Copyright Attribute ;CurrentBitrate Attribute ;Duration Attribute ;FileSize Attribute ;FileType Attribute ;Is_Protected ;IsVBR Attribute ;MediaType Attribute ;MoreInfo Attribute ;PeakValue Attribute ;ProviderLogoURL Attribute ;ProviderURL Attribute ;RecordingTime Attribute ;ReleaseDate Attribute ;RequestState Attribute ;SourceURL Attribute ;SyncState Attribute ;Title Attribute ;TrackingID Attribute ;UserCustom1 Attribute ;UserCustom2 Attribute ;UserEffectiveRating Attribute ;UserLastPlayedTime Attribute ;UserPlayCount Attribute ;UserPlaycountAfternoon Attribute ;UserPlaycountEvening Attribute ;UserPlaycountMorning Attribute ;UserPlaycountNight Attribute ;UserPlaycountWeekday Attribute ;UserPlaycountWeekend Attribute ;UserRating Attribute ;UserServiceRating Attribute ;WM/AlbumArtist Attribute ;WM/AlbumTitle Attribute ;WM/Category Attribute ;WM/Composer Attribute ;WM/Conductor Attribute ;WM/ContentDistributor Attribute ;WM/ContentGroupDescription Attribute ;WM/EncodingTime Attribute ;WM/Genre Attribute ;WM/GenreID Attribute ;WM/InitialKey Attribute ;WM/Language Attribute ;WM/Lyrics Attribute ;WM/MCDI Attribute ;WM/MediaClassPrimaryID Attribute ;WM/MediaClassSecondaryID Attribute ;WM/Mood Attribute ;WM/ParentalRating Attribute ;WM/Period Attribute ;WM/ProtectionType Attribute ;WM/Provider Attribute ;WM/ProviderRating Attribute ;WM/ProviderStyle Attribute ;WM/Publisher Attribute ;WM/SubscriptionContentID Attribute ;WM/SubTitle Attribute ;WM/TrackNumber Attribute ;WM/UniqueFileIdentifier Attribute ;WM/WMCollectionGroupID Attribute ;WM/WMCollectionID Attribute ;WM/WMContentID Attribute ;WM/Writer Attribute ;WM/Year Attribute sourceurl = objSong.GetItemInfo("SourceUrl") duration = objSong.GetItemInfo("Duration") artist = objSong.GetItemInfo("Artist") title = objSong.GetItemInfo("Title") album = objSong.GetItemInfo("Album") bitrate = objSong.GetItemInfo("Bitrate") dafilesize = objSong.GetItemInfo("FileSize") dafiletype = objSong.GetItemInfo("FileType") mediatype = objSong.GetItemInfo("MediaType") category = objSong.GetItemInfo("WM/Category") genre = objSong.GetItemInfo("WM/Genre") tracknumber = objSong.GetItemInfo("WM/TrackNumber") year = objSong.GetItemInfo("WM/Year") data = StrCat("SourceUrl = ",sourceurl,@lf,"Title = ", title, @lf, "Duration (in seconds)= ", duration, @lf,"Artist = ", artist, @lf,"Album = ", album,@lf,"Bitrate (bits per second)= ", bitrate,@lf) data = StrCat(data, "FileSize (in bytes)= ", dafilesize, @lf, "FileType = ", dafiletype, @lf,"MediaType = ", mediatype, @lf,"WM/Category = ", category,@lf,"WM/Genre = ", genre,@lf) data = StrCat(data, "WM/TrackNumber = ", tracknumber , @lf, "WM/Year = ", year) Message("Song Info",data) objSong = 0 colMediaCollection = 0 oWMP = 0 exit
Article ID: W16555
File Created: 2011:08:10:09:22:18
Last Updated: 2011:08:10:09:22:18