startPlayerFromMic().

The τ Player API


startPlayerFromMic()

Starts the Microphone and plays what is recorded.

The Speaker is directely linked to the Microphone. There is no processing between the Microphone and the Speaker.

startPlayerFromMic() has two optional parameters :

  • sampleRate: the Sample Rate used. Optional. Only used on Android. The default value is probably a good choice and the App can ommit this optional parameter.
  • numChannels: 1 for monophony, 2 for stereophony. Optional. Actually only monophony is implemented.

startPlayerFromMic() returns a Future, which is completed when the Player is really started.

This new example can be compared to the old loop example.

1. iOS

startPlayerFromMic() directely links the microphone to the headset inside the OS itself, without any processing by τ

The improvement is really good. The delay between what is recorded and what is played is much better.

2. Android

The link beetween the microphone and the headset is done inside τ-core. The messaging channels between Java and Dart is not involved. The audio data are just transfered from the recording-thread to the player thread.

This is a great disappointment : the performances are marginally improved. This means that implementing data transfert from/to Dart with FFI will not benefit from using FFI.

Example:

     await myPlayer.startPlayerFromMic();
     ...
     myPlayer.stopPlayer();
        Lorem ipsum ...

Tags: api player