Skip to content

Commit c731474

Browse files
authored
update readme, package.json (#9)
1 parent e2de15b commit c731474

File tree

2 files changed

+47
-9
lines changed

2 files changed

+47
-9
lines changed

README.md

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
# @descript/web-audio-js
22

33
![Node CI](https://github.com/descriptinc/web-audio-js/workflows/Node%20CI/badge.svg)
4-
[![NPM Version](https://img.shields.io/npm/v/@descript/web-audio-js.svg?style=flat-square)](https://www.npmjs.org/package/@descript/web-audio-js)
5-
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://mohayonao.mit-license.org/)
4+
[![NPM Version](https://img.shields.io/npm/v/@descript/web-audio-js.svg)](https://www.npmjs.org/package/@descript/web-audio-js)
5+
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://mohayonao.mit-license.org/)
66

77
> Pure JS implementation of the [Web Audio API](https://www.w3.org/TR/webaudio/)
88
9+
Fork of [mohayonao/web-audio-engine](https://github.com/mohayonao/web-audio-engine) with following changes:
10+
11+
- Use TypeScript and fix some types
12+
- Remove `BaseAudioContext.suspend()`
13+
- Add new `RawDataAudioContext`
14+
- Bug fixes
15+
- Fixes for `BiquadFilterNode` and `DelayNode`
16+
- Fix WAVE decoding
17+
- Fix `AudioNode.disconnect(x)` not disconnecting
18+
919
## Installation
1020

1121
```
1222
npm install --save web-audio-engine
1323
```
1424

15-
##### download
16-
17-
- [web-audio-engine.js](https://raw.githubusercontent.com/mohayonao/web-audio-engine/master/build/web-audio-engine.js)
18-
1925
## API
2026

2127
`web-audio-engine` provides some `AudioContext` class for each use-case: audio playback, rendering and simulation.
@@ -105,6 +111,38 @@ context.encodeAudioData(audioData).then((arrayBuffer) => {
105111
});
106112
```
107113

114+
### Class: RawDataAudioContext
115+
116+
`RawDataAudioContext` allows you to synchronously step through an AudioContext. This is useful for streaming output at
117+
and controlling the rate
118+
119+
##### new RawDataAudioContext(opts?: object)
120+
121+
Creates new `RenderingAudioContext` instance.
122+
123+
- `opts.sampleRate: number` audio sample rate (in Hz) - _default: 44100_
124+
- `opts.numberOfChannels: number` audio channels (e.g. 2: stereo) - _default: 2_
125+
- `opts.blockSize: number` samples each rendering quantum - _default: 128_
126+
127+
##### context.process(channelData: Float32Array[], offset: number = 0)
128+
129+
Renders the next `blockSize` samples of audio into `channelData`.
130+
131+
```js
132+
import { RawDataAudioContext } from 'web-audio-engine';
133+
const context = new RawDataAudioContext();
134+
const { blockSize } = context;
135+
const channelData = [
136+
new Float32Array(blockSize),
137+
new Float32Array(blockSize),
138+
];
139+
140+
for (let i = 0; i < 100_000; i += blockSize)
141+
context.process(channelData);
142+
// Do something with channeLData
143+
}
144+
```
145+
108146
### Class: WebAudioContext
109147

110148
:construction*worker: \_TODO: WRITE DESCRIPTION*

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Marcello Bastea-Forte <marcello@descript.com>"
88
],
99
"bugs": {
10-
"url": "https://github.com/mohayonao/web-audio-engine/issues"
10+
"url": "https://github.com/descriptinc/web-audio-js/issues"
1111
},
1212
"dependencies": {
1313
"audio-type": "^1.0.2",
@@ -44,7 +44,7 @@
4444
"src",
4545
"build"
4646
],
47-
"homepage": "https://github.com/descriptinc/web-audio-engine/",
47+
"homepage": "https://github.com/descriptinc/web-audio-js/",
4848
"keywords": [
4949
"web audio api"
5050
],
@@ -54,7 +54,7 @@
5454
"types": "build/index.d.ts",
5555
"repository": {
5656
"type": "git",
57-
"url": "https://github.com/descriptinc/web-audio-engine.git"
57+
"url": "https://github.com/descriptinc/web-audio-js.git"
5858
},
5959
"scripts": {
6060
"build": "rollup -c",

0 commit comments

Comments
 (0)