In the uncompressed situation I know I need to read the wav header, pull out the number of channels, bits, and sample rate and work it out from there: (channels) * (bits) * (samples/s) * (seconds) = (filesize)
Is there a simpler way – a free library, or something in the .net framework perhaps?
How would I do this if the .wav file is compressed (with the mpeg codec for example)?
You may consider using the mciSendString(…) function (error checking is omitted for clarity):