Cloud Speech-to-Text は、入力として音声データを受け取り、Google AI テクノロジーを使用して音声文字変換を行うことで、音声をテキストに変換する API です。このページでは、プロジェクトで Cloud Speech-to-Text API を設定して、API 呼び出しを開始する方法について説明します。
このドキュメントでは、以下について説明します。
- Google Cloud プロジェクトでの Cloud Speech-to-Text API の有効化と無効化
- Cloud Speech-to-Text の課金の有効化
- 省略可: 大容量の音声データを保存する新しい Google Cloud Storage バケットの作成
このドキュメントでは、Cloud Speech-to-Text API を使用してリクエストの送受信を開始する方法については説明しません。Cloud Speech-to-Text を実際のコードに統合する方法については、概要ページをご覧ください。
始める前に
このサービスにアクセスするには、REST API を使用する方法とGoogle Cloud コンソールを使用する方法があります。
このガイドでは、REST API にリクエストの送信を開始するために必要な手順について説明します。コーディングを初めて行う場合は、これらの手順を開始する前に、 Google Cloudプラットフォームのコンソール内チュートリアルから始めることをおすすめします。
Google Cloud プロジェクトで Cloud Speech-to-Text API を有効にする
Google Cloud コンソールにログインします。
プロジェクト セレクタのページを開き、既存のプロジェクトを選択するか、新しいプロジェクトを作成します。プロジェクトの作成について詳しくは、プロジェクトの作成と管理をご覧ください。
新しいプロジェクトを作成する場合、このプロジェクトに請求先アカウントを関連付けるように求められます。既存のプロジェクトを使用する場合は、そのプロジェクトで課金が有効になっていることを確認します。
Cloud Speech-to-Text API を有効にします。ページの上部にある [プロダクトとリソースの検索] テキスト フィールドをクリックし、「speech」と入力します。結果のリストから Cloud Speech-to-Text API を選択します。
プロジェクトで Cloud Speech-to-Text API を有効にするには、[有効にする] をクリックします。プロジェクトに関連付けずに Cloud Speech-to-Text を試すには、[この API を試す] をクリックします。
省略可:(API V1 のみ)データロギングを有効にします。データロギングを有効にすると、Cloud Speech-to-Text に送信された音声データの記録を Google に許可したことになります。記録したデータは、Cloud Speech-to-Text モデルを改善するために使用されます。データロギングを有効にした場合の料金は割安に設定されています。詳しくは、料金ページとデータロギングの利用規約をご覧ください。
省略可: Cloud Storage バケットを作成する
60 秒を超える音声または 10 MB を超えるファイルの音声を文字変換するには、Cloud Speech-to-Text で文字変換を行う前に音声を Cloud Storage バケットに保存する必要があります。
新しい Cloud Storage バケットを作成するには:
- In the Google Cloud console, go to the Cloud Storage Buckets page.
- Click Create.
- On the Create a bucket page, enter your bucket information. To go to the next
step, click Continue.
- For Name your bucket, enter a unique bucket name. Don't include sensitive information in the bucket name, because the bucket namespace is global and publicly visible.
-
In the Choose where to store your data section, do the following:
- Select a Location type.
- Choose a location where your bucket's data is permanently stored from the Location type drop-down menu.
- If you select the dual-region location type, you can also choose to enable turbo replication by using the relevant checkbox.
- To set up cross-bucket replication, select
Add cross-bucket replication via Storage Transfer Service and
follow these steps:
Set up cross-bucket replication
- In the Bucket menu, select a bucket.
In the Replication settings section, click Configure to configure settings for the replication job.
The Configure cross-bucket replication pane appears.
- To filter objects to replicate by object name prefix, enter a prefix that you want to include or exclude objects from, then click Add a prefix.
- To set a storage class for the replicated objects, select a storage class from the Storage class menu. If you skip this step, the replicated objects will use the destination bucket's storage class by default.
- Click Done.
-
In the Choose how to store your data section, do the following:
- Select a default storage class for the bucket or Autoclass for automatic storage class management of your bucket's data.
- To enable hierarchical namespace, in the Optimize storage for data-intensive workloads section, select Enable hierarchical namespace on this bucket.
- In the Choose how to control access to objects section, select whether or not your bucket enforces public access prevention, and select an access control method for your bucket's objects.
-
In the Choose how to protect object data section, do the
following:
- Select any of the options under Data protection that you
want to set for your bucket.
- To enable soft delete, click the Soft delete policy (For data recovery) checkbox, and specify the number of days you want to retain objects after deletion.
- To set Object Versioning, click the Object versioning (For version control) checkbox, and specify the maximum number of versions per object and the number of days after which the noncurrent versions expire.
- To enable the retention policy on objects and buckets, click the Retention (For compliance) checkbox, and then do the following:
- To enable Object Retention Lock, click the Enable object retention checkbox.
- To enable Bucket Lock, click the Set bucket retention policy checkbox, and choose a unit of time and a length of time for your retention period.
- To choose how your object data will be encrypted, expand the Data encryption section (), and select a Data encryption method.
- Select any of the options under Data protection that you
want to set for your bucket.
- Click Create.
- Google Cloud ダッシュボードに移動し、[API の概要に移動] をクリックします。
- [Cloud Speech-to-Text API] を選択します。
- [API を無効にする] をクリックします。
Cloud Speech-to-Text API を無効にする
プロジェクトで Cloud Speech-to-Text API を使用する必要がなくなった場合:
次のステップ
クライアント ライブラリ、gcloud、コマンドライン、または Speech-to-Text の UI を使用して、Cloud Speech-to-Text API に音声文字変換リクエストを送信する方法を学習する。