Hi to all,
I've spent hours and hours to find a post talking about this without results:BangHead:.
In my app I need sometimes to record the user voice, to save the message somewhere in the device and then in a second moment to play this message.
Now I can save a wav file with Audioecorder and I can play it with Mediaplayer...BUT my app use a sql DB so I'd like to store the messages in it keeping all the data in the same place.
The 1st step I did was to create a temporary wav file and load it as blob in my DB (no way to record sounds as byte on the fly right?).
Now I want to play the data saved in the blob column of my DB, I think I must use a temporary file again, but how do I create a wav file from a DB?
I've found this example:
but I don't know how to create a wav file after InputStream1.InitializeFromBytesArray instruction.
I stopped one meter before the arrival, please help me to finish my race!:sign0085:
Thanks
I've spent hours and hours to find a post talking about this without results:BangHead:.
In my app I need sometimes to record the user voice, to save the message somewhere in the device and then in a second moment to play this message.
Now I can save a wav file with Audioecorder and I can play it with Mediaplayer...BUT my app use a sql DB so I'd like to store the messages in it keeping all the data in the same place.
The 1st step I did was to create a temporary wav file and load it as blob in my DB (no way to record sounds as byte on the fly right?).
Now I want to play the data saved in the blob column of my DB, I think I must use a temporary file again, but how do I create a wav file from a DB?
I've found this example:
B4X:
Sub ReadBlob
Dim Cursor1 As Cursor
'Using ExecQuery2 is safer as it escapes special characters automatically.
'In this case it doesn't really matter.
Cursor1 = SQL1.ExecQuery2("SELECT image FROM table2 WHERE name = ?", Array As String("smiley"))
Cursor1.Position = 0
Dim Buffer() As Byte 'declare an empty byte array
Buffer = Cursor1.GetBlob("image")
Dim InputStream1 As InputStream
InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
Dim Bitmap1 As Bitmap
Bitmap1.Initialize2(InputStream1)
InputStream1.Close
Activity.SetBackgroundImage(Bitmap1)
End Sub
but I don't know how to create a wav file after InputStream1.InitializeFromBytesArray instruction.
I stopped one meter before the arrival, please help me to finish my race!:sign0085:
Thanks