Skip to content

Commit

Permalink
Headless Web Audio
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Apr 2, 2024
1 parent 6c0dc1e commit 8d30194
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ JZZ.synth.OSC().noteOn(0, 'C5', 127)
.wait(500).noteOff(0, 'C5').noteOff(0, 'E5').noteOff(0, 'G5');
```

## Using in Node.js with headless Web Audio

```js
const WAAPI = require('node-web-audio-api');
const JZZ = require('jzz');
require('jzz-synth-osc')(JZZ);

global.window = { AudioContext: WAAPI.AudioContext };

JZZ.synth.OSC()
.or(function() { console.log('Cannot open MIDI-Out!\n'/* + this.err() */); })
.note(0, 'C5', 127, 500).wait(500)
.note(0, 'E5', 127, 500).wait(500)
.note(0, 'G5', 127, 500).wait(500)
.note(9, 'C6', 127, 500).wait(500)
.and(function() { process.exit(); });
```

## More information

Please visit [**https://jazz-soft.net**](https://jazz-soft.net) for more information.
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
],
"author": "jazz-soft (https://jazz-soft.net/)",
"dependencies": {
"jzz": "^1.7.8"
"jzz": "^1.8.1"
},
"devDependencies": {
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"grunt": "^1.6.1",
"grunt-contrib-jshint": "^3.2.0",
"grunt-contrib-uglify": "^5.2.2",
"mocha": "^10.2.0",
"mocha": "^10.4.0",
"node-web-audio-api": "^0.18.0",
"nyc": "^15.1.0",
"web-audio-test": "^0.0.7"
},
Expand Down

0 comments on commit 8d30194

Please sign in to comment.