채팅 "뽁" 세기 줄임: 귀를 때린다는 의견에 크기를 게임 소리의 90%→60%로 낮추고, 시작(attack)을 2ms→12ms로 부드럽게 해서 "탁" 튀는 느낌을 없앰. 음(380→1150Hz, 0.08초)·소리 크기 설정·몰림 한 번·지난 채팅 조용히는 그대로. feedback.test.ts 맞춤
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -67,19 +67,19 @@ beforeEach(() => {
|
|||||||
notes = [];
|
notes = [];
|
||||||
});
|
});
|
||||||
|
|
||||||
test('chat sound is 10% under the game sounds', () => {
|
test('chat sound is 60% of the game sounds', () => {
|
||||||
expect(GAME_LEVEL).toBe(0.15);
|
expect(GAME_LEVEL).toBe(0.15);
|
||||||
expect(CHAT_LEVEL).toBeCloseTo(GAME_LEVEL * 0.9, 10);
|
expect(CHAT_LEVEL).toBeCloseTo(GAME_LEVEL * 0.6, 10);
|
||||||
setVolume(100);
|
setVolume(100);
|
||||||
sounds.myTurn(); // a typical game sound at the usual level
|
sounds.myTurn(); // a typical game sound at the usual level
|
||||||
const game = Math.max(...notes.map((n) => n.peak));
|
const game = Math.max(...notes.map((n) => n.peak));
|
||||||
notes = [];
|
notes = [];
|
||||||
chatSound();
|
chatSound();
|
||||||
// Notes playing at the same moment add up; the loudest moment of the chat sound is 90% of a game sound.
|
// Notes playing at the same moment add up; the loudest moment of the chat sound is 60% of a game sound.
|
||||||
const byStart = new Map<number, number>();
|
const byStart = new Map<number, number>();
|
||||||
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.6, 6);
|
||||||
// One bubble ("뽁") gliding up from a low start.
|
// One bubble ("뽁") gliding up from a low start.
|
||||||
expect(notes.map((n) => n.freq)).toEqual([380]);
|
expect(notes.map((n) => n.freq)).toEqual([380]);
|
||||||
expect(notes.map((n) => n.to)).toEqual([1150]);
|
expect(notes.map((n) => n.to)).toEqual([1150]);
|
||||||
|
|||||||
@@ -190,21 +190,21 @@ export const sounds = {
|
|||||||
|
|
||||||
/** The usual level of a game sound at volume 100 (`tone`'s default). */
|
/** The usual level of a game sound at volume 100 (`tone`'s default). */
|
||||||
export const GAME_LEVEL = 0.15;
|
export const GAME_LEVEL = 0.15;
|
||||||
/** Chat sound: 10% under the game sounds (it follows the same volume setting). */
|
/** Chat sound: 60% of the game sounds (it follows the same volume setting); 90% hit the ears too hard. */
|
||||||
export const CHAT_LEVEL = GAME_LEVEL * 0.9;
|
export const CHAT_LEVEL = GAME_LEVEL * 0.6;
|
||||||
let lastChatAt = -Infinity;
|
let lastChatAt = -Infinity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chat "뽁": one water-drop bubble like a messenger, a sine gliding up fast from low (about 0.08 s).
|
* 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;
|
||||||
* it also starts lower and is shorter and softer than the game "pop" (700→1400 Hz).
|
* 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.
|
* It peaks at CHAT_LEVEL and fades in over 12 ms so it does not snap. 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, 80, 'sine', CHAT_LEVEL, 0, { attack: 2, slideTo: 1150 });
|
tone(380, 80, 'sine', CHAT_LEVEL, 0, { attack: 12, slideTo: 1150 });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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. */
|
||||||
|
|||||||
Reference in New Issue
Block a user