Google Cloud Speech v1 API - Class RecognitionAudio (3.4.0)

public sealed class RecognitionAudio : IMessage<RecognitionAudio>, IEquatable<RecognitionAudio>, IDeepCloneable<RecognitionAudio>, IBufferMessage, IMessage

Reference documentation and code samples for the Google Cloud Speech v1 API class RecognitionAudio.

Contains audio data in the encoding specified in the RecognitionConfig. Either content or uri must be supplied. Supplying both or neither returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See content limits.

Inheritance

object > RecognitionAudio

Namespace

GoogleCloudGoogle.Cloud.SpeechV1

Assembly

Google.Cloud.Speech.V1.dll

Constructors

RecognitionAudio()

public RecognitionAudio()

RecognitionAudio(RecognitionAudio)

public RecognitionAudio(RecognitionAudio other)
Parameter
NameDescription
otherRecognitionAudio

Properties

AudioSourceCase

public RecognitionAudio.AudioSourceOneofCase AudioSourceCase { get; }
Property Value
TypeDescription
RecognitionAudioAudioSourceOneofCase

Content

public ByteString Content { get; set; }

The audio data bytes encoded as specified in RecognitionConfig. Note: as with all bytes fields, proto buffers use a pure binary representation, whereas JSON representations use base64.

Property Value
TypeDescription
ByteString

Uri

public string Uri { get; set; }

URI that points to a file that contains audio data bytes as specified in RecognitionConfig. The file must not be compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: gs://bucket_name/object_name (other URI formats return [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see Request URIs.

Property Value
TypeDescription
string

Methods

FetchFromUri(string, HttpClient)

public static RecognitionAudio FetchFromUri(string uri, HttpClient httpClient = null)

Constructs a RecognitionAudio by downloading data from the given URI.

Parameters
NameDescription
uristring

The URI to fetch. Must not be null.

httpClientHttpClient

The HttpClient to use to fetch the image, or null to use a default client.

Returns
TypeDescription
RecognitionAudio

The newly created RecognitionAudio.

FetchFromUri(Uri, HttpClient)

public static RecognitionAudio FetchFromUri(Uri uri, HttpClient httpClient = null)

Constructs a RecognitionAudio by downloading data from the given URI.

Parameters
NameDescription
uriUri

The URI to fetch. Must not be null.

httpClientHttpClient

The HttpClient to use to fetch the image, or null to use a default client.

Returns
TypeDescription
RecognitionAudio

The newly created RecognitionAudio.

FetchFromUriAsync(string, HttpClient)

public static Task<RecognitionAudio> FetchFromUriAsync(string uri, HttpClient httpClient = null)

Asynchronously constructs a RecognitionAudio by downloading data from the given URI.

Parameters
NameDescription
uristring

The URI to fetch. Must not be null.

httpClientHttpClient

The HttpClient to use to fetch the image, or null to use a default client.

Returns
TypeDescription
TaskRecognitionAudio

A task representing the asynchronous operation. The result will be the newly created RecognitionAudio.

FetchFromUriAsync(Uri, HttpClient)

public static Task<RecognitionAudio> FetchFromUriAsync(Uri uri, HttpClient httpClient = null)

Asynchronously constructs a RecognitionAudio by downloading data from the given URI.

Parameters
NameDescription
uriUri

The URI to fetch. Must not be null.

httpClientHttpClient

The HttpClient to use to fetch the image, or null to use a default client.

Returns
TypeDescription
TaskRecognitionAudio

A task representing the asynchronous operation. The result will be the newly created RecognitionAudio.

FromBytes(byte[])

public static RecognitionAudio FromBytes(byte[] bytes)

Constructs a RecognitionAudio from the given byte array.

Parameter
NameDescription
bytesbyte

The bytes representing the raw RecognitionAudio data.

Returns
TypeDescription
RecognitionAudio

The newly created RecognitionAudio.

Remarks

This method copies the data from the byte array; modifications to bytes after this method returns will not be reflected in the RecognitionAudio.

FromBytes(byte[], int, int)

public static RecognitionAudio FromBytes(byte[] bytes, int offset, int count)

Constructs a RecognitionAudio from a section of the given byte array.

Parameters
NameDescription
bytesbyte

The bytes representing the raw RecognitionAudio data.

offsetint

The offset into the byte array of the start of the data to include in the RecognitionAudio.

countint

The number of bytes to include in the RecognitionAudio.

Returns
TypeDescription
RecognitionAudio

The newly created RecognitionAudio.

Remarks

This method copies the data from the byte array; modifications to bytes after this method returns will not be reflected in the RecognitionAudio.

FromFile(string)

public static RecognitionAudio FromFile(string path)

Constructs a RecognitionAudio by loading data from the given file path.

Parameter
NameDescription
pathstring

The file path to load RecognitionAudio data from. Must not be null.

Returns
TypeDescription
RecognitionAudio

The newly created RecognitionAudio.

FromFileAsync(string)

public static Task<RecognitionAudio> FromFileAsync(string path)

Asynchronously constructs a RecognitionAudio by loading data from the given file path.

Parameter
NameDescription
pathstring

The file path to load RecognitionAudio data from. Must not be null.

Returns
TypeDescription
TaskRecognitionAudio

The newly created RecognitionAudio.

FromStorageUri(string)

public static RecognitionAudio FromStorageUri(string storageUri)

Constructs a RecognitionAudio with a Uri property referring to a Google Cloud Storage URI.

Parameter
NameDescription
storageUristring

A Google Cloud Storage URI, of the form gs://bucket-name/object-name. Must not be null.

Returns
TypeDescription
RecognitionAudio

The newly created RecognitionAudio.

FromStream(Stream)

public static RecognitionAudio FromStream(Stream stream)

Constructs a RecognitionAudio by loading data from the given stream.

Parameter
NameDescription
streamStream

The stream to load RecognitionAudio data from. Must not be null.

Returns
TypeDescription
RecognitionAudio

The newly created RecognitionAudio.

FromStreamAsync(Stream)

public static Task<RecognitionAudio> FromStreamAsync(Stream stream)

Asynchronously constructs a RecognitionAudio by loading data from the given stream.

Parameter
NameDescription
streamStream

The stream to load RecognitionAudio data from. Must not be null.

Returns
TypeDescription
TaskRecognitionAudio

The newly created RecognitionAudio.