AudioEncodingProperties AudioEncodingProperties AudioEncodingProperties AudioEncodingProperties Class

Definition

Describes the format of an audio stream.

public : sealed class AudioEncodingProperties : IAudioEncodingProperties, IAudioEncodingProperties2, IAudioEncodingPropertiesWithFormatUserData, IMediaEncodingPropertiespublic sealed class AudioEncodingProperties : IAudioEncodingProperties, IAudioEncodingProperties2, IAudioEncodingPropertiesWithFormatUserData, IMediaEncodingPropertiesPublic NotInheritable Class AudioEncodingProperties Implements IAudioEncodingProperties, IAudioEncodingProperties2, IAudioEncodingPropertiesWithFormatUserData, IMediaEncodingProperties// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The encoding quality Auto is a special preset that fills in the proper settings based on the current camera settings. Settings that are manually modified are ignored. For example, if you create a preset profile using one the static create methods, such as CreateWav, and specify Auto as the encoding quality, any changes you make to the properties will be overwritten with values based on the current camera settings.

Note

It is possible to create an AudioEncodingProperties that is not supported on a particular device. For example, you may successfully call CreateMp3, but if an mp3 encoder is not present on the device, attempting to encode audio with the properties returned from this method will fail. For a list of the codecs present by default for each device family, see Supported codecs..

For how-to guidance for setting the encoding properties for captured audio, see Basic photo, video, and audio capture with MediaCapture.

Constructors

AudioEncodingProperties() AudioEncodingProperties() AudioEncodingProperties() AudioEncodingProperties()

Creates a new instance of the AudioEncodingProperties class.

public : AudioEncodingProperties()public AudioEncodingProperties()Public Sub New()// You can use this method in JavaScript.

Properties

Bitrate Bitrate Bitrate Bitrate

Gets or sets the audio bit rate.

public : unsigned int Bitrate { get; set; }public uint Bitrate { get; set; }Public ReadWrite Property Bitrate As uint// You can use this property in JavaScript.
Value
unsigned int uint uint uint

The average bit rate of the audio stream, in bits per second.

BitsPerSample BitsPerSample BitsPerSample BitsPerSample

Gets or sets the number of bits per audio sample.

public : unsigned int BitsPerSample { get; set; }public uint BitsPerSample { get; set; }Public ReadWrite Property BitsPerSample As uint// You can use this property in JavaScript.
Value
unsigned int uint uint uint

The number of bits per audio sample.

ChannelCount ChannelCount ChannelCount ChannelCount

Gets or sets the number of audio channels.

public : unsigned int ChannelCount { get; set; }public uint ChannelCount { get; set; }Public ReadWrite Property ChannelCount As uint// You can use this property in JavaScript.
Value
unsigned int uint uint uint

The number of audio channels.

IsSpatial IsSpatial IsSpatial IsSpatial

Gets a value indicating whether the audio is encoded with spatial audio information.

public : PlatForm::Boolean IsSpatial { get; }public bool IsSpatial { get; }Public ReadOnly Property IsSpatial As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

True if the audio is encoded with spatial audio information; otherwise, false.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Properties Properties Properties Properties

Gets additional format properties for the audio stream.

public : MediaPropertySet Properties { get; }public MediaPropertySet Properties { get; }Public ReadOnly Property Properties As MediaPropertySet// You can use this property in JavaScript.
Value
MediaPropertySet MediaPropertySet MediaPropertySet MediaPropertySet

A property set that contains format properties.

Remarks

For information on working with a property set collection, see PropertySet.

SampleRate SampleRate SampleRate SampleRate

Gets or sets audio sampling rate.

public : unsigned int SampleRate { get; set; }public uint SampleRate { get; set; }Public ReadWrite Property SampleRate As uint// You can use this property in JavaScript.
Value
unsigned int uint uint uint

The number of audio samples per second.

Subtype Subtype Subtype Subtype

Gets or sets the subtype of the format.

public : PlatForm::String Subtype { get; set; }public string Subtype { get; set; }Public ReadWrite Property Subtype As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The subtype.

Remarks

The value can be the string representation of a GUID in canonical form, or one of the predefined values listed in the following table.

ValueDescription
"AAC"Advanced Audio Coding (AAC). The stream can contain either raw AAC data or AAC data in an Audio Data Transport Stream (ADTS) stream.
"AC3"Dolby Digital audio (AC-3).
"AACADTS"Advanced Audio Coding (AAC) audio in Audio Data Transport Stream (ADTS) format.
"AACHDCP"AAC in High-Bandwidth Digital Content Protection (HDCP) format.
"AC3"Dolby AC3
"AC3SPDIF"Dolby AC-3 audio over Sony/Philips Digital Interface (S/PDIF).
"AC3HDCP"Dolby AC-3 in High-Bandwidth Digital Content Protection (HDCP) format.
"ADTS"Audio Data Transport Stream
"ALAC"Apple Lossless Audio Codec
"AMRNB"Adaptive Multi-Rate audio codec (AMR-NB)
"AWRWB"Adaptive Multi-Rate Wideband audio codec (AMR-WB)
"DTS"Digital Theater Systems (DTS)
"EAC3"Dolby Digital Plus audio (E-AC-3).
"FLAC"Free Lossless Audio Codec
"Float"Uncompressed 32-bit float PCM audio.
"MP3"MPEG Audio Layer-3 (MP3).
"MPEG"MPEG-1 audio payload.
"OPUS"Opus
"PCM"Uncompressed 16-bit PCM audio.
"WMA8"Windows Media Audio 8 codec, Windows Media Audio 9 codec, or Windows Media Audio 9.1 codec.
"WMA9"Windows Media Audio 9 Professional codec or Windows Media Audio 9.1 Professional codec.
"Vorbis"Vorbis codec

Warning

The string values returned by the MediaEncodingSubtypes properties may not use the same letter casing as AudioEncodingProperties.Subtype, VideoEncodingProperties.Subtype, ContainerEncodingProperties.Subtype, and ImageEncodingProperties.Subtype. For this reason, if you compare the values, you should use a case-insensitive comparison or use hardcoded strings that match the casing returned by the encoding properties.

Type Type Type Type

Gets the format type.

public : PlatForm::String Type { get; }public string Type { get; }Public ReadOnly Property Type As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The format type. For audio streams, the format type is "Audio".

Methods

CreateAac(UInt32, UInt32, UInt32) CreateAac(UInt32, UInt32, UInt32) CreateAac(UInt32, UInt32, UInt32) CreateAac(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Advanced Audio Coding (AAC) audio.

public : static AudioEncodingProperties CreateAac(unsigned int sampleRate, unsigned int channelCount, unsigned int bitrate)public static AudioEncodingProperties CreateAac(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)Public Static Function CreateAac(sampleRate As UInt32, channelCount As UInt32, bitrate As UInt32) As AudioEncodingProperties// You can use this method in JavaScript.
Parameters
sampleRate
unsigned int UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
unsigned int UInt32 UInt32 UInt32

The number of audio channels.

bitrate
unsigned int UInt32 UInt32 UInt32

The audio bit rate.

Returns

CreateAacAdts(UInt32, UInt32, UInt32) CreateAacAdts(UInt32, UInt32, UInt32) CreateAacAdts(UInt32, UInt32, UInt32) CreateAacAdts(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Advanced Audio Coding (AAC) audio in Audio Data Transport Stream (ADTS) format.

public : static AudioEncodingProperties CreateAacAdts(unsigned int sampleRate, unsigned int channelCount, unsigned int bitrate)public static AudioEncodingProperties CreateAacAdts(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)Public Static Function CreateAacAdts(sampleRate As UInt32, channelCount As UInt32, bitrate As UInt32) As AudioEncodingProperties// You can use this method in JavaScript.
Parameters
sampleRate
unsigned int UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
unsigned int UInt32 UInt32 UInt32

The number of audio channels.

bitrate
unsigned int UInt32 UInt32 UInt32

The audio bit rate.

Returns

CreateAlac(UInt32, UInt32, UInt32) CreateAlac(UInt32, UInt32, UInt32) CreateAlac(UInt32, UInt32, UInt32) CreateAlac(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Apple Lossless Audio Codec (ALAC) audio.

public : static AudioEncodingProperties CreateAlac(unsigned int sampleRate, unsigned int channelCount, unsigned int bitsPerSample)public static AudioEncodingProperties CreateAlac(UInt32 sampleRate, UInt32 channelCount, UInt32 bitsPerSample)Public Static Function CreateAlac(sampleRate As UInt32, channelCount As UInt32, bitsPerSample As UInt32) As AudioEncodingProperties// You can use this method in JavaScript.
Parameters
sampleRate
unsigned int UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
unsigned int UInt32 UInt32 UInt32

The number of audio channels.

bitsPerSample
unsigned int UInt32 UInt32 UInt32

The number of bits per sample.

Returns
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

CreateFlac(UInt32, UInt32, UInt32) CreateFlac(UInt32, UInt32, UInt32) CreateFlac(UInt32, UInt32, UInt32) CreateFlac(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Free Lossless Audio Codec (FLAC) audio.

public : static AudioEncodingProperties CreateFlac(unsigned int sampleRate, unsigned int channelCount, unsigned int bitsPerSample)public static AudioEncodingProperties CreateFlac(UInt32 sampleRate, UInt32 channelCount, UInt32 bitsPerSample)Public Static Function CreateFlac(sampleRate As UInt32, channelCount As UInt32, bitsPerSample As UInt32) As AudioEncodingProperties// You can use this method in JavaScript.
Parameters
sampleRate
unsigned int UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
unsigned int UInt32 UInt32 UInt32

The number of audio channels.

bitsPerSample
unsigned int UInt32 UInt32 UInt32

The number of bits per sample.

Returns
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

CreateMp3(UInt32, UInt32, UInt32) CreateMp3(UInt32, UInt32, UInt32) CreateMp3(UInt32, UInt32, UInt32) CreateMp3(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for MPEG Audio Layer-3 (MP3) audio.

public : static AudioEncodingProperties CreateMp3(unsigned int sampleRate, unsigned int channelCount, unsigned int bitrate)public static AudioEncodingProperties CreateMp3(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)Public Static Function CreateMp3(sampleRate As UInt32, channelCount As UInt32, bitrate As UInt32) As AudioEncodingProperties// You can use this method in JavaScript.
Parameters
sampleRate
unsigned int UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
unsigned int UInt32 UInt32 UInt32

The number of audio channels.

bitrate
unsigned int UInt32 UInt32 UInt32

The audio bit rate.

Returns

CreatePcm(UInt32, UInt32, UInt32) CreatePcm(UInt32, UInt32, UInt32) CreatePcm(UInt32, UInt32, UInt32) CreatePcm(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Pulse Code Modulation (PCM) audio.

public : static AudioEncodingProperties CreatePcm(unsigned int sampleRate, unsigned int channelCount, unsigned int bitsPerSample)public static AudioEncodingProperties CreatePcm(UInt32 sampleRate, UInt32 channelCount, UInt32 bitsPerSample)Public Static Function CreatePcm(sampleRate As UInt32, channelCount As UInt32, bitsPerSample As UInt32) As AudioEncodingProperties// You can use this method in JavaScript.
Parameters
sampleRate
unsigned int UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
unsigned int UInt32 UInt32 UInt32

The number of audio channels.

bitsPerSample
unsigned int UInt32 UInt32 UInt32

The audio bit depth.

Returns

CreateWma(UInt32, UInt32, UInt32) CreateWma(UInt32, UInt32, UInt32) CreateWma(UInt32, UInt32, UInt32) CreateWma(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Windows Media Audio (WMA).

public : static AudioEncodingProperties CreateWma(unsigned int sampleRate, unsigned int channelCount, unsigned int bitrate)public static AudioEncodingProperties CreateWma(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)Public Static Function CreateWma(sampleRate As UInt32, channelCount As UInt32, bitrate As UInt32) As AudioEncodingProperties// You can use this method in JavaScript.
Parameters
sampleRate
unsigned int UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
unsigned int UInt32 UInt32 UInt32

The number of audio channels.

bitrate
unsigned int UInt32 UInt32 UInt32

The audio bit rate.

Returns

GetFormatUserData(Byte[]) GetFormatUserData(Byte[]) GetFormatUserData(Byte[]) GetFormatUserData(Byte[])

Gets the media format user data.

public : void GetFormatUserData(Byte[] value)public void GetFormatUserData(Byte[] value)Public Function GetFormatUserData(value As Byte[]) As void// You can use this method in JavaScript.
Parameters
value
Byte[] Byte[] Byte[] Byte[]

Receives the media format data.

SetFormatUserData(Byte[]) SetFormatUserData(Byte[]) SetFormatUserData(Byte[]) SetFormatUserData(Byte[])

Sets the media format user data.

public : void SetFormatUserData(Byte[] value)public void SetFormatUserData(Byte[] value)Public Function SetFormatUserData(value As Byte[]) As void// You can use this method in JavaScript.
Parameters
value
Byte[] Byte[] Byte[] Byte[]

The media data to set.

See Also