Liam Haworth
Liam Haworth

Reputation: 858

How is audio stored in Java

This is a quick question, how is audio stored when it's in a byte array, like when a image is stored in a byte array there is three(Red, green, blue) bytes per pixel. So how is a audio stored in a byte array?

Thanks, Liam.

Upvotes: 2

Views: 196

Answers (2)

Sahan De Silva
Sahan De Silva

Reputation: 471

It's a combination of signals (analog / digital) having a unique frequency for each and every tone. And as it's said in the previous answer, yes, Pulse Code Modulation (PCM) is supported in java.

Upvotes: 2

mikera
mikera

Reputation: 106351

There are various possible encodings that are supported in Java. See:

The most simple form is PCM coding, in which each sample is a linear number that represents the sound waveform (which could be 1 byte for 8-bit encoding).

You also have to consider the number of channels (1 for mono, 2 for stereo). So 16-bit PCM-encoded stereo sound will require 4 bytes per sample, for example.

Upvotes: 2

Related Questions