How to get the total time of the wav file.
-
Hi all How to get the total time of a wav file. Please help me
-
Hi all How to get the total time of a wav file. Please help me
Perhaps looking through the WAV format[^] would be of help, or maybe a quick search[^].
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Perhaps looking through the WAV format[^] would be of help, or maybe a quick search[^].
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Thanks for the reply If i am having the forumala Sampling rate * Bits Per Sample * Channels)/(Bits Per Byte) = Bytes Per Second. eg If we are playing audio at 44,100Hz and we have 16 bit audio and 2 channels, Collapse (44100 * 16 * 2)/8 = 176400 Bytes Per Second Is there is any use. I can read the file size also from the header. But what i actually need is the total time of the wav file.From header data, Is there is any method for calculating this or Is there is any MFC classes for handling multimedia so that i can use any functions for getting the time period.
-
Thanks for the reply If i am having the forumala Sampling rate * Bits Per Sample * Channels)/(Bits Per Byte) = Bytes Per Second. eg If we are playing audio at 44,100Hz and we have 16 bit audio and 2 channels, Collapse (44100 * 16 * 2)/8 = 176400 Bytes Per Second Is there is any use. I can read the file size also from the header. But what i actually need is the total time of the wav file.From header data, Is there is any method for calculating this or Is there is any MFC classes for handling multimedia so that i can use any functions for getting the time period.
Deepu Antony wrote:
Is there is any use.
:confused: I believe the formula is: FileSize / (SampleRate * BytesPerSample)
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Deepu Antony wrote:
Is there is any use.
:confused: I believe the formula is: FileSize / (SampleRate * BytesPerSample)
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
That information i got from code project article [^]
-
Deepu Antony wrote:
Is there is any use.
:confused: I believe the formula is: FileSize / (SampleRate * BytesPerSample)
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Thanks for giving your time.It was very easy. The only thing has to do is to get the length of file name and divide it by bytes per second. int length =file.GetLength()-44;//Header size int dwTotSeconds =length/16000; //16000 bytes per second.