ignore any songs.json etc
This commit is contained in:
parent
96b1ecf7e6
commit
9a5db25087
3 changed files with 235 additions and 8 deletions
|
|
@ -3,14 +3,11 @@ const { useState, useEffect, useRef, useCallback } = React;
|
|||
// ============================================================
|
||||
// SONG DEFINITIONS
|
||||
//
|
||||
// MODE 1 (default): Procedurally generated via Tone.js
|
||||
// MODE 2 (production): Self-hosted MP3s in /audio/
|
||||
//
|
||||
// To switch to real audio, set url: "/audio/yourfile.mp3"
|
||||
// on each song and the player will use HTML5 Audio instead.
|
||||
// See README.md for details on sourcing CC-BY music.
|
||||
// Procedural synth songs are the built-in fallback. If
|
||||
// audio/songs.json exists (generated by tools/probe-songs.py),
|
||||
// those MP3-backed songs replace the builtins at startup.
|
||||
// ============================================================
|
||||
const SONGS = [
|
||||
const BUILTIN_SONGS = [
|
||||
{ title: "Bureaucratic Sunrise", artist: "The Paywalls", duration: 90, bpm: 120,
|
||||
gen: (s,t) => { ["C4","E4","G4","B4","C5","B4","G4","E4"].forEach((n,i) => s.triggerAttackRelease(n,"8n",t+i*0.25)); },
|
||||
wave: "triangle", color: "#e74c3c" },
|
||||
|
|
@ -31,6 +28,9 @@ const SONGS = [
|
|||
wave: "sawtooth", color: "#e67e22" },
|
||||
];
|
||||
|
||||
// Mutable song list — replaced by audio/songs.json if available
|
||||
let SONGS = BUILTIN_SONGS;
|
||||
|
||||
const SUBS = {
|
||||
pause: { name:"Pause Plus™", price:"$2.99/mo", micro:0.01, desc:"The freedom to stop. Whenever you want.", color:"#e74c3c", dismiss:"I like surprises" },
|
||||
resume: { name:"Resume Rights™", price:"$2.49/mo", micro:0.02, desc:"You paused. Now un-pause. Two different things.", color:"#e67e22", dismiss:"Silence suits me" },
|
||||
|
|
@ -586,4 +586,9 @@ function PayPlay() {
|
|||
);
|
||||
}
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")).render(<PayPlay />);
|
||||
// Load real songs from audio/songs.json if available, then render
|
||||
fetch("audio/songs.json")
|
||||
.then(r => { if (r.ok) return r.json(); throw new Error(); })
|
||||
.then(songs => { if (Array.isArray(songs) && songs.length > 0) SONGS = songs; })
|
||||
.catch(() => {}) // No songs.json — use procedural builtins
|
||||
.finally(() => ReactDOM.createRoot(document.getElementById("root")).render(<PayPlay />));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue