Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/satelllte/web-audio-on-server
Proof-of-concept demonstrating the usage of Web Audio API on server using Playwright
https://github.com/satelllte/web-audio-on-server
playwright web-audio web-audio-api
Last synced: 3 days ago
JSON representation
Proof-of-concept demonstrating the usage of Web Audio API on server using Playwright
- Host: GitHub
- URL: https://github.com/satelllte/web-audio-on-server
- Owner: satelllte
- License: apache-2.0
- Created: 2024-02-27T20:09:38.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-05T22:04:27.000Z (8 months ago)
- Last Synced: 2024-10-10T05:35:05.877Z (26 days ago)
- Topics: playwright, web-audio, web-audio-api
- Language: TypeScript
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Web Audio on Server
Proof-of-concept demonstrating the usage of [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API) on server using [Playwright](https://github.com/microsoft/playwright).
## How it works
The core audio rendering logic put in [src/renderAudio.ts](./src/renderAudio.ts) script, which uses [OfflineAudioContext](https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext) to generate audio buffer. Then it's being taken by some wrapping code to put it into an HTML page wrapper to be opened by Playwright browser to download the resulting audio file.
The key benefit of Playwright is that it allows to run this logic on any platform, preserving all of the features of Web Audio API. So there's no need of some custom Web Audio API re-implementation solution for server, which is a very difficult task to complete.
## Getting started
Prerequisites:
- [Node.js](https://nodejs.org) v20 or later
- [Bun](https://bun.sh/) v1 or laterTo install dependencies:
```bash
bun install
```To run:
```bash
bun run build
bun run render
```---
This project was created using `bun init` in bun v1.0.29. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.