Skip to content

Commit

Permalink
some initial code for a synth app using hydra
Browse files Browse the repository at this point in the history
  • Loading branch information
setsun committed Jul 12, 2023
1 parent f22214d commit c7bf73b
Show file tree
Hide file tree
Showing 16 changed files with 243 additions and 21 deletions.
21 changes: 0 additions & 21 deletions apps/portfolio/.github/workflows/production.yml

This file was deleted.

4 changes: 4 additions & 0 deletions apps/synth/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ["custom"],
};
1 change: 1 addition & 0 deletions apps/synth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# `synth`
12 changes: 12 additions & 0 deletions apps/synth/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Synth</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
29 changes: 29 additions & 0 deletions apps/synth/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "synth",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"hydra-ts": "^1.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"regl": "^1.7.0"
},
"devDependencies": {
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@vitejs/plugin-react": "^4.0.1",
"eslint": "^8.44.0",
"eslint-config-custom": "workspace:*",
"tailwind-config": "workspace:*",
"tailwindcss": "^3.3.2",
"tsconfig": "workspace:*",
"typescript": "^5.1.6",
"vite": "^4.4.0"
}
}
9 changes: 9 additions & 0 deletions apps/synth/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// If you want to use other PostCSS plugins, see the following:
// https://tailwindcss.com/docs/using-with-preprocessors

module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
1 change: 1 addition & 0 deletions apps/synth/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions apps/synth/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Hydra, generators } from 'hydra-ts';
import REGL from 'regl';
import { useState, useLayoutEffect } from "react";

const regl = REGL();

function App() {
const [hydra, setHydra] = useState<Hydra>(null);

useLayoutEffect(() => {
const hydra = new Hydra({ regl, width: window.innerWidth, height: window.innerHeight });

const { sources, outputs, loop } = hydra;

const { osc } = generators;

const [o0] = outputs;

setHydra(hydra);

osc(4, 0.1, 1.2).out(o0)

loop.start();
}, []);

return null;
}

export default App;
1 change: 1 addition & 0 deletions apps/synth/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions apps/synth/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";

import "./styles/globals.css";

ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
10 changes: 10 additions & 0 deletions apps/synth/src/styles/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

html,
body {
@apply bg-slate-950 text-white m-0 p-0;
font-family: Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
1 change: 1 addition & 0 deletions apps/synth/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
7 changes: 7 additions & 0 deletions apps/synth/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// tailwind config is required for editor support

const sharedConfig = require("tailwind-config/tailwind.config.js");

module.exports = {
presets: [sharedConfig],
};
12 changes: 12 additions & 0 deletions apps/synth/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "tsconfig/nextjs.json",
"compilerOptions": {
"plugins": [{ "name": "next" }],
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
10 changes: 10 additions & 0 deletions apps/synth/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
define: {
global: 'window',
},
});
106 changes: 106 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c7bf73b

Please sign in to comment.