https://github.com/bafs/phase
Generates sounds from javascript functions.
https://github.com/bafs/phase
react signal-processing sound sound-synthesis webaudio-api
Last synced: 9 months ago
JSON representation
Generates sounds from javascript functions.
- Host: GitHub
- URL: https://github.com/bafs/phase
- Owner: BafS
- Created: 2019-04-28T22:22:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-06T01:42:44.000Z (about 2 years ago)
- Last Synced: 2025-04-10T22:45:08.996Z (9 months ago)
- Topics: react, signal-processing, sound, sound-synthesis, webaudio-api
- Language: TypeScript
- Homepage: https://bafs.github.io/Phase/build
- Size: 2.3 MB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Phase
Evaluate, plot and listen given javascript functions using web audio api.

## Example
```js
const a = 440;
const sum = (fn, [min, max]) => Array(max - min + 1).fill().reduce((sum, _, i) => sum + fn(i + min), 0);
// 3 harmonics to have a more realistic sound
sum(n => Math.sin(2 * a * n * Math.PI * t) * .7 / n, [1, 3])
```
### Dev
`npm i` to install the dependencies
- `npm run dev` to dev and run a local server
- `npm run build` to build for production