Bump to v2.0.0: daily emote rotation + expanded sound library
- Emote face is now stable all day; /wake picks a fresh random face each morning instead of rotating every 5 minutes. Removes EMOTE_ROTATION_INTERVAL and last_emote_change entirely. - Added 10 new synthesized sounds for /notify: doorbell, knock, ding, blip, siren, tada, ping, bubble, fanfare, and alarm (loops until tapped or TTL expires). stopAlarm() wired into tap handler and handleStateChange(). - openapi.yaml: new sound names added to enum. - CLAUDE.md / README.md updated to reflect both changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
74
index.html
74
index.html
@@ -217,7 +217,7 @@
|
||||
const emoteEl = document.getElementById("emote");
|
||||
const messageEl = document.getElementById("message");
|
||||
const POLL_INTERVAL = 2000;
|
||||
const VERSION = "v1.5.0";
|
||||
const VERSION = "v2.0.0";
|
||||
|
||||
// Sound system
|
||||
let audioCtx = null;
|
||||
@@ -304,8 +304,69 @@
|
||||
setTimeout(() => playTone(1047, 0.2), 300);
|
||||
}
|
||||
|
||||
function playDoorbellSound() {
|
||||
playTone(880, 0.3, "sine", 0.12);
|
||||
setTimeout(() => playTone(659, 0.4, "sine", 0.12), 350);
|
||||
}
|
||||
function playKnockSound() {
|
||||
playTone(200, 0.08, "square", 0.15);
|
||||
setTimeout(() => playTone(200, 0.08, "square", 0.15), 150);
|
||||
setTimeout(() => playTone(200, 0.08, "square", 0.15), 300);
|
||||
}
|
||||
function playDingSound() {
|
||||
playTone(1046, 0.4, "sine", 0.1);
|
||||
}
|
||||
function playBlipSound() {
|
||||
playTone(1200, 0.05, "sine", 0.07);
|
||||
}
|
||||
function playSirenSound() {
|
||||
playTone(880, 0.15, "sawtooth", 0.12);
|
||||
setTimeout(() => playTone(660, 0.15, "sawtooth", 0.12), 180);
|
||||
setTimeout(() => playTone(880, 0.15, "sawtooth", 0.12), 360);
|
||||
setTimeout(() => playTone(660, 0.15, "sawtooth", 0.12), 540);
|
||||
}
|
||||
function playTadaSound() {
|
||||
playTone(392, 0.08, "sine", 0.1);
|
||||
setTimeout(() => playTone(392, 0.08, "sine", 0.1), 100);
|
||||
setTimeout(() => playTone(784, 0.4, "sine", 0.13), 220);
|
||||
}
|
||||
function playPingSound() {
|
||||
playTone(1047, 0.15, "sine", 0.1);
|
||||
}
|
||||
function playBubbleSound() {
|
||||
playTone(400, 0.06, "sine", 0.06);
|
||||
setTimeout(() => playTone(600, 0.04, "sine", 0.04), 40);
|
||||
}
|
||||
function playFanfareSound() {
|
||||
playTone(523, 0.1, "sine", 0.1);
|
||||
setTimeout(() => playTone(659, 0.1, "sine", 0.1), 120);
|
||||
setTimeout(() => playTone(784, 0.1, "sine", 0.1), 240);
|
||||
setTimeout(() => playTone(1047, 0.15, "sine", 0.12), 360);
|
||||
setTimeout(() => playTone(784, 0.08, "sine", 0.1), 520);
|
||||
setTimeout(() => playTone(1047, 0.3, "sine", 0.15), 620);
|
||||
}
|
||||
|
||||
// Alarm — loops until manually stopped
|
||||
let alarmInterval = null;
|
||||
function playAlarmTick() {
|
||||
playTone(880, 0.15, "square", 0.2);
|
||||
setTimeout(() => playTone(660, 0.15, "square", 0.2), 200);
|
||||
}
|
||||
function startAlarm() {
|
||||
if (alarmInterval) return;
|
||||
playAlarmTick();
|
||||
alarmInterval = setInterval(playAlarmTick, 500);
|
||||
}
|
||||
function stopAlarm() {
|
||||
if (alarmInterval) {
|
||||
clearInterval(alarmInterval);
|
||||
alarmInterval = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Play sound by name
|
||||
function playSoundByName(name) {
|
||||
if (name === "alarm") { startAlarm(); return; }
|
||||
const sounds = {
|
||||
chime: playChimeSound,
|
||||
alert: playAlertSound,
|
||||
@@ -314,6 +375,15 @@
|
||||
success: playSuccessSound,
|
||||
notify: playNotifySound,
|
||||
recovery: playRecoverySound,
|
||||
doorbell: playDoorbellSound,
|
||||
knock: playKnockSound,
|
||||
ding: playDingSound,
|
||||
blip: playBlipSound,
|
||||
siren: playSirenSound,
|
||||
tada: playTadaSound,
|
||||
ping: playPingSound,
|
||||
bubble: playBubbleSound,
|
||||
fanfare: playFanfareSound,
|
||||
};
|
||||
if (sounds[name]) {
|
||||
sounds[name]();
|
||||
@@ -333,6 +403,7 @@
|
||||
playSoundByName(customSound);
|
||||
lastCustomSound = customSound;
|
||||
} else if (!customSound) {
|
||||
stopAlarm(); // stop any looping alarm
|
||||
lastCustomSound = null;
|
||||
}
|
||||
|
||||
@@ -363,6 +434,7 @@
|
||||
|
||||
// Handle tap - enable sound and show reaction
|
||||
document.body.addEventListener("click", () => {
|
||||
stopAlarm(); // stop any looping alarm
|
||||
// Enable sound on first tap (browser autoplay policy)
|
||||
if (!soundEnabled) {
|
||||
soundEnabled = true;
|
||||
|
||||
Reference in New Issue
Block a user