Hey nenemo,
my English is not very best, but i can help you.
So, i have the same problem for many times
. And i have for many hours the solution:
In my Project, i need the Audiolevel.
you must away Android 11 do that:
You must replace the Ar.setOutputFile("","/dev/null") to real Data File >>> Ar.setOutputFile(file.DirInternal,"example.wav")
And when you must limit the filesize from "example.wav" , then you must start a Timer with monitoring the filesize.
so, example my Timer:
when my example.wav bigger than 100 kb then i delete it and beginn a new empty file ! (so in Loop)
sub T1_tick
d=File.Size(file.DirInternal,"example.wav")
If d>100000 Then
ar.stop
File.Delete(file.DirInternal,"example.wav")
ar.AudioSource=micx.AS_MIC
ar.OutputFormat=micx.OF_THREE_GPP
ar.AudioEncoder=micx.AE_AMR_NB
ar.setOutputFile(ioHardware,"ref.wav")
ar.prepare
ar.start
Else
miclevel=ar.AudioMaxAmplitude 'miclevel >>> my Integer Variable for my Audiolevel.
End If
end sub
it is needed away Android 11 !!!!
so, i hope, i can help you for your project.
Best regards
Stefan