ogallagher / terry

Terry the virtual secreTERRY
0 stars 0 forks source link

Enabling microphone input #2

Open ogallagher opened 4 years ago

ogallagher commented 4 years ago

The general goal here, regardless of the implementation, is to be able to turn on the built-in microphone, record audio, turn off the mic, and use that recording to create a transcription. The recording will have to be a wav file probably (both approaches explored for transcription in #1 use wav files).

With osx, this can be done using ffmpeg, by specifying the input stream, a duration, and an output file name. The format for osx and other apple devices is AVFoundation. See official documentation for more information.

With win a similar approach should be possible, just with a different video format and some other ffmpeg parameters.

ogallagher commented 4 years ago

I did not end up using ffmpeg for mac, but rather the native javax.sound.* classes. The code will still need to be expanded to support win, but at least this part of the implementation, being within java, makes it platform-independent.

This currently works if the user allows Terry to access the microphone initially, but is not able to ask for permission yet.