AutoHotkey Community

It is currently May 26th, 2012, 6:09 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: November 30th, 2008, 2:54 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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:
http://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 :( (The DLL is capable of processing 2000 files in that duration )
    Image


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. )

:)

Edit: couple of typos fixed

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Last edited by SKAN on November 30th, 2008, 4:30 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2008, 3:06 pm 
THANKS! this is really what i just needed!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 2nd, 2008, 12:04 am 
Offline

Joined: July 29th, 2005, 5:32 pm
Posts: 179
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 :D

_________________
.o0[ corey ]0o.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 2nd, 2008, 1:25 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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
}


:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2009, 8:19 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
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 (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2009, 8:39 pm 
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).


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2009, 9:22 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2009, 10:24 am 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
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. ;)

_________________
AHK tools by Drugwash (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2009, 12:43 am 
Offline

Joined: March 19th, 2009, 4:04 pm
Posts: 9
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/deta ... laylang=en

Hope, it helps.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2009, 2:26 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
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 (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 28th, 2009, 4:19 pm 
Offline

Joined: March 19th, 2009, 4:04 pm
Posts: 9
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...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2010, 4:50 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Has anyone started or finished to write a wrapper for Audiogenie?

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2010, 5:02 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2010, 5:24 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
There is a new version that has less functions I assume.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2010, 8:44 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Hi everybody,

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

Here is wrapped function for DynaCall using objects: AudioGenie3.ahk (515 functions :) ), 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 ;)

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group