Class RecognitionAudio (2.9.0)

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

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

Google.Cloud.Speech.V1

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
RecognitionAudio.AudioSourceOneofCase

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 async 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
Task<RecognitionAudio>

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

FetchFromUriAsync(Uri, HttpClient)

public static async 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
Task<RecognitionAudio>

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[], Int32, Int32)

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.

offsetInt32

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

countInt32

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
Task<RecognitionAudio>

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 async 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
Task<RecognitionAudio>

The newly created RecognitionAudio.