Comments (6)
I suspect is has something to do with the way libmp3lame.js encodes the WAV files and somehow along the way the buffer gets doubled, but I havenโt found any solution for this as of now.
from recordmp3js.
I'm experiencing this issue as well. Anyone have ideas?
from recordmp3js.
I'm also experiencing this issue as well. i hope it will be solved
from recordmp3js.
My solution:
First, in the file recordmp3.js
, function encode64
, divide len
by 2.
function encode64(buffer) {
var binary = '',
bytes = new Uint8Array( buffer ),
len = bytes.byteLength / 2; // <======= here
for (var i = 0; i < len; i++) {
binary += String.fromCharCode( bytes[ i ] );
}
return window.btoa( binary );
}
With that code, the MP3 preview is fixed.
Second, add the following function in recordmp3.js
// inspired from the interleave function in recorderWorker.js
function getHalfBuffer(buffer) {
var length = buffer.length / 2,
result = new Float32Array(length),
index = 0,
bufIndex = 0,
while (index < length) {
result[index++] = buffer[bufIndex];
bufIndex++;
}
return result;
}
And use it line 107:
var mp3Blob = new Blob([new Uint8Array(getHalfBuffer(e.data.buf))], {type: 'audio/mp3'});
With that code, the MP3 upload is fixed.
from recordmp3js.
This solution worked for me, thank you!
Only needed a minor change: missing semicolon, no big deal
function getHalfBuffer(buffer) {
var length = buffer.length / 2,
result = new Float32Array(length),
index = 0,
bufIndex = 0;
while (index < length) {
result[index++] = buffer[bufIndex];
bufIndex++;
}
return result;
}
from recordmp3js.
Hi everyone,
I made a fork here: https://github.com/roparz/Recordmp3js
I made some changes in the code:
- the old version was creating the mp3 file in three steps: capturing audio input, encoding input to wav and then transform the wav file to mp3. This new version bypass the wav encoding and transform directly the audio input to mp3. I didn't make performance tests but I can guess that the encoding is a little bit faster now.
- I also fixed the problem with the audio capture, the microphone input is not anymore sent to the speakers.
Hope this will help some of you.
from recordmp3js.
Related Issues (20)
- `exportWAV` is not re-entrant
- how to save the audio file in specific folder?
- Speakers echo microphone's sound HOT 3
- When recording audio on Firefox It does not work on Second recording
- conversion simultaneous to recording
- Sound deformation on windows
- The "Allow microphone" browser dialog
- Whats the difference between the recordmp3.js and js/recordmp3.js HOT 2
- Mp3 convert of a long record may results in a buffer over flow HOT 3
- Recordings folder is not created
- how to play recorded mp3 file
- getting Uncaught RangeError: Invalid array buffer length
- Can't seem te record more than 6 seconds HOT 2
- recording on 32kbps works in firefox Mac but not on Windows
- Mobile?
- demo not work
- Audio getting chopped off (Wrong project, Ignore) HOT 1
- How do you set the maximum record time?
- save audio HOT 1
- recordmp3.js:12 [Deprecation] The ScriptProcessorNode is deprecated. Use AudioWorkletNode instead. (https://bit.ly/audio-worklet)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from recordmp3js.