import { Dialog, Transition } from "@headlessui/react"; import { Fragment, useState } from "react"; import { FiSettings } from "react-icons/fi"; import { ImStatsBars } from "react-icons/im"; import styled from "styled-components"; import { InferenceResult, PromptInput } from "../types"; import DebugView from "./DebugView"; const ModalContainer = styled.div` position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; `; interface DebugViewProps { promptInputs: PromptInput[]; inferenceResults: InferenceResult[]; nowPlayingResult: InferenceResult; denoising: number; setDenoising: (denoising: number) => void; seedImage: string; setSeedImage: (seedImage: string) => void; } export default function Settings({ promptInputs, inferenceResults, nowPlayingResult, denoising, setDenoising, seedImage, setSeedImage, }: DebugViewProps) { const [open, setOpen] = useState(false); var classNameCondition = ""; if (open) { classNameCondition = "fixed z-20 top-44 right-4 md:top-48 md:right-8 bg-sky-400 w-14 h-14 rounded-full drop-shadow-lg flex justify-center items-center text-white text-2xl hover:bg-sky-500 hover:drop-shadow-2xl"; } else { classNameCondition = "fixed z-20 top-44 right-4 md:top-48 md:right-8 bg-slate-100 w-14 h-14 rounded-full drop-shadow-lg flex justify-center items-center text-sky-900 text-2xl hover:text-white hover:bg-sky-600 hover:drop-shadow-2xl"; } return ( <> setOpen(false)} >
Settings

Riffusion generates music from text prompts. Try your favorite artists, instruments like saxophone or violin, modifiers like arabic or jamaican, genres like jazz or gospel, sounds like church bells or rain, or any combination. Play with the settings below to explore the latent space of sound.

{/* */} {SeedImageSelector(seedImage, setSeedImage)} {DenoisingSelector(denoising, setDenoising)} {DebugButton( promptInputs, inferenceResults, nowPlayingResult )}
); } export function SeedImageSelector( seedImage: string, setSeedImage: (seedImage: string) => void ) { let selectOptions = [ ["OG Beat", "og_beat"], ["Agile", "agile"], ["Marim", "marim"], ["Motorway", "motorway"], ["Vibes", "vibes"], ]; let matchedOption = selectOptions.find((x) => x[1] === seedImage); if (matchedOption === undefined) { matchedOption = [`Custom (${seedImage})`, seedImage]; selectOptions.push(matchedOption); } return (

Used as the base for img2img diffusion. This keeps your riff on beat and impacts melodic patterns.

); } export function DenoisingSelector( denoising: number, setDenoising: (d: number) => void ) { let selectOptions = [ ["Keep it on beat (0.75)", 0.75], ["Get a little crazy (0.8)", 0.8], ["I'm feeling lucky (0.85)", 0.85], ["What is tempo? (0.95)", 0.95], ]; let matchedOption = selectOptions.find((x) => x[1] === denoising); if (matchedOption === undefined) { matchedOption = [`Custom (${denoising})`, denoising]; selectOptions.push(matchedOption); } return (

The higher the denoising, the more creative the output, and the more likely you are to get off beat.

); } export function DebugButton(promptInputs, inferenceResults, nowPlayingResult) { const [debugOpen, debugSetOpen] = useState(false); let buttonClassName = ""; if (debugOpen) { buttonClassName = "fixed z-20 top-4 right-6 bg-sky-400 w-10 h-10 rounded-full flex justify-center items-center text-white text-xl hover:bg-sky-500 hover:drop-shadow-2xl"; } else { buttonClassName = "fixed z-20 top-4 right-6 bg-sky-100 w-10 h-10 rounded-full flex justify-center items-center text-sky-900 text-xl hover:text-white hover:bg-sky-500 hover:drop-shadow-2xl"; } return ( <> ); }