Data received from audio

Asked

Viewed 64 times

0

How to know how much data (Kbs or Mbs) from the audio tag was received? For example, the user enters the site, and click play, the audio starts playing. Let’s say his Internet is really bad, and the music stops all the time. How to know not necessarily the percentage, but the value of the amount of data received only by the tag <audio>, besides knowing the full file size?

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 known wav, in addition you will 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 made, with this information you will be able to accurately calculate the size of your audio in any second/Mili-second, to know the total file size, look at the following answer here

In other words, by 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 was received ie if the file touched a second will be the value of this calculation, now add this to accumulate every second played.

If you got the total 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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.