This guide explains how to integrate Web-Noise components into your React application.
# Install the core package
npm install @web-noise/core
# Install the base nodes package
npm install @web-noise/base-nodesHere's a simple example of how to integrate the Web-Noise Editor into your React application:
import React from 'react';
import { Editor } from '@web-noise/core';
import {
webAudioNodes,
webNoiseNodes,
patchNodes,
scriptNodes
} from '@web-noise/base-nodes';
const MyWebNoiseApp = () => {
return (
<div className="my-app">
<h1>My Web Noise Application</h1>
<div style={{ width: '100%', height: '800px' }}>
<Editor
plugins={[webAudioNodes, webNoiseNodes, patchNodes, scriptNodes]}
/>
</div>
</div>
);
};
export default MyWebNoiseApp;You can choose to include only specific node types:
import React from 'react';
import { Editor } from '@web-noise/core';
import { webAudioNodes, webNoiseNodes } from '@web-noise/base-nodes';
const MyWebNoiseApp = () => {
return (
<div className="my-app">
<h1>My Web Noise Application</h1>
<div style={{ width: '100%', height: '800px' }}>
<Editor
plugins={[webAudioNodes, webNoiseNodes]}
/>
</div>
</div>
);
};
export default MyWebNoiseApp;You can customize the theme:
import React from 'react';
import { Editor, theme as defaultTheme } from '@web-noise/core';
import { webAudioNodes } from '@web-noise/base-nodes';
const customTheme = {
...defaultTheme,
colors: {
...defaultTheme.colors,
primary: '#ff5500',
background: '#121212',
}
};
const MyWebNoiseApp = () => {
return (
<Editor
plugins={[webAudioNodes]}
theme={customTheme}
/>
);
};
export default MyWebNoiseApp;To develop both packages simultaneously:
- Clone the repository
- Install dependencies:
yarn install - Start the development server:
yarn start
To build individual packages:
# Build core package
yarn build:core
# Build base-nodes package
yarn build:base-nodes
# Build all packages
yarn build:packages