B4A Class [B4X] [XUI] Audio Wave


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.

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

Sub Activity_Create(FirstTime As Boolean)
    Activity.Color = Colors.White
    Activity.AddView(lblC,0,80%y,100%x,100%y-80%y - 20dip)
    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.005, 0.05,46,46,46,True)
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.


Last edited:


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.