Jump to content

Get Bpm?


Recommended Posts

I was wondering if it was possible to get the BPM(Beats per minute) from a audio file? Maybe there some DLL out there with some function to make this possible. I have no clue, just wanted some input from you guys. Thanks.

No expertise here, just a thought: the kind of file that drives electronic instruments, like MIDI, might have something like "beats per minute" actually recorded as a parameter in them somewhere, but an MP3 or AAC file wouldn't. I think with those you would have to examine the data, after lossy decompression no less, and mathematicaly extract the repeatitive main "beat" from all the other frequencies and "beats" in a typical song. All way over my head mathematicaly, but the point is, I don't think they record that as a data field you can just read out of the file.

I know that didn't help much, sorry... :think:

Edit: big_daddy is all over it, cool! I'm still pretty sure the functions provided are still not pulling the "BPM" from a data field in the file, but "listening" to the audio and calculating it with very cool maths.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thanks big_daddy & PsaltyDS for the quick reply. bpmDetection.exe works great but I am unable to get the BPM from the gui. It doesnt show up in the AU3Info tool window. Big_daddy (sounds funny calling u by this name) is there anyway I could use the DLLCall function and get the BPMs in the backend instead of executing the program? Thanks in advance.

Link to comment
Share on other sites

DjDeep00,

Ok.. I think this sounds like a cool idea but it looks like it will take a little work. The DLL bpmDetect requires the fmod sound library DLL. So, the first step will be to convert over the example of the DLL functions for fmod given in its documentation to the AutoIt format. After that is completed the rest should be as simple as calling a few DLL functions of bpmDetect and viola you have your numbers.

I'll post in the support forum and see if I can get some help porting Fmod Sound Library to AutoIt.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

DjDeep00,

Ok.. I think this sounds like a cool idea but it looks like it will take a little work. The DLL bpmDetect requires the fmod sound library DLL. So, the first step will be to convert over the example of the DLL functions for fmod given in its documentation to the AutoIt format. After that is completed the rest should be as simple as calling a few DLL functions of bpmDetect and viola you have your numbers.

I'll post in the support forum and see if I can get some help porting Fmod Sound Library to AutoIt.

Thanks Simucal, I have no idea where to start by converting the code to Autoit. It would be awesome if you or someone else can get us started with this coding. Now that I know that it's possible to get BPMs, I just cant wait. :think:

Link to comment
Share on other sites

  • 1 month later...

HI,

maybe this

;===============================================================================
; Function Name:    GetExtProperty($sPath,$iProp)
; Description:    Returns an extended property of a given file.
; Parameter(s):  $sPath - The path to the file you are attempting to retrieve an extended property from.
;                  $iProp - The numerical value for the property you want returned. If $iProp is is set
;                             to -1 then all properties will be returned in a 1 dimensional array in their corresponding order.
;                           The properties are as follows:
;                           Name = 0
;                           Size = 1
;                           Type = 2
;                           DateModified = 3
;                           DateCreated = 4
;                           DateAccessed = 5
;                           Attributes = 6
;                           Status = 7
;                           Owner = 8
;                           Author = 9
;                           Title = 10
;                           Subject = 11
;                           Category = 12
;                           Pages = 13
;                           Comments = 14
;                           Copyright = 15
;                           Artist = 16
;                           AlbumTitle = 17
;                           Year = 18
;                           TrackNumber = 19
;                           Genre = 20
;                           Duration = 21
;                           BitRate = 22
;                           Protected = 23
;                           CameraModel = 24
;                           DatePictureTaken = 25
;                           Dimensions = 26
;                           Width = 27
;                           Height = 28
;                           Company = 30
;                           Description = 31
;                           FileVersion = 32
;                           ProductName = 33
;                           ProductVersion = 34
; Requirement(s):   File specified in $spath must exist.
; Return Value(s):  On Success - The extended file property, or if $iProp = -1 then an array with all properties
;                  On Failure - 0, @Error - 1 (If file does not exist)
; Author(s):        Simucal (Simucal@gmail.com)
; Note(s):
;
;===============================================================================


#include <array.au3>
$path = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)")
$prop = _GetExtProperty($path,-1)
_ArrayDisplay($prop,"Property Array")

Func _GetExtProperty($sPath, $iProp)
    Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty
    $iExist = FileExists($sPath)
    If $iExist = 0 Then
        SetError(1)
        Return 0
    Else
        $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))
        $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))
        $oShellApp = ObjCreate ("shell.application")
        $oDir = $oShellApp.NameSpace ($sDir)
        $oFile = $oDir.Parsename ($sFile)
        If $iProp = -1 Then
            Local $aProperty[35]
            For $i = 0 To 34
                $aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i)
            Next
            Return $aProperty
        Else
            $sProperty = $oDir.GetDetailsOf ($oFile, $iProp)
            If $sProperty = "" Then
                Return 0
            Else
                Return $sProperty
            EndIf
        EndIf
    EndIf
EndFunc  ;==>_GetExtProperty

Look at Nr. 22

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

They are looking for the Beats per minute, not Bits per second.

That's a difference there between bits and beats...to clear things up, the GetExtProperty will get the bitrate, meaning the relation between song length and file size. However, beats per minute have absolutely nothing to do with this!!!

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

If we could port over the DLL calls to the fmod sound library we could get the beats per minute.

I might try and tackle this again.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...