2.3.0 • Published 1 year ago

audio-lena v2.3.0

Weekly downloads
21
License
MIT
Repository
github
Last release
1 year ago

audio-lena stable Build Status

The Lena test audio. Returns ArrayBuffer with mp3 or wav of the record.

Appropriate for testing size (1Mb), length (~12s), noisy background, visible spectral peaks with harmonics, pitch variation, mono (not default number of channels). Good for sound recovery, sfx, filtering, decoding, encoding etc.

ParameterValue
samplesCount541184
duration12.27s
numberOfChannels1
sampleRate44100
wav size1.03 Mb
mp3 size192.8 Kb
bitRate705kbps
artistLena Stolze
track titleOh lad le
album titleDas schreckliche Mädchen
year2014

Usage

npm install audio-lena

// MP3 arrayBuffer
const lenaBuffer = require('audio-lena/mp3');
const context = require('audio-context')();

context.decodeAudioData(lenaBuffer, (buffer) => {
	source = context.createBufferSource();
	source.buffer = buffer;
	source.connect(context.destination);
	source.loop = true;

	source.start();
})
// Decoded arrayBuffer with float32 samples data
const buf = require('audio-lena/raw');

let lenaSamples = new Float32Array(lenaBuf)
let buffer = context.createBuffer(1, lenaSamples.length, 44100)
buffer.getChannelData(0).set(lenaSamples)

let source = context.createBufferSource();
source.buffer = buffer;
source.connect(context.destination);
source.loop = false;

source.start();
// Data-uri
const ogg = require('audio-lena/ogg-datauri')

let audio = new Audio()
audio.addEventListener('canplay', () => {
	audio.play()
})
audio.src = ogg

API

let lena = require('audio-lena')

EntryMeaning
audio-lenaLena record constructor below.
audio-lena/rawArrayBuffer with float32 samples.
audio-lena/mp3ArrayBuffer with encoded mp3 data.
audio-lena/wavArrayBuffer with encoded wav data.
audio-lena/oggArrayBuffer with encoded ogg data.
audio-lena/flacArrayBuffer with encoded flac data.
audio-lena/raw-base64Base64 string with encoded float32 samples.
audio-lena/mp3-base64Base64 string with encoded mp3 data.
audio-lena/wav-base64Base64 string with encoded wav data.
audio-lena/ogg-base64Base64 string with encoded ogg data.
audio-lena/flac-base64Base64 string with encoded flac data.
audio-lena/raw-datauriData-URI string with encoded float32 samples.
audio-lena/mp3-datauriData-URI string with encoded mp3 data.
audio-lena/wav-datauriData-URI string with encoded wav data.
audio-lena/ogg-datauriData-URI string with encoded ogg data.
audio-lena/flac-datauriData-URI string with encoded flac data.

let result = lena({format: 'mp3', type: 'float'}?)

Get lena record with defined format and type.

FormatMeaning
'mp3'MP3-encoded data.
'wav'WAV-encoded data.
'raw'Raw float32 samples.
'ogg'OGG-encoded samples.
'flac'FLAC-encoded samples.
TypeMeaning
'buffer'ArrayBuffer with data.
'base64'Base64-encoded string.
'data-uri'Data-uri string.

Reference

Related

2.3.0

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago