Suno-style web UI for a self-hosted MiniMax-Music3 inference server
TypeScript ai-musicdiffusersdockerexpressminimaxminimax-musicmusic-generationreactself-hostedsgl-omnisunotailwindcsstext-to-musictypescriptvite
const ADJECTIVES = [
'Velvet', 'Neon', 'Paper', 'Golden', 'Hollow', 'Quiet', 'Electric', 'Midnight', 'Amber', 'Wild',
'Silver', 'Broken', 'Distant', 'Faded', 'Crimson', 'Lonely', 'Restless', 'Tender', 'Glass', 'Slow',
'Violet', 'Empty', 'Burning', 'Frozen', 'Sunday', 'Endless', 'Sacred', 'Little', 'Wandering', 'Cobalt',
'Honey', 'Static', 'Pale', 'Sleepless', 'Summer', 'Winter', 'Secret', 'Northern', 'Blue', 'Last',
];
const NOUNS = [
'Horizon', 'Rain', 'Cathedral', 'Signal', 'Rivers', 'Lanterns', 'Orbit', 'Tides', 'Weather', 'Mirrors',
'Streets', 'Radio', 'Fires', 'Gardens', 'Ghost', 'Highway', 'Satellites', 'Harbor', 'Postcards', 'Windows',
'Static', 'Bloom', 'Echoes', 'Motel', 'Coastline', 'Parade', 'Sunday', 'Kingdom', 'Currents', 'Sparrows',
'Avenue', 'Comet', 'Machines', 'Lullaby', 'Cinema', 'Skyline', 'Wolves', 'Daydream', 'Voltage', 'Fable',
];
const PATTERNS: ((a: string, n: string, n2: string) => string)[] = [
(a, n) => `${a} ${n}`,
(a, n) => `${a} ${n}`,
(a, n) => `${a} ${n}`,
(_a, n, n2) => `${n} & ${n2}`,
(a, n) => `The ${a} ${n}`,
(_a, n, n2) => `${n} of ${n2}`,
];
const pick = <T,>(arr: T[], rnd: () => number) => arr[Math.floor(rnd() * arr.length)];
/** A random two-word song title, e.g. "Velvet Horizon". `rnd` is injectable for tests. */
export function randomTitle(rnd: () => number = Math.random): string {
const next = (w: string) => NOUNS[(NOUNS.indexOf(w) + 1) % NOUNS.length];
const a = pick(ADJECTIVES, rnd);
let n = pick(NOUNS, rnd);
if (n === a) n = next(n); // a few words ("Static", "Sunday") are in both lists
let n2 = pick(NOUNS, rnd);
if (n2 === n || n2 === a) n2 = next(n2 === n ? n : n2);
if (n2 === n) n2 = next(n2);
return pick(PATTERNS, rnd)(a, n, n2);
}