-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Inter } from "next/font/google"; | ||
import Head from "next/head"; | ||
import { useEffect, useRef } from "react"; | ||
import { Sampler } from "smplr"; | ||
import { getAudioContext } from "src/audio-context"; | ||
|
||
const inter = Inter({ subsets: ["latin"] }); | ||
|
||
export default function Tests() { | ||
const samplerRef = useRef<Sampler | null>(null); | ||
|
||
useEffect(() => { | ||
const audioContext = getAudioContext(); | ||
const sampler = new Sampler(audioContext, { | ||
buffers: { test: "test.mp3" }, | ||
}); | ||
samplerRef.current = sampler; | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<Head> | ||
<title>smplr</title> | ||
<meta name="description" content="Plug and play web instruments" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
</Head> | ||
<main className={"max-w-4xl mx-auto my-20 p-4" + inter.className}> | ||
<div className="flex items-end mb-16"> | ||
<h1 className="text-6xl font-bold">smplr</h1> | ||
</div> | ||
|
||
<div> | ||
<button | ||
onClick={() => { | ||
samplerRef.current?.start({ | ||
note: "test", | ||
loop: true, | ||
loopStart: 1.0, | ||
loopEnd: 9.0, | ||
}); | ||
}} | ||
> | ||
Play | ||
</button> | ||
</div> | ||
</main> | ||
</> | ||
); | ||
} |
Binary file not shown.