Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 101679f

Browse files
committed
Adjust some settings
1 parent 1419ac6 commit 101679f

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/components/views/voice_messages/LiveRecordingWaveform.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ export default class LiveRecordingWaveform extends React.PureComponent<IProps, I
4949
const bars = arrayFastResample(Array.from(update.waveform), DOWNSAMPLE_TARGET);
5050
this.setState({
5151
// The incoming data is between zero and one, but typically even screaming into a
52-
// microphone won't send you over 0.6, so we "cap" the graph at about 0.35 for a
52+
// microphone won't send you over 0.6, so we "cap" the graph at about 0.50 for a
5353
// point where the average user can still see feedback and be perceived as peaking
5454
// when talking "loudly".
5555
//
5656
// We multiply by 100 because the Waveform component wants values in 0-100 (percentages)
57-
heights: bars.map(b => percentageOf(b, 0, 0.35) * 100),
57+
heights: bars.map(b => percentageOf(b, 0, 0.50) * 100),
5858
});
5959
};
6060

src/voice/VoiceRecorder.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,9 @@ export class VoiceRecorder {
7373
// The size of the audio buffer largely decides how quickly we push timing/waveform data
7474
// out of this class. Smaller buffers mean we update more frequently as we can't hold as
7575
// many bytes. Larger buffers mean slower updates. For scale, 1024 gives us about 30Hz of
76-
// updates and 2048 gives us about 20Hz. We use 2048 because it updates frequently enough
77-
// to feel realtime (~20fps, which is what humans perceive as "realtime"). Must be a power
78-
// of 2.
79-
this.recorderProcessor = this.recorderContext.createScriptProcessor(2048, CHANNELS, CHANNELS);
76+
// updates and 2048 gives us about 20Hz. We use 1024 to get as close to perceived realtime
77+
// as possible. Must be a power of 2.
78+
this.recorderProcessor = this.recorderContext.createScriptProcessor(1024, CHANNELS, CHANNELS);
8079

8180
// Connect our inputs and outputs
8281
this.recorderSource.connect(this.recorderFFT);

0 commit comments

Comments
 (0)