vue-advanced-chat
vue-advanced-chat copied to clipboard
Voice in voice note got heavy pitch as compare to original voice
Describe the bug
When we send a recorded voice note in the chat it got heavy pitch and voice is clearly diffrent from original voice..
Indeed the voice sounds a bit strange... I will check that
I cannot reproduce anymore... Do you still have the issue on your side?
Yes , you can test in the demo also
https://antoine92190.github.io/vue-advanced-chat/
There is still same pitch issue
On the demo, which room do you see the issue?
"Professor" and "dsds" both .... I have check my S3 bucket also the stored Audio pitch is high as compare to original voice.
I have the same issue on my side. I'm using vue2.
Can I use any configuration of bitrate or something as prop (audio-bit-rate
and/or audio-sample-rate
) that improve the audio performance? I'm new in this audio stuff...!
Thanks
I think the audio code is defective. We should find a better alternative to it. Anyone is welcome to work on that, otherwise I will try to fix it when I have time
diff --git a/src/utils/recorder.js b/src/utils/recorder.js
index 8f73995..535bfc9 100644
--- a/src/utils/recorder.js
+++ b/src/utils/recorder.js
@@ -44,10 +44,6 @@ export default class {
this.isPause = false
this.isRecording = true
-
- if (!this.lameEncoder) {
- this.lameEncoder = new Mp3Encoder(this.encoderOptions)
- }
}
stop() {
@@ -90,6 +86,20 @@ export default class {
this.processor = this.context.createScriptProcessor(this.bufferSize, 1, 1)
this.stream = stream
+ const sampleRate = stream.getAudioTracks()[0].getSettings().sampleRate
+
+ if (sampleRate !== this.encoderOptions.sampleRate) {
+ this.encoderOptions.sampleRate = stream
+ .getAudioTracks()[0]
+ .getSettings().sampleRate
+
+ this.lameEncoder = new Mp3Encoder(this.encoderOptions)
+ }
+
+ if (!this.lameEncoder) {
+ this.lameEncoder = new Mp3Encoder(this.encoderOptions)
+ }
+
this.processor.onaudioprocess = ev => {
const sample = ev.inputBuffer.getChannelData(0)
let sum = 0.0
For explanation, this actually uses the sampleRate of the microphone, not a fixed one.
@antoine92190 did you find the solution for this ?
I'm now also getting a deprecation error in the latest version of Chrome [Deprecation] The ScriptProcessorNode is deprecated. Use AudioWorkletNode instead.
And yes my audio pitch is also wrong.. it makes me sound like a chipmunk.
@antoine92190 any chance you will implement @TheNoim's fix?