B4A Class [B4X] [XUI] Audio Wave

Discussion in 'Additional libraries, classes and official updates' started by jtare, Aug 5, 2018.

  1. jtare

    jtare Active Member Licensed User

    For a while now I've been looking for an animation to represent some sort of ai talking but couldn't find anything beside videos and gifs. I wanted something that can be usable in an app, so I came across with this project on github which is close enough for what I wanted but it was written in javascript which I know very little, but I managed to translate it to b4j and later to a b4x class.

    NOTE: I only translated the one in the left (no colors). It shouldn't be that hard to add the one in the right, I will try in the future.

    [​IMG]
    How to use it:
    (Add the siriview.bas class into the project)
    Code:
    Sub Globals
        
    Private canvas1 As B4XCanvas
        
    Private lblC As Label
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    Activity.Color = Colors.White
        lblC.Initialize(
    "")
        
    Activity.AddView(lblC,0,80%y,100%x,100%y-80%y - 20dip)
        canvas1.Initialize(lblC)
        
    Dim siriV As siriview
        siriV.Initialize(
    5'the refresh rate depends on the device, on pc 20 is fine but on android, 5 seems fine
        siriV.SiriWaveFunc(canvas1,lblC.Width, lblC.Height,1,1,0.12,6,0.0050.05,46,46,46,True)
        Sleep(
    5000)
        siriV.siriwave_setAmplitude(
    0.01)
        Sleep(
    1000)
        siriV.siriwave_setAmplitude(
    0.8)
    End Sub
    You can also set amplitud, set speed, start and stop.

    Only tested in b4a and b4j.

    As a first attempt it was close enough, what I'm looking for is something like this. (I just realize you need a pinterest account to see it)

    EDIT: Performance is not very good, I'm looking for a solution.
     

    Attached Files:

    Last edited: Aug 5, 2018
  2. klaus

    klaus Expert Licensed User

    I had a look at your project.
    I would suggest you to make an XUI CustomView out of it, which means one unique SiriView.bas file valid for all three products.
    You could then add the SiriView in the Designer like any other view.
     
    Peter Simpson likes this.
  3. jtare

    jtare Active Member Licensed User

    Thanks for the suggestion, I will look in the forum how to do it.
     
  4. klaus

    klaus Expert Licensed User

    Peter Simpson likes this.
  5. KMatle

    KMatle Expert Licensed User

    Another one: Don't call it "Siri" as the name is owned by Apple :cool:
     
    Multiverse app and jtare like this.
  6. jtare

    jtare Active Member Licensed User

    I changed the title
     
  7. Star-Dust

    Star-Dust Expert Licensed User

    Better if you remove the word Apple and ios from your post because they are owned by Apple inc. (C)

    All trademarks used in this message are owned by Apple inc. (C) :p
     
    Last edited: Aug 6, 2018
    Multiverse app and jtare like this.
  8. Multiverse app

    Multiverse app Active Member Licensed User

    This is very, very nice work!
    Are there any updates?
     
  9. jtare

    jtare Active Member Licensed User

    Unfortunately there are no new updates. I could not figure out how to get a consistent frame rate.
     
  10. Multiverse app

    Multiverse app Active Member Licensed User

    Just Added your class to one of our apps, it looks very good
    7b1a1538-bec9-411e-880a-5e13fa230293.jpg SmartSelect_20190525-184752.gif
     
    Alexander Stolte likes this.
  11. jtare

    jtare Active Member Licensed User

    Looks amazing! Thank you very much for using it, I appreciate it a lot. I'm glad you liked it.
     
    Multiverse app likes 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