채팅 소리를 "한 번만 뽁"으로: 물방울 두 개 "뽀록"에서 첫 물방울 하나만(380→1150Hz로 빠르게 올라가는 사인, 0.08초). 게임 pop(700→1400Hz)보다 낮게 시작하고 짧고 작아서 구분됨. 크기(게임 소리의 90%)·소리 크기 설정·몰림 한 번·지난 채팅 조용히는 그대로. feedback.test.ts와 chat.e2e.ts 맞춤
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,9 +80,9 @@ test('chat sound is 10% under the game sounds', () => {
|
|||||||
for (const n of notes) byStart.set(n.start, (byStart.get(n.start) ?? 0) + n.peak);
|
for (const n of notes) byStart.set(n.start, (byStart.get(n.start) ?? 0) + n.peak);
|
||||||
const loudest = Math.max(...byStart.values());
|
const loudest = Math.max(...byStart.values());
|
||||||
expect(loudest).toBeCloseTo(game * 0.9, 6);
|
expect(loudest).toBeCloseTo(game * 0.9, 6);
|
||||||
// Two bubbles ("뽀록"), each gliding up from a low start.
|
// One bubble ("뽁") gliding up from a low start.
|
||||||
expect(notes.map((n) => n.freq)).toEqual([380, 520]);
|
expect(notes.map((n) => n.freq)).toEqual([380]);
|
||||||
expect(notes.map((n) => n.to)).toEqual([1150, 1500]);
|
expect(notes.map((n) => n.to)).toEqual([1150]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('chat sound follows the volume setting and is silent when sound is off', async () => {
|
test('chat sound follows the volume setting and is silent when sound is off', async () => {
|
||||||
|
|||||||
@@ -195,16 +195,16 @@ export const CHAT_LEVEL = GAME_LEVEL * 0.9;
|
|||||||
let lastChatAt = -Infinity;
|
let lastChatAt = -Infinity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chat "뽀록": two water-drop bubbles like a messenger, each a sine gliding up fast (about 0.15 s in all).
|
* Chat "뽁": one water-drop bubble like a messenger, a sine gliding up fast from low (about 0.08 s).
|
||||||
* Kept apart from the UI/game sounds, which are steady notes (click, good, myTurn …), so it is not mistaken for one.
|
* Kept apart from the UI/game sounds, which are steady notes (click, good, myTurn …), so it is not mistaken for one;
|
||||||
* The louder bubble peaks at CHAT_LEVEL. Lines arriving in a burst share one sound.
|
* it also starts lower and is shorter and softer than the game "pop" (700→1400 Hz).
|
||||||
|
* It peaks at CHAT_LEVEL. Lines arriving in a burst share one sound.
|
||||||
*/
|
*/
|
||||||
export function chatSound(): void {
|
export function chatSound(): void {
|
||||||
const now = performance.now();
|
const now = performance.now();
|
||||||
if (now - lastChatAt < 80) return;
|
if (now - lastChatAt < 80) return;
|
||||||
lastChatAt = now;
|
lastChatAt = now;
|
||||||
tone(380, 70, 'sine', CHAT_LEVEL, 0, { attack: 2, slideTo: 1150 });
|
tone(380, 80, 'sine', CHAT_LEVEL, 0, { attack: 2, slideTo: 1150 });
|
||||||
tone(520, 80, 'sine', CHAT_LEVEL * 0.7, 75, { attack: 2, slideTo: 1500 });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Plays the chat sound whenever `lastKey` (the newest live chat line) changes after the first render. */
|
/** Plays the chat sound whenever `lastKey` (the newest live chat line) changes after the first render. */
|
||||||
|
|||||||
@@ -242,8 +242,8 @@ try {
|
|||||||
if (await a.locator('.room-bar').getByRole('button', { name: /^채팅/ }).count()) throw new Error('chat button still on the wide bar');
|
if (await a.locator('.room-bar').getByRole('button', { name: /^채팅/ }).count()) throw new Error('chat button still on the wide bar');
|
||||||
});
|
});
|
||||||
|
|
||||||
await step('채팅 소리: 새 줄마다 "뽀록"(보낸 사람도), 다시 들어올 때 받는 지난 줄은 조용히', async () => {
|
await step('채팅 소리: 새 줄마다 "뽁"(보낸 사람도), 다시 들어올 때 받는 지난 줄은 조용히', async () => {
|
||||||
// Count the chat sound's first bubble (starts at 380 Hz) as it is scheduled.
|
// Count the chat sound's bubble (starts at 380 Hz) as it is scheduled.
|
||||||
const rec = () => {
|
const rec = () => {
|
||||||
const w = window as unknown as { __chatBeeps: number };
|
const w = window as unknown as { __chatBeeps: number };
|
||||||
w.__chatBeeps = 0;
|
w.__chatBeeps = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user