Android Question Audio Streaming Break Down

Bpick

Member
Licensed User
Longtime User
I'm trying to add speech-to-text to the walkie-talkie program, and I"m having a bit of a problem.

Basically, I want to take the audio from one side, convert it in real time on the receiver end to text. It's for a hearing impaired friend who was big into ham radios in the 70's.

In the Connector Module, I've made the following changes to first change the audio into some sort of string:
B4X:
Sub AudioStream_RecordBuffer (Data() As Byte)
' taken from http://www.b4x.com/android/forum/threads/asyncstreams-tutorial.7669/#content
    If sendingAudio Then
    Dim msg As String
    Dim bcon As ByteConverter
    msg=BytesToString(Data,0,Data.Length,"UTF-8")
    Log (msg)
    'msg=bcon.StringToBytes(msg,"UTF-8")
    Dim Data() As Byte
        Data = msg.GetBytes("UTF8")
        astream.Write(Data)
    End If
End Sub

Sub astream_NewData (buffer() As Byte)
    If sendingAudio = False Then
    Dim msg As String
    Dim bcon As ByteConverter
    msg=BytesToString(buffer,0,buffer.Length,"UTF-8")
    Log ("received data is: " & msg)
    'msg=bcon.StringToBytes(msg,"UTF-8")
    Dim buffer() As Byte
        buffer = msg.GetBytes("UTF-8")
        'play the received audio data
        audioStream.Write(buffer)
    End If
End Sub
I'm just trying to go FROM stream TO string, and then back TO stream to test the theory
As it stands now, I get nothing but static.

Any suggestions?
 

Bpick

Member
Licensed User
Longtime User
I'm sorry I haven't responded sooner - work comittments have kept me from working on this program.

Does that mean that streams cannot be manipulated, encrypted, or generally worked with?
 
Upvote 0
Top