Minor improvements to viz and params
This commit is contained in:
parent
5a23032fb8
commit
35a90ec979
|
@ -38,7 +38,7 @@ export default function HeightMapImage(props: HeightMapImageProps) {
|
||||||
// Feed the heightmap
|
// Feed the heightmap
|
||||||
bumpTexture: { value: heightMap },
|
bumpTexture: { value: heightMap },
|
||||||
// Feed the scaling constant for the heightmap
|
// Feed the scaling constant for the heightmap
|
||||||
bumpScale: { value: -0.2 },
|
bumpScale: { value: -0.5 },
|
||||||
// Feed the texture map
|
// Feed the texture map
|
||||||
terrainTexture: { value: textureMap },
|
terrainTexture: { value: textureMap },
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -39,15 +39,17 @@ export default function SpectrogramViewer({
|
||||||
playheadRef.current.position.y = camera.position.y;
|
playheadRef.current.position.y = camera.position.y;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const playbarShift = 3.6; // [m]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<group>
|
<group>
|
||||||
{inferenceResults.map((value: InferenceResult, index: number) => {
|
{inferenceResults.map((value: InferenceResult, index: number) => {
|
||||||
const height = audioLength * (-0.48 - value.counter);
|
const position = audioLength * (-0.53 - value.counter) + playbarShift;
|
||||||
if (use_height_map) {
|
if (use_height_map) {
|
||||||
return (
|
return (
|
||||||
<HeightMapImage
|
<HeightMapImage
|
||||||
url={value.image}
|
url={value.image}
|
||||||
position={[0, height, 0]}
|
position={[0, position, 0]}
|
||||||
rotation={[0, 0, -Math.PI / 2]}
|
rotation={[0, 0, -Math.PI / 2]}
|
||||||
scale={[audioLength, 5, 1]}
|
scale={[audioLength, 5, 1]}
|
||||||
key={index}
|
key={index}
|
||||||
|
@ -57,7 +59,7 @@ export default function SpectrogramViewer({
|
||||||
return (
|
return (
|
||||||
<ImagePlane
|
<ImagePlane
|
||||||
url={value.image}
|
url={value.image}
|
||||||
height={height}
|
height={position}
|
||||||
duration={audioLength}
|
duration={audioLength}
|
||||||
key={index}
|
key={index}
|
||||||
/>
|
/>
|
||||||
|
@ -69,10 +71,10 @@ export default function SpectrogramViewer({
|
||||||
<group ref={playheadRef}>
|
<group ref={playheadRef}>
|
||||||
<Box
|
<Box
|
||||||
args={[5.5, 2.0, 0.15]}
|
args={[5.5, 2.0, 0.15]}
|
||||||
rotation={[Math.PI / 2 - 0.4, 0, 0]}
|
rotation={[Math.PI / 2 - 0.2, 0, 0]}
|
||||||
position={[0, 0, -0.5]}
|
position={[0, playbarShift, -0.5]}
|
||||||
>
|
>
|
||||||
<meshBasicMaterial color="#ee2211" transparent opacity={0.7} />
|
<meshBasicMaterial color="#ee2211" transparent opacity={0.8} />
|
||||||
</Box>
|
</Box>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -16,7 +16,7 @@ const SERVER_URL = "http://129.146.52.68:3013/run_inference/";
|
||||||
const defaultPromptInputs = [
|
const defaultPromptInputs = [
|
||||||
{ prompt: "A jazz pianist playing a classical concerto" },
|
{ prompt: "A jazz pianist playing a classical concerto" },
|
||||||
{ prompt: "Country singer and a techno DJ" },
|
{ prompt: "Country singer and a techno DJ" },
|
||||||
{ prompt: "A typewriter in they style of K-Pop" },
|
{ prompt: "A typewriter in the style of K-Pop" },
|
||||||
{ prompt: "lo-fi beat for the holidays" },
|
{ prompt: "lo-fi beat for the holidays" },
|
||||||
{ prompt: "" },
|
{ prompt: "" },
|
||||||
{ prompt: "" },
|
{ prompt: "" },
|
||||||
|
@ -264,15 +264,28 @@ export default function Home() {
|
||||||
|
|
||||||
const transitioning = appState == AppState.Transition;
|
const transitioning = appState == AppState.Transition;
|
||||||
|
|
||||||
|
const denoising = 0.85;
|
||||||
|
const guidance = 7.0;
|
||||||
|
const numInferenceSteps = 50;
|
||||||
|
const seedImageId = 0;
|
||||||
|
const maskImageId = null;
|
||||||
|
|
||||||
const inferenceInput = {
|
const inferenceInput = {
|
||||||
alpha: alpha,
|
alpha: alpha,
|
||||||
|
num_inference_steps: numInferenceSteps,
|
||||||
|
seed_image_id: seedImageId,
|
||||||
|
mask_image_id: maskImageId,
|
||||||
start: {
|
start: {
|
||||||
prompt: startPrompt,
|
prompt: startPrompt,
|
||||||
seed: seed,
|
seed: seed,
|
||||||
|
denoising: denoising,
|
||||||
|
guidance: guidance,
|
||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
prompt: transitioning ? endPrompt : startPrompt,
|
prompt: transitioning ? endPrompt : startPrompt,
|
||||||
seed: transitioning ? seed : seed + 1,
|
seed: transitioning ? seed : seed + 1,
|
||||||
|
denoising: denoising,
|
||||||
|
guidance: guidance,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -324,6 +337,8 @@ export default function Home() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Run inference on a timer.
|
||||||
|
// TODO(hayk): Improve the strategy here.
|
||||||
useInterval(() => {
|
useInterval(() => {
|
||||||
console.log(inferenceResults);
|
console.log(inferenceResults);
|
||||||
if (inferenceResults.length < maxNumInferenceResults) {
|
if (inferenceResults.length < maxNumInferenceResults) {
|
||||||
|
@ -331,8 +346,6 @@ export default function Home() {
|
||||||
}
|
}
|
||||||
}, timeout);
|
}, timeout);
|
||||||
|
|
||||||
// Run inference on a timer.
|
|
||||||
// TODO(hayk): Improve the timing here.
|
|
||||||
// TODO(hayk): Fix warning about effects.
|
// TODO(hayk): Fix warning about effects.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
runInference(alpha, seed, appState, promptInputs);
|
runInference(alpha, seed, appState, promptInputs);
|
||||||
|
@ -351,14 +364,14 @@ export default function Home() {
|
||||||
|
|
||||||
<div className="bg-[#0A2342] flex flex-row min-h-screen text-white">
|
<div className="bg-[#0A2342] flex flex-row min-h-screen text-white">
|
||||||
<div className="w-1/3 min-h-screen">
|
<div className="w-1/3 min-h-screen">
|
||||||
{tonePlayer && (
|
<ThreeCanvas
|
||||||
<ThreeCanvas
|
paused={paused}
|
||||||
paused={paused}
|
getTime={() => Tone.Transport.seconds}
|
||||||
getTime={() => Tone.Transport.seconds}
|
audioLength={
|
||||||
audioLength={tonePlayer.sampleTime * tonePlayer.buffer.length}
|
tonePlayer ? tonePlayer.sampleTime * tonePlayer.buffer.length : 0
|
||||||
inferenceResults={inferenceResults}
|
}
|
||||||
/>
|
inferenceResults={inferenceResults}
|
||||||
)}
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<PromptPanel
|
<PromptPanel
|
||||||
|
|
5
types.ts
5
types.ts
|
@ -7,8 +7,9 @@ export interface PromptInput {
|
||||||
|
|
||||||
export interface InferenceInput {
|
export interface InferenceInput {
|
||||||
alpha: number;
|
alpha: number;
|
||||||
// num_inference_steps: number;
|
num_inference_steps?: number;
|
||||||
// seed_image_id: number;
|
seed_image_id?: number;
|
||||||
|
mask_image_id?: string;
|
||||||
|
|
||||||
start: PromptInput;
|
start: PromptInput;
|
||||||
end: PromptInput;
|
end: PromptInput;
|
||||||
|
|
Loading…
Reference in New Issue