1.0.0 • Published 8 months ago
@yume-chan/pcm-player v1.0.0
@yume-chan/pcm-player
Play raw audio sample stream using Web Audio API.
Features
- Arbitrary channel count
- Arbitrary sample rate
- Basic OLA (overlap-add) resampler
- Adjustable buffer size
Usage
Depends on the sample format, there are multiple player classes:
Int16PcmPlayer
(little endian)Float32PcmPlayer
Float32PlanerPcmPlayer
No Planer
: audio samples are interleaved (left channel first).
With Planer
: audio samples are in a two-dimensional array (left channel first).
The constructors require user activation (must be invoked in a user event handler, e.g. onclick
), because they create AudioContext
s.
var player = Int16PcmPlayer(44100);
player.start();
player.feed(new Int16Array([0, 0, 0, 0, 0, 0, 0, 0]));
player.stop(); // `AudioContext` will be closed, so can't be restarted
1.0.0
8 months ago
0.0.0-next-20241130050937
8 months ago
0.0.0-next-20241129144018
8 months ago
0.0.0-next-20240917062356
10 months ago
0.0.24
1 year ago
0.0.0-20240714132542
1 year ago
0.0.23
1 year ago
0.0.22
2 years ago
0.0.21
2 years ago
0.0.20
2 years ago