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.
Implements
IMessage<RecognitionAudio>, IEquatable<RecognitionAudio>, IDeepCloneable<RecognitionAudio>, IBufferMessage, IMessageNamespace
Google.Cloud.Speech.V1Assembly
Google.Cloud.Speech.V1.dll
Constructors
RecognitionAudio()
public RecognitionAudio()
RecognitionAudio(RecognitionAudio)
public RecognitionAudio(RecognitionAudio other)
Parameter | |
---|---|
Name | Description |
other | RecognitionAudio |
Properties
AudioSourceCase
public RecognitionAudio.AudioSourceOneofCase AudioSourceCase { get; }
Property Value | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
uri | String The URI to fetch. Must not be null. |
httpClient | HttpClient The HttpClient to use to fetch the image, or
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
uri | Uri The URI to fetch. Must not be null. |
httpClient | HttpClient The HttpClient to use to fetch the image, or
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
uri | String The URI to fetch. Must not be null. |
httpClient | HttpClient The HttpClient to use to fetch the image, or
|
Returns | |
---|---|
Type | Description |
Task<RecognitionAudio> | 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 | |
---|---|
Name | Description |
uri | Uri The URI to fetch. Must not be null. |
httpClient | HttpClient The HttpClient to use to fetch the image, or
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
bytes | Byte[] The bytes representing the raw RecognitionAudio data. |
Returns | |
---|---|
Type | Description |
RecognitionAudio | The newly created RecognitionAudio. |
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 | |
---|---|
Name | Description |
bytes | Byte[] The bytes representing the raw RecognitionAudio data. |
offset | Int32 The offset into the byte array of the start of the data to include in the RecognitionAudio. |
count | Int32 The number of bytes to include in the RecognitionAudio. |
Returns | |
---|---|
Type | Description |
RecognitionAudio | The newly created RecognitionAudio. |
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 | |
---|---|
Name | Description |
path | String The file path to load RecognitionAudio data from. Must not be null. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
path | String The file path to load RecognitionAudio data from. Must not be null. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
storageUri | String A Google Cloud Storage URI, of the form |
Returns | |
---|---|
Type | Description |
RecognitionAudio | The newly created RecognitionAudio. |
FromStream(Stream)
public static RecognitionAudio FromStream(Stream stream)
Constructs a RecognitionAudio by loading data from the given stream.
Parameter | |
---|---|
Name | Description |
stream | Stream The stream to load RecognitionAudio data from. Must not be null. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
stream | Stream The stream to load RecognitionAudio data from. Must not be null. |
Returns | |
---|---|
Type | Description |
Task<RecognitionAudio> | The newly created RecognitionAudio. |