DeeptoneStream

class DeeptoneStream

DeeptoneStream predicts audio data every second, the user might provide audio data as FloatArray by calling the DeeptoneStream.write method of the instance, every time there's data available onData callback will be called providing the user with predictions over time.

When the user is done writing data DeeptoneStream.close method must be called to terminate the stream, this method will trigger onSuccess callback with all previous predictions.

Since predictions are generated every second DeeptoneStream has a queue mechanism that stores incoming data into memory and when all this data is consumed by DeeptoneStream it automatically calls onSuccess.

Functions

close
Link copied to clipboard
fun close()
Closes current stream and clears related data
getMaxIndex
Link copied to clipboard
fun getMaxIndex(): Int
write
Link copied to clipboard
fun write(audioData: FloatArray)
Write audio data in FloatArray format to the stream.

Properties

canRead
Link copied to clipboard
var canRead: Boolean = false
onData
Link copied to clipboard
val onData: (DeeptoneOutput) -> Unit
onError
Link copied to clipboard
val onError: (Exception) -> Unit
onSuccess
Link copied to clipboard
val onSuccess: (DeeptoneOutput) -> Unit
streamBuffer
Link copied to clipboard
var streamBuffer: FloatArray
timerHandler
Link copied to clipboard
var timerHandler: Handler