tinyfiles.tv
⚠️ TINKER TOY — NOT LIVE YET — DISCLAIMER

This is a toy prototype. Your notes are local-only — stored only in this browser tab. They are NOT saved to the server and NOT shared with anyone yet. Refresh = gone (unless this tab autosaves). Shared community state, accounts, and moderation are coming later. Don’t write anything you wouldn’t want to lose. And yes — the song fights back on purpose. It wants to be elevator music.

Tool: Sound: 🎵 0 notes in loop🎹 Elevator HP: 1,000,000🛡️ Shield: off
Notes: 0 / 1,000,000•999,999 to go•Song: Silent•BPM: 120

1,000,000 notes = one very long song. Every note you place deals 1 damage to the Elevator Music. Every 30 notes, and every 45 seconds, the elevator hits back — it tries to make everything C major and boring.

🎶
The song says:

Shhh. Silence. Perfect silence. Let us stay here. No need for notes. No need for drums. Just… hold music.

No attacks yet. The elevator is pretending to be quiet.

16-step loop — tap a square to place a note. This is the first 16 steps of the million-note song.▶ = play, then tap while it loops

Piano = quick add. Tap a piano key and it drops that note into the next empty step in that row — and plays it right now. Drums are the black row at the bottom. Fight = undoes the elevator’s last attack, +10 bonus damage. Defend = blocks for 60s.

How it works (when it’s real)

Everyone writes on the same song. One note at a time. You add a weird note, the elevator tries to flatten it to C major, you fight it back. Cooldowns, accounts, and moderation will keep it from becoming chaos. For now, you’re writing alone — think of this as practice against very polite hold music.

  • Tap grid or piano to deal damage — 1 note = 1 HP off the elevator
  • Every 30 notes + every 45 seconds, the elevator attacks
  • Fight undoes its last attack, Defend blocks for 60s
  • Download .txt to keep your loop

Community — coming soon

Shared state is not connected yet. This box is a placeholder for what’s next:

🟢 0 people playing right now (fake — local toy)
🎵 Last riff: —
⚔️ Last fight: — (not saved)
📜 Rules: No hate, no NSFW, no ads. Mods will nuke it later.

Backend  ·  Template · Proposed · Not connected

⬇ Backend — TinySong Backend — Template

Right now TinySong is a tinker toy — grid is a local 8 x 16 array in this tab, elevatorAttack() eats a note from the grid, totalEver is a local counter, history is 10 in-memory snapshots, and Refresh = gone (except local autosave). The disclaimer on this page is the truth: local-only, not saved, not shared. This backend is the map to make it real: one shared song, per-note writes by position, elevator attacks as server events, cooldowns, accounts, and moderation. Proposed, not connected.

01 / Files to create
api/tinysong/note.php          POST /api/tinysong/note
api/tinysong/notes.php         GET  /api/tinysong/notes?since=
api/tinysong/fight.php         POST /api/tinysong/fight
api/tinysong/snapshot.php      GET  /api/tinysong/snapshot
api/tinysong/clear.php         POST /api/tinysong/clear  (mod only)
sql/tinysong_tables.sql

Keep the tinyfiles PHP pattern: each endpoint loads /api/bootstrap.php, uses json_in() / json_out(), prepared PDO statements.

02 / Database tables
-- sql/tinysong_tables.sql
tinysong_notes
  -- one row per note — 1,000,000 max, ordered by position
  id BIGINT AUTO_INCREMENT PRIMARY KEY
  position INT NOT NULL              -- 0 .. 999,999, unique, defines order
  pitch VARCHAR(10) NOT NULL         -- "C4", "E4", "DRUM", etc
  user_id INT NOT NULL
  written_at DATETIME NOT NULL
  UNIQUE(position)                   -- last write wins per slot

tinysong_attacks
  -- the elevator fights back — server events, not client guesses
  id BIGINT AUTO_INCREMENT PRIMARY KEY
  kind ENUM('eat','flatten','elevator_chord','try_end') NOT NULL
  position INT NULL                  -- which note it ate / flattened
  detail VARCHAR(200) NULL
  created_at DATETIME NOT NULL

tinysong_snapshot
  id INT AUTO_INCREMENT PRIMARY KEY
  path VARCHAR(200) NOT NULL         -- "/data/tinysong/snapshot.json"
  note_count INT NOT NULL DEFAULT 0
  created_at DATETIME NOT NULL

tinysong_cooldowns
  user_id INT PRIMARY KEY
  last_write_at DATETIME NOT NULL
  notes_last_minute INT NOT NULL DEFAULT 0

Song is 1,000,000 notes. Never store a full song per user — store only notes by position, plus one snapshot. Same idea as TinyMap / TinyNovel, but notes instead of pixels / words. Toy shows 16 steps — real song is the full 1M-note timeline, toy is just the first loop.

03 / API endpoints & request flow
POST /api/tinysong/note
{ "notes": [ { "position": 12, "pitch": "E4" }, ... ] }
- auth required, 1-100 notes per request (one riff = many notes)
- validates position 0-999999, pitch in allowed set
- cooldown: max 1 write per 500ms, max 100 notes per request
- writes INSERT ... ON DUPLICATE KEY UPDATE pitch, user_id, written_at
- returns { "ok": true, "written": 12, "cooldown_ms": 500 }

GET /api/tinysong/notes?since=2026-11-18T00:00:00Z
- returns { "ok": true, "notes": [ { position, pitch }, ... ] }
- since = last poll time, max 5000 notes per response
- client polls every 2s, applies only new notes — same grid toggle as now

POST /api/tinysong/fight
{ "attack_id": 123 }
- auth required, one fight per attack, max 1 fight per 5s
- server undoes that attack (restores eaten note, removes elevator chord)
- returns { "ok": true, "restored": "E4", "bonus": 10 }

GET /api/tinysong/snapshot
- returns { "ok": true, "url": "/data/tinysong/snapshot.json",
  "note_count": 1234, "updated_at": "..." }
- new visitors load snapshot first, then poll /notes?since=

POST /api/tinysong/clear  (mod only)
- auth + role=mod required, else 403
- clears tinysong_notes + rebuilds snapshot, logs who cleared it

Elevator attacks are server events in the real version — tinysong_attacks — not client random. Client in this toy fakes them with elevatorAttack(). Server decides eat / flatten / elevator_chord / try_end on a timer + every 30 notes, so everyone hears the same fight.

04 / Cooldown, moderation & validation (server owns this)
// Cooldown — keeps it from becoming chaos:
//   1 write request per 500ms per user
//   100 notes per request, 1 fight per 5s per user
//   if user exceeds it, return { "ok": false, "error": "cooldown",
//   "retry_ms": 320 } — client shows "Slow down" and retries.

// Moderation:
//   no hate / NSFW / ads — mods can clear + ban user_id from writing
//   server stores user_id per note, so a bad section can be rolled
//   back by user + position range, not by wiping the whole song.

// Validation:
//   position must be integer 0-999999, pitch must be in allowed set
//   notes must be an array, 1-100 items — else 400
//   sound / BPM are client-side only — server only sees notes.

Keep the disclaimer until this ships: “Tinker toy — not live yet. Refresh = gone.” Remove it only when /api/tinysong/note is actually storing notes.

05 / Frontend wiring
// Grid is already local in this page:
//   grid[8][16] + drum[16] — same arrays as now
//   totalEver — same counter as now, drives Elevator HP

// After tapping grid / piano (debounced 800ms), also send to server:
async function sendNotes(notes){
  const res = await fetch('/api/tinysong/note', { method:'POST',
    headers:{'Content-Type':'application/json'},
    body: JSON.stringify({ notes }) });
  // if cooldown, wait retry_ms and retry once
}

// Poll for other people's notes:
async function pollNotes(){
  const res = await fetch('/api/tinysong/notes?since=' + encodeURIComponent(lastPoll));
  const data = await res.json();
  // data.notes.forEach(n => setGridNote(n.position, n.pitch))
  // setGridNote = same toggle as toggleCell(), but no history push
}

// On load:
//   1. GET /api/tinysong/snapshot -> load JSON into grid
//   2. setInterval(pollNotes, 2000)
//   3. keep local playNote() / fightSong() / undo() / downloadSong() as-is
// If API fails, fall back to current local-only toy + disclaimer.

Keep the current toy playable with no backend — if /api/tinysong/notes fails, playing stays local-only and the disclaimer stays.

Copy the snippets above into api/tinysong/ + sql/tinysong_tables.sql — no GitHub needed. The <pre> blocks are the backend spec: shared 1,000,000-note song, per-note writes by position, elevator attacks as server events, cooldowns + moderation, same layout, disclaimer stays until wired.