AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Review: AudioGenie2.dll [Nagware]
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sun Nov 30, 2008 1:54 pm    Post subject: Review: AudioGenie2.dll [Nagware] Reply with quote

Download: AudioGenie2.dll ( UPX'ed to 135 KiB / Orig.sz 305 KiB ) or get it from Official download page
View: AudioGenie DLL Documentation

Intro:

AudioGenie is a fast 32Bit DLL with over 345 functions to read audio file information (like Bitrate, Samplerate, Frames, Duration, Version-Number, etc). The DLL also has functionality to read and write audio file tags like id3v1, id3v2, ape and more.

Quote:
www.audiogenie.de/en/index.htm

AudioGenie is Freeware. You can download it from the internet and use it for free. The only restriction is, that AudioGenie displays a small popup message for two seconds on project start, to signify that you are using AudioGenie.

But if you would like to disable the popup message, you can make a donation by visiting the donation link.
After that, you will be sent a Registration Key to deactivate the Popup in your Project.
You will be informed via e-mail if future updates for AudioGenie are available.


For 20 EUD you can get a commerical license and for lesser donations ( may be 5-10 ) you can get a key to suppress the nag-pop ( for personal use ) .. Fair enough?!..
The following popup is displayed for 2 seconds Sad (The DLL is capable of processing 2000 files in that duration )


I never thought I would recommend a nagware... but every other thing about AudioGenie is good - the DLL size, the execution speed and especially the interface. No handles/structures/pointers to worry about. When you open an Audio file with AUDIOAnalyzeFile() - it creates and maintains a structure internally. So all consecutive calls like GetID3V2Track(), GetID3V2Artist, GetID3V2Album() etc, do not even require a parameter - AudioGenie just returns it, much to our delight.
The only catch is that it handles strings as unicode.

Here is an example for a single file:
Code:
SetWorkingDir, %A_ScriptDir%
DllCall( "LoadLibrary", Str,"AudioGenie2.dll" )

ATC := A_TickCount
mp3FileA := "SoEmo.mp3"                                        ; Path to MP3 file
ATOU( mp3FileU, mp3FileA )                                     ; Convert path to Unicode
DllCall( "AudioGenie2\AUDIOAnalyzeFile", Str,mp3FileU )        ; Load Mp3 file

MsgBox, 64, % "AudioGenie - " ( A_TickCount-ATC ) "ms"
          , % "Track#:`t"     UTOA( DllCall("AudioGenie2\GetID3V2Track" ) ) "`n"
            . "Title:`t"      UTOA( DllCall("AudioGenie2\GetID3V2Title" ) ) "`n"
            . "Artist:`t"     UTOA( DllCall("AudioGenie2\GetID3V2Artist") ) "`n"
            . "Album:`t"      UTOA( DllCall("AudioGenie2\GetID3V2Album" ) ) "`n"
            . "Genre:`t"      UTOA( DllCall("AudioGenie2\GetID3V2Genre" ) ) "`n"

ATOU( ByRef Unicode, Ansi ) { ; Ansi to Unicode
 VarSetCapacity( Unicode, (Len:=StrLen(Ansi))*2+1, 0 )
 Return DllCall( "MultiByteToWideChar", Int,0,Int,0,Str,Ansi,Int,Len, Str,Unicode, Int,Len )
}

UTOA( pUnicode )  {           ; Unicode to Ansi
  VarSetCapacity( Ansi,(nSz:=DllCall( "lstrlenW", UInt,pUnicode )+1) )
  DllCall( "WideCharToMultiByte", Int,0, Int,0, UInt,pUnicode, Int,nSz
                                , Str,Ansi, Int,nSz+1, Int,0, Int,0 )
Return Ansi
}


Extended example:
Code:
SetWorkingDir, %A_ScriptDir%
SetBatchLines -1
mp3Path := "E:\MP3\Tamil\"
Loop, %mp3Path%\*.mp3,0,1
  mp3List .= ( mp3List<>wm_null ? "`n" : "" ) . A_LoopFileLongPath

Gui, Add, ListView, w800 r40 Grid -Theme, #|Length|Title|Artist|Album|Genre

DllCall( "LoadLibrary", Str,"AudioGenie2.dll" )
SetTimer, HideNag, -1
DllCall( "AudioGenie2\AUDIOAnalyzeFile", Str,Dummy ) ; Dummy Call for SplashText

T1 := A_TickCount
Loop, Parse, mp3List, `n
 {
   mp3FileA := A_LoopField
   ATOU(mp3FileU,mp3FileA)

   If DllCall( "AudioGenie2\AUDIOAnalyzeFile", Str,mp3FileU ) <> 1
      Continue

   TrkLenMs := DllCall( "AudioGenie2\AUDIOGetDurationMillis" )
   TrkLen   := FormatMs( TrkLenMs )
   
   Track# := UTOA( DllCall("AudioGenie2\GetID3V2Track" ) )
   Title  := UTOA( DllCall("AudioGenie2\GetID3V2Title" ) )
   Artist := UTOA( DllCall("AudioGenie2\GetID3V2Artist") )
   Album  := UTOA( DllCall("AudioGenie2\GetID3V2Album" ) )
   Genre  := UTOA( DllCall("AudioGenie2\GetID3V2Genre" ) )
   
   LV_Add( "", Track#, TrkLen, Title, Artist, Album, Genre )
   mp3FilesCount += 1
 }
T2 := A_TickCount
LV_ModifyCol( 1, "20" ) , LV_ModifyCol( 2, "40 Center" ), LV_ModifyCol( 3, "200" )
LV_ModifyCol( 4, "200" ), LV_ModifyCol( 5, "200" ), LV_ModifyCol( 6, "120" )
Gui, Show,, % "Audio Genie - ID3v2 Demo ( " mp3FilesCount " files in " T2-T1 "ms. )"
Return

GuiClose:
 ExitApp
Return

ATOU( ByRef Unicode, Ansi ) { ; Ansi to Unicode
 VarSetCapacity( Unicode, (Len:=StrLen(Ansi))*2+1, 0 )
 Return DllCall( "MultiByteToWideChar", Int,0,Int,0,Str,Ansi,Int,Len, Str,Unicode, Int,Len )
}

UTOA( pUnicode )  {           ; Unicode to Ansi
  VarSetCapacity( Ansi,(nSz:=DllCall( "lstrlenW", UInt,pUnicode )+1) )
  DllCall( "WideCharToMultiByte", Int,0, Int,0, UInt,pUnicode, Int,nSz
                                , Str,Ansi, Int,nSz+1, Int,0, Int,0 )
Return Ansi
}

FormatMs( Ms ) {
  Secs := Ms//1000, Time:=20000101
  Time += %Secs%, Seconds
  FormatTime, mmss, %Time%, mm:ss
  Return ((hh:=Round(Secs//3600)) > 0 ? hh ":" : "" ) mmss
}

HideNag:
 WinWait, ahk_class #32770, This Project uses the Freeware AudioGenie2
 WinHide
Return


I am also wrapping up functions for MediaInfo.dll which would suffice for read requirements, but for writing tags, I would recommend this DLL. ( Disclaimer: Try enough before registering. )

Smile

Edit: couple of typos fixed
_________________
URLGet - Internet Explorer based Downloader


Last edited by SKAN on Sun Nov 30, 2008 3:30 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
dangerberk
Guest





PostPosted: Sun Nov 30, 2008 2:06 pm    Post subject: Reply with quote

THANKS! this is really what i just needed!
Back to top
freakkk



Joined: 29 Jul 2005
Posts: 179

PostPosted: Mon Dec 01, 2008 11:04 pm    Post subject: Reply with quote

Thanks SKAN for demonstrating this dll. It looks super simple to use, & has a great set of features!

Also-- somewhat unrelated to point of this thread, but thanks for demo'ing how simple unicode-2-ansi (& vice versa) can be accomplished.

I was soon gonna research a quick api method for this, but u have now brought to my attention Very Happy
_________________
.o0[ corey ]0o.
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Tue Dec 02, 2008 12:25 am    Post subject: Reply with quote

freakkk wrote:
but thanks for demo'ing how simple unicode-2-ansi (& vice versa) can be accomplished.


Please note that, it is safer to use arg types as UInt:

Code:
ATOU( ByRef Unicode, Ansi ) { ; Ansi to Unicode
 VarSetCapacity( Unicode, (Len:=StrLen(Ansi))*2+1, 0 )
 Return DllCall( "MultiByteToWideChar", Int,0,Int,0,Str,Ansi,UInt,Len, Str,Unicode, UInt,Len )
}

UTOA( pUnicode )  {           ; Unicode to Ansi
  VarSetCapacity( Ansi,(nSz:=DllCall( "lstrlenW", UInt,pUnicode )+1) )
  DllCall( "WideCharToMultiByte", Int,0, Int,0, UInt,pUnicode, UInt,nSz
                                , Str,Ansi, UInt,nSz+1, Int,0, Int,0 )
Return Ansi
}


Smile
Back to top
View user's profile Send private message Send e-mail
Drugwash



Joined: 07 Sep 2008
Posts: 921
Location: Ploiesti, RO

PostPosted: Fri Feb 06, 2009 7:19 pm    Post subject: Reply with quote

Just a heads up for anyone targeting Win9x (too):

The dll doesn't load in Win9x, throws error 31 (A device attached to the system is not functioning) which usually happens for modules compiled in VS2008. Dependencies look OK, no imported function missing.

I suppose the ActiveX version (allegedly working in all Win versions according to official site) would be of no interest here.
_________________
AHK tools by Drugwash
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Guest






PostPosted: Fri Feb 06, 2009 7:39 pm    Post subject: Reply with quote

Drugwash wrote:
Just a heads up for anyone targeting Win9x (too):

The dll doesn't load in Win9x,

Thanks for the heads up - you are not the only Win9x user (despite the popular opinion).
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Fri Feb 06, 2009 8:22 pm    Post subject: Reply with quote

Friends, please test MediaInfo.dll and let me know if it works in Win98SE. I can wrap the functions for you.
BTW, are you people only interested in non-english support or would English Ansi tags suffice?
Back to top
View user's profile Send private message Send e-mail
Drugwash



Joined: 07 Sep 2008
Posts: 921
Location: Ploiesti, RO

PostPosted: Sat Feb 07, 2009 9:24 am    Post subject: Reply with quote

Thank you for your interest, Suresh.
MediaInfo does work for me in Win98SE with the demo script presented in that thread. It does take quite a while (about 10 sec) before loading and displaying first set of information (700MHz CPU, 256MB RAM).

If you could find a way to grab Unicode information and pass it on to a RichEdit control (such as the cRichEdit library by corrupt), that would be wonderful. I've tried to do something like that yesterday but failed so far. However, reading Unicode from a rtf file works perfectly on my system so we're not that far away from the truth.

Such solution would be the cherry on top of the cake for Trout Player's info field. Wink
_________________
AHK tools by Drugwash
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
gregster



Joined: 19 Mar 2009
Posts: 9

PostPosted: Wed Mar 25, 2009 11:43 pm    Post subject: Reply with quote

I'm not using Win9x anymore, but I read on the audiogenie forum that you need to install unicode support to get 9x and ME working. You can get it here:

http://www.microsoft.com/downloads/details.aspx?FamilyId=73BA7BD7-ED06-4F0D-80A4-2A7EEAEE17E2&displaylang=en

Hope, it helps.
Back to top
View user's profile Send private message
Drugwash



Joined: 07 Sep 2008
Posts: 921
Location: Ploiesti, RO

PostPosted: Thu Mar 26, 2009 1:26 pm    Post subject: Reply with quote

I've had MSLU installed for a long time already, so AudioGenie not working on my system has a different reason, most likely the one already mentioned in my Feb.6 post.

Since the code is not freely available, I can't try to self-compile it in VC6 and see if it works. Maybe they'll change project settings or compiler to restore Win9x compatibility, at some point.
_________________
AHK tools by Drugwash
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
gregster



Joined: 19 Mar 2009
Posts: 9

PostPosted: Sat Mar 28, 2009 3:19 pm    Post subject: Reply with quote

Hi folks,

i would really appreciate some help with calling the audiogenie dll. What I try to do is changing the title of a mp3. But depending what I do, I get a number (like "388516") or question marks or nothing as a result.

I assume some problem with unicode<->ansi or with the data types. But I just don't get it...

Code:

SetWorkingDir, %A_ScriptDir%
DllCall( "LoadLibrary", Str,"AudioGenie2.dll" )

; Load mp3
mp3FileA := "test.mp3"                          ; Path to MP3 file
ATOU( mp3FileU, mp3FileA )                  ; Convert path to Unicode
_audio_kind := DllCall( "AudioGenie2\AUDIOAnalyzeFile", Str,mp3FileU)

; Change title
mytitle := "This is a test title"
ATOU (mytitleU, mytitle)
DllCall("AudioGenie2\SetAUDIOTitle", str, mytitleU)
DllCall("AudioGenie2\AUDIOSaveChanges")

;Check result
result := DllCall("AudioGenie2\GetAUDIOTitle")
msgbox %result%
result_ansi := UTOA(result)         
msgbox %result_ansi%

; Ascii 2 Unicode and vice versa *******************************
ATOU( ByRef Unicode, Ansi ) { ; Ansi to Unicode
 VarSetCapacity( Unicode, (Len:=StrLen(Ansi))*2+1, 0 )
 Return DllCall( "MultiByteToWideChar", Int,0,Int,0,Str,Ansi,UInt,Len, Str,Unicode, UInt,Len )
}

UTOA( pUnicode )  {           ; Unicode to Ansi
  VarSetCapacity( Ansi,(nSz:=DllCall( "lstrlenW", UInt,pUnicode )+1) )
  DllCall( "WideCharToMultiByte", Int,0, Int,0, UInt,pUnicode, UInt,nSz
                                , Str,Ansi, UInt,nSz+1, Int,0, Int,0 )
Return Ansi
}



Thank you in advance.

Greg

EDIT: OK, I think I solved the problem: I think there was a space too much in the line ATOU_(mytitleU, mytitle); it should be ATOU(mytitleU, mytitle). Tricky ahk, bit I'm still a beginner...

EDIT#2: By the way, I don't encounter any nag screens...
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Tue Feb 16, 2010 3:50 pm    Post subject: Reply with quote

Has anyone started or finished to write a wrapper for Audiogenie?
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Tue Feb 16, 2010 4:02 pm    Post subject: Reply with quote

Sounds like fun, 340 functions....
I guess there is a way to speed that up using automatic conversion of C header file with some AHKL object code. Plus, libray is unicode by default.
_________________
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Tue Feb 16, 2010 4:24 pm    Post subject: Reply with quote

There is a new version that has less functions I assume.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 4652
Location: AHK Forum

PostPosted: Tue Feb 16, 2010 7:44 pm    Post subject: Reply with quote

Hi everybody,

Can I ask you all to have a play with unicode AutoHotkey_H and Dynacall?

Here is wrapped function for DynaCall using objects: AudioGenie3.ahk (515 functions Smile ), all functions beside those that require an array as parameter like ID3V2AddEncryptionW should work.
You can download info about functions here: http://www.audiogenie.de/en/download.htm
Looks like this:
Code:
FileSelectFile,dll,,,Select AudioGenie3.dll,AudioGenie3.dll
FileSelectFile,file,,,Select an mp3 file,*.mp3
mp3:=AudioGenie3(dll)
DynaCall(mp3.AUDIOAnalyzeFileW,file)
MsgBox % "Version: " DynaCall(mp3.ID3V2GetVersionW)
         . "`nTitle: " DynaCall(mp3.ID3V1GetTitleW)
         . "`nYear: " DynaCall(mp3.ID3V1GetYearW)


I would be pleased to get some feedback, thank you Wink
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group