A multiband compressor you can plug in: its state, a panel that draws the three bands and an engine that plays it. Play a loop through it and hold one band down
@audio-ui
block-multiband.tsx
"use client";
import { useState } from "react";
import { PlayToggle } from "@/components/audio-ui/play-toggle";
import { MultibandPanel } from "@/components/audio-ui/devices/multiband/panel";
import { useDeviceLoop } from "@/hooks/use-device-loop";
import { useMasterBus } from "@/hooks/use-master-bus";
import {
type MultibandState,
multibandDevice,
} from "@/components/audio-ui/devices/multiband/device";
import { createMultibandEngine } from "@/components/audio-ui/devices/multiband/engine";
const MASTER_VOLUME = 0.7;
/**
* A multiband compressor you can plug in: its state, a panel that draws the
* three bands and an engine that plays it, each its own file and none knowing
* the others. Play the loop, lower the threshold of one band and only that
* band is held down.
*/
export function BlockMultiband() {
const [state, setState] = useState<MultibandState>(() =>
multibandDevice.defaults()
);
const master = useMasterBus(MASTER_VOLUME);
const { playing, toggle } = useDeviceLoop({
create: createMultibandEngine,
destination: master,
state,
});
return (
<div className="rounded-xl h-full w-full min-w-0">
<MultibandPanel onValueChange={setState} value={state}>
<PlayToggle
label="Play a loop through it"
onToggle={toggle}
playing={playing}
/>
</MultibandPanel>
</div>
);
}


























