Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
GetSampleDuration Method

SoundEffect.GetSampleDuration Method

Returns the sample duration based on the specified sample size and sample rate.

Namespace: Microsoft.Xna.Framework.Audio
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

public static TimeSpan GetSampleDuration (
         int sizeInBytes,
         int sampleRate,
         AudioChannels channels


Type: Int32
Size, in bytes, of audio data.
Type: Int32
Sample rate, in Hertz (Hz), of audio content. The sampleRate must be between 8000 Hz and 48000 Hz.
Type: AudioChannels
Number of channels in the audio data.

Return Value

TimeSpan object that represents the calculated sample duration.

Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone

Community Additions

© 2015 Microsoft