AdamInTheOculus
AdamInTheOculus

Reputation: 370

How to get sample rate, bit depth, and number of channels with Web Audio API?

I am wondering how I can get the following audio metadata after uploading a file and embedding within <audio> tag.

Is this possible with Web Audio API? Or do I need to parse the binary data of each audio file?

Upvotes: 3

Views: 1211

Answers (2)

c1moore
c1moore

Reputation: 1867

Have you checked out music-metadata? It appears to support parsing all of the metadata mentioned above and supports quite a few formats.

Upvotes: 0

anthumchris
anthumchris

Reputation: 9072

After researching this, I could not find a currently-available API for obtaining the metadata without manually parsing the binary file headers. I opened Git issue WebCodecs #411 with the WebCodecs team. WebCodecs is a new API that could potentially offer this metadata viewing feature.

Upvotes: 3

Related Questions