Slide 10
Slide 10 text
・05.順に解説
ローカルPC
Python3.6
PCのマイク
google.cloud
.speech
PyAudio
audio_stream
発⾳レスポンスあれば
取込んだ⾳声Buff
Cloud Speech-to-Text API
GoogleCloudPlatform
⾳声Buff
Text
Google Sheets API
事前にSpredSheet⽤意(共有(Doc_idで)
Textを
Cellに追加
gspread
Text
Text
■google.cloud.speech
⾳声情報をCloud Speech-to-Text APIに渡し、Textを受け取る
→⾳声ストリーム情報(⾳声,レート,モノラル,…)でAPIコール、
変換されたテキスト受け取り
例)
from google.cloud import speech_v1 as speech
client = speech.SpeechClient()
config = types.RecognitionConfig(
encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=self.rate,
model=None,
speech_contexts=[types.SpeechContext(
)],
language_code=language_code)
streaming_config = types.StreamingRecognitionConfig(
config=config,
single_utterance=True,
interim_results=True
)
audio_generator = stream.generator()
requests = (types.StreamingRecognizeRequest(audio_content=content)
for content in audio_generator)
responses = client.streaming_recognize(streaming_config, requests)
GCP上のサンプルソース参照
してください。