Awesome
Spatial Audio with LiveKit
This is a demo of spatial audio using LiveKit. Users join a little 2D world, and hear other users' audio in stereo, based on their position and distance relative to you.
Online demo
You can try an online demo right now at https://spatial-audio-demo.livekit.io/.
Running locally
Clone the repo and install dependencies:
git clone git@github.com:livekit-examples/spatial-audio.git
cd spatial-audio
npm install
Create a new LiveKit project at http://cloud.livekit.io. Then create a new key in your project settings.
Create a new file at spatial-audio/.env.development
and add your new API key and secret as well as your project's WebSocket URL (found at the top of http://cloud.livekit.io):
LIVEKIT_API_KEY=<your api key>
LIVEKIT_API_SECRET=<your api secret>
LIVEKIT_WS_URL=wss://<your-project>.livekit.cloud
(Note: this file is in .gitignore
. Never commit your API secret to git.)
Then run the development server:
npm run dev
You can test it by opening http://localhost:3000 in a browser.
Deploying for production
This demo is a Next.js app. You can deploy to your Vercel account with one click:
Refer to the Next.js deployment documentation for more about deploying to a production environment.
Asset credits
This demo uses the following assets:
- Field of Green and boombox sprite by GuttyKreum
- Dino Characters by Arks
They're both wonderful artists, check out their work!