B4A Library Pitchdetection

Discussion in 'Additional libraries, classes and official updates' started by Max Koopman, May 3, 2019.

  1. Max Koopman

    Max Koopman Member Licensed User

    Hey everyone,

    I would like to share this new library.
    This library is based upon the pitchdetection from the TarsosDSP library(https://github.com/JorenSix/TarsosDSP).
    The wrapper has been been made by @somed3v3loper , many thanks to him !!

    This library has just one function and that is to do the pitchdetection, but this library is easier to implement than FFT and I think this library is more accurate than FFT is.
    The library has only been tested in B4a 9.0 which is currently the most recent version, other version are not tested but could work.

    The library consist of three files:

    DSP.jar
    DSP.xml
    TarsosDSP-Android-2.0-bin.jar

    All three files should be copied to your additional libraries folder.

    To use the library, you can use this example :
    Code:
    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.

    End Sub

    Sub Globals
        
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.
        Dim dp As DSP
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
        'Activity.LoadLayout("Layout1")
        dp.Initialize("dp")
    End Sub

    Sub Activity_Resume

    End Sub

    Sub dp_pitchdata(data As Float)
        
    Log("dp_pitchdata: "&data)
    End Sub
    Sub Activity_Pause (UserClosed As Boolean)

    End Sub

    Keep in mind that this library is making use of the PERMISSION.RECORD_AUDIO permission which is a dangerous permission. Make sure you use the runtimepermission to ask for permission to use audio record.

    A working sample app, with runtimepermissions is attached.

    A working B4A example with this library can be found in the play store under https://play.google.com/store/apps/details?id=nl.daxsoft.notelearner

    Furthermore, this is the first time I post a library here on the forum. If something is missing, please let me know! :)
     

    Attached Files:

    peacemaker, Ohanian, Erel and 6 others like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice