Skip to content

Commit

Permalink
Let there be light!
Browse files Browse the repository at this point in the history
  • Loading branch information
nicross committed Mar 11, 2023
0 parents commit 540d586
Show file tree
Hide file tree
Showing 233 changed files with 128,584 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
82 changes: 82 additions & 0 deletions Gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
const {EOL} = require('os')
const concat = require('gulp-concat')
const del = require('del')
const header = require('gulp-header')
const gulp = require('gulp')
const jsdoc = require('gulp-jsdoc3')
const package = require('./package.json')
const rename = require('gulp-rename')
const uglify = require('gulp-uglify-es').default

gulp.task('clean', () => del(['dist', 'docs']))

gulp.task('dist', () => {
const comment = `/* ${package.name} v${package.version} */${EOL}`

return gulp.src(getJs())
.pipe(header(comment))
.pipe(concat('syngen.js'))
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(header(comment))
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest('dist'))
})

gulp.task('docs', (done) => {
gulp.src([
'README.md',
'src/syngen.js',
'src/syngen/**/*.js',
]).pipe(jsdoc({
opts: {
destination: 'docs',
readme: 'README.md',
template: 'node_modules/jsdoc/templates/default',
},
plugins: [
'plugins/markdown',
],
tags: {
allowUnknownTags: true,
},
templates: {
monospaceLinks: true,
default: {
includeDate: false,
useLongnameInNav: true,
},
},
}, done))
})

gulp.task('build', gulp.series('clean', 'dist', 'docs'))

gulp.task('watch', () => {
gulp.watch('src/**', gulp.series('build'))
})

function getJs() {
return [
'src/wrapper/header.js',
'src/syngen.js',
'src/syngen/const.js',
'src/syngen/fn.js',
'src/syngen/tool/*.js',
'src/syngen/loop.js',
'src/syngen/state.js',
'src/syngen/buffer/*.js',
'src/syngen/ear/filterModel/base.js',
'src/syngen/ear/filterModel/*.js',
'src/syngen/ear/gainModel/base.js',
'src/syngen/ear/gainModel/*.js',
'src/syngen/mixer.js',
'src/syngen/mixer/reverb.js',
'src/syngen/mixer/reverb/gainModel/base.js',
'src/syngen/mixer/reverb/gainModel/*.js',
'src/syngen/*.js',
'src/syngen/*/*.js',
'src/syngen/*/*/*.js',
'src/wrapper/footer.js',
]
}
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# syngen
A spatial audio, synthesis, and game development toolkit.

## Disclaimer
This is experimental and under active development.
Specifically, the API has changed significantly from previous versions.
Many of these changes are yet to be documented.
Please use at your own risk.

## Overview
**syngen** provides a light wrapper around the [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API) for building sounds and positioning them on a three-dimensional binaural soundstage.
Its event loop fires each frame to update sounds and core systems.
Additional utilities provide tools for engineering custom systems that hook into its API to deliver rich experiences.

### Getting started
Please download or clone this repository, or install with your favorite package manager:
```sh
npm install syngen
```

From there you might `require('syngen')` or include `dist/syngen.min.js`.

### Example usage
This library _must_ be used within a browser environment so it can access the `window` object.
It can be imported or required as a UMD module, or accessed from the `syngen` global.

This example demonstrates how to define a prop and instantiate one on the soundstage:

```js
const prototype = syngen.sound.invent({
onConstruct: function () {
this.synth = syngen.synth.simple({
frequency: syngen.fn.fromMidi(60),
gain: syngen.fn.fromDb(-6),
}).connect(this.output)
},
onDestroy: function () {
this.synth.stop()
},
})

const instance = sound.instantiate()
```

Please browse the `example` directory or the projects below for more elaborate real-world examples.

### Example projects
No example projects for this release branch.

#### Commercial projects
- [Periphery Synthetic EP](https://periphery-synthetic-ep.shiftbacktick.io) – Extrasolar musical explorer

## Development
To get started, please clone this repository:
```sh
git clone https://github.com/nicross/syngen.git
```

Then use [npm](https://nodejs.org) to install the required dependencies
```sh
npm install
```

### Common tasks
Common tasks have been automated with [Gulp](https://gulpjs.com):

#### Build distributables only
```sh
gulp dist
```

#### Build documentation only
```sh
gulp docs
```

#### Build everything once
```sh
gulp build
```

#### Build everything continuously
```sh
gulp watch
```
Loading

0 comments on commit 540d586

Please sign in to comment.