Data received from audio

0

How do I know how much data (KBs or MBs) of the audio tag was received? For example, the user enters the site, and clicks play, the audio begins to play. Let's assume that his internet is very bad and the music stops all the time. How to know not necessarily the percentage, but rather the value of the amount of data received only by the <audio> tag, in addition to knowing the full size of the file?

    
asked by anonymous 08.06.2015 / 00:16

1 answer

0

Good to do this you will need to know some attributes about the audio to be transmitted, as if the audio is mp3 (there is compression) or sera PCM (no compression), files of this type are the known wav, You need to know if the transmission will be in mono or stereo beyond the frame rate and at what bit rate the audio transmission is being done, with this information you can accurately calculate the size of your audio in any second / millisecond, to know the total size of the file, look at the following answer #

In other words, when calculating how many seconds / minutes your file has, you can calculate its total size as well.

For mp3 in mono the general formula is as follows:

Taxa de bits do seu audio / 8 

This will be equal to how many bytes per second it was received, ie if the file touched a second will be the value of this calculation, now add that to accumulate with each second played.

If you have achieved the full size of your file in seconds then to know the total size in bytes follow the general formula again.

Taxa de bits do seu audio / 8 × X segundos do seu áudio

Remember that if it is stereo transmission then two channels are used and in these cases make the result times 2.

    
08.06.2015 / 06:43