Adjust some settings
This commit is contained in:
parent
1419ac6b69
commit
101679f647
2 changed files with 5 additions and 6 deletions
|
@ -49,12 +49,12 @@ export default class LiveRecordingWaveform extends React.PureComponent<IProps, I
|
||||||
const bars = arrayFastResample(Array.from(update.waveform), DOWNSAMPLE_TARGET);
|
const bars = arrayFastResample(Array.from(update.waveform), DOWNSAMPLE_TARGET);
|
||||||
this.setState({
|
this.setState({
|
||||||
// The incoming data is between zero and one, but typically even screaming into a
|
// The incoming data is between zero and one, but typically even screaming into a
|
||||||
// microphone won't send you over 0.6, so we "cap" the graph at about 0.35 for a
|
// microphone won't send you over 0.6, so we "cap" the graph at about 0.50 for a
|
||||||
// point where the average user can still see feedback and be perceived as peaking
|
// point where the average user can still see feedback and be perceived as peaking
|
||||||
// when talking "loudly".
|
// when talking "loudly".
|
||||||
//
|
//
|
||||||
// We multiply by 100 because the Waveform component wants values in 0-100 (percentages)
|
// We multiply by 100 because the Waveform component wants values in 0-100 (percentages)
|
||||||
heights: bars.map(b => percentageOf(b, 0, 0.35) * 100),
|
heights: bars.map(b => percentageOf(b, 0, 0.50) * 100),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -73,10 +73,9 @@ export class VoiceRecorder {
|
||||||
// The size of the audio buffer largely decides how quickly we push timing/waveform data
|
// The size of the audio buffer largely decides how quickly we push timing/waveform data
|
||||||
// out of this class. Smaller buffers mean we update more frequently as we can't hold as
|
// out of this class. Smaller buffers mean we update more frequently as we can't hold as
|
||||||
// many bytes. Larger buffers mean slower updates. For scale, 1024 gives us about 30Hz of
|
// many bytes. Larger buffers mean slower updates. For scale, 1024 gives us about 30Hz of
|
||||||
// updates and 2048 gives us about 20Hz. We use 2048 because it updates frequently enough
|
// updates and 2048 gives us about 20Hz. We use 1024 to get as close to perceived realtime
|
||||||
// to feel realtime (~20fps, which is what humans perceive as "realtime"). Must be a power
|
// as possible. Must be a power of 2.
|
||||||
// of 2.
|
this.recorderProcessor = this.recorderContext.createScriptProcessor(1024, CHANNELS, CHANNELS);
|
||||||
this.recorderProcessor = this.recorderContext.createScriptProcessor(2048, CHANNELS, CHANNELS);
|
|
||||||
|
|
||||||
// Connect our inputs and outputs
|
// Connect our inputs and outputs
|
||||||
this.recorderSource.connect(this.recorderFFT);
|
this.recorderSource.connect(this.recorderFFT);
|
||||||
|
|
Loading…
Reference in a new issue