DOA/VAD together with STT at the same time

I have purchased a Respeaker 4-Mic Array and have used some code that I have found to get 2 types of functionality working.

  1. Speech-to-text using Google Cloud Platform.
  2. Detecting direction of speech using DOA/VAD

I found 2 separate code fragments to do the 2 functions above. The setup of ‘Chunks’ and other options are different for each code fragment.

I would like to combine these into 1 function which can do both things at the same time but not sure how to initialise the stream, parameters required, etc.

Would anyone be able to help me ? Some example code would be awesome.