Speech-to-Text は、Google の AI テクノロジーを活用した API です。音声データを Speech-to-Text に送信すると、音声が文字に変換されて返されます。
Speech-to-Text リクエストの作成方法について詳しくは、リクエスト ページをご覧ください。
概要
Speech-to-Text にリクエストを送信するには、Google Cloud Console で API を有効にする必要があります。このページの手順では、以下の手順について説明します。
- プロジェクトで Speech-to-Text を有効にする。
- Speech-to-Text の課金が有効になっていることを確認する。
- (省略可)音声データを保存する新しい Google Cloud Storage バケットを作成する。
始める前に
このサービスにアクセスするには、REST API を使用する方法と Speech-to-Text コンソールを使用する方法があります。REST API にリクエストを送信してレスポンスを受信するコードサンプルが用意されています。これらのサンプルの使用方法については、Speech-to-Text のクイックスタートと入門ガイドで学習できます。また、Cloud Speech-to-Text コンソール を使用すると、最小限のコーディングで Speech-to-Text を使用できます。
このガイドでは、REST API にリクエストの送信するために必要な手順について説明します。コーディングを初めて行う場合は、このクイックスタートを開始する前に、Google Cloud Platform のコンソール内チュートリアルから始めることをおすすめします。
Speech-to-Text 用に Google Cloud プロジェクトを設定する
-
既存のプロジェクトを選択するか、新しいプロジェクトを作成します。プロジェクトの作成について詳しくは、プロジェクトの作成と管理をご覧ください。
新しいプロジェクトを作成する場合、このプロジェクトに請求先アカウントを関連付けるように求められます。既存のプロジェクトを使用する場合は、そのプロジェクトで課金が有効になっていることを確認します。
プロジェクトを選択して請求先アカウントを関連付けると、Speech-to-Text API を有効にできます。ページの上部にある [プロダクトとリソースを検索] バーに「speech」と入力します。結果のリストから Cloud Speech-to-Text API を選択します。
プロジェクトに関連付けずに Speech-to-Text を試すには、[この API を試す] オプションを選択します。プロジェクトで Speech-to-Text API を有効にするには、[有効にする] をクリックします。
(省略可)データロギングを有効にします。データロギングを有効にすると、Speech-to-Text に送信された音声データの記録を Google に許可したことになります。記録したデータは、Speech-to-Text モデルを改善するために使用されます。データロギングを有効にした場合の料金は割安に設定されています。詳しくは、料金ページとデータロギングの利用規約をご覧ください。
省略可: Cloud Storage バケットを作成する
60 秒を超える音声または 10 MB を超えるファイルの音声を文字変換するには、Speech-to-Text で文字変換を行う前に音声を Cloud Storage バケットに保存する必要があります。以下では、新しいバケットを作成する手順について説明します。
- 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 (Data encryption method. ), and select a
- Select any of the options under Data protection that you
want to set for your bucket.
Speech-to-Text API を無効にする
Speech-to-Text API が不要になった場合は、次の手順を行います。
- Google Cloud ダッシュボードに移動し、[API] ボックスの [API の概要に移動] リンクをクリックします。
- [Cloud Speech-to-Text API] を選択します。
- Cloud Speech-to-Text API ページの上部にある [API を無効にする] ボタンをクリックします。
次のステップ
クライアント ライブラリ、gcloud、コマンドライン、または Speech-to-Text の UI を使用して、Speech-to-Text API に音声文字変換リクエストを送信する方法を学習する。