Inception
zzarcon / microm Goto Github PK
View Code? Open in Web Editor NEW:musical_note: Beautiful library to convert browser microphone to mp3 in Javascript :musical_note:
Home Page: https://zzarcon.github.io/microm/
License: MIT License
:musical_note: Beautiful library to convert browser microphone to mp3 in Javascript :musical_note:
Home Page: https://zzarcon.github.io/microm/
License: MIT License
function start() {
microm.startRecording().then(function() {
console.log('recording...')
}).catch(function() {
console.log('error recording');
});
}
Seems like Microm
class doesn't have startRecording
method
Trying to re-play the audio don't work well
startRecording
stopRecording
pause
Pause current recorded audiogetMp3
Lazy mp3 encodinggetWav
dowload
Forces browser file downloadgetUrl
getBlob
getBuffer
getBase64
Get the base64 representation of the mp3 --> Use FileReader.readAsDataURL
hey, @zzarcon
Great library, any chance to update the npm package with the latest changes you made in the dist/ files?
Hi , i have a problem with recordings that are more than 1 min long , it takes a lot of time to compress in MP3 and on top of that , it blocks the thread (window freeze). i think the usage of web workers for this kind of job will be more suitable.
But i'm not really sure what blocks the thread, because before compression there's a "filereader" call with big chunks of data getting in, needs to investigate more, in the meantime if someone has a workaround for this, it will be a good help, Thanks
Cool library idea. I gave the demo a shot in OS X Chrome Version 47.0.2526.80 (64-bit) and recording didn't work. I see "error recording" in the console.
Ideas?
function forceDownload(){
console.log('forceDownload');
//var blob = new Blob(mp3Data, {type:'audio/mpeg'});
var url = (window.URL || window.webkitURL).createObjectURL(blob);
var link = window.document.createElement('a');
link.href = url;
link.download = 'output.mp3';
var click = document.createEvent("Event");
click.initEvent("click", true, true);
link.dispatchEvent(click);
}
Using same JS Audio event names.
var microm = new Microm();
microm.on('timeupdate', onTimeUpdate);
microm.on('ended', onEnded);
microm.startRecording();
Encode buffer depending on the recorded data channels:
ld = left.splice(i, i + maxSamples)
rd = right.splice(i, i + maxSamples)
mp3buf = mp3enc.encodeBuffer(ld, rd)
vs
mono = samples.splice(i, i + maxSamples)
mp3buf = mp3enc.encodeBuffer(mono)
Can you check. The demo and dist can't run on Firefox 48.
I have a music application where user can write & play music, I am wondering if I can use this library to record the music played by browser & export it. is it possible to do that using this library. Please help
Until I removed import 'babel-polyfill'
, I was encountering an obscure error during microm.stop()
.
I was able to avoid this problem by using babel's transform-runtime plugin instead of the babel- polyfill
(v6.9.1).
...
.transform(babelify, {
presets: ['react', 'es2015', 'stage-2'],
plugins: ['transform-runtime'] // use this instead of the babel-polyfill
})
...
Chrome 51.0.2704.103 (64-bit) OSX
This line in stop()
was blowing up:
self.buffer = new ArrayBuffer(view);
The Uncaught RangeError: Wrong length!
error was thrown from this code block:
(found somewhere in /node_modules/babel-polyfill/node_modules/core-js/modules/...
)
var validateArrayBufferArguments = function(that, length){
anInstance(that, $ArrayBuffer, ARRAY_BUFFER);
var numberLength = +length
, byteLength = toLength(numberLength);
if(numberLength != byteLength)throw RangeError(WRONG_LENGTH); // <<< ERROR here
return byteLength;
};
And the underlying problem began here:
$ArrayBuffer = function ArrayBuffer(length){
return new BaseBuffer(validateArrayBufferArguments(this, length));
};
In the return
line above, this
had a value of:
{
byteLength: [Exception: TypeError: Method ArrayBuffer.prototype.byteLength called on
incompatible receiver #<ArrayBuffer> at ArrayBuffer.get byteLength [as byteLength] (native)
at ArrayBuffer.remoteFunction (<anonymous>:3:14) at new ArrayBuffer
(http://localhost:3000/javascripts/app.min.js:2660:7) at
http://localhost:3000/javascripts/app.min.js:33323:28 at Worker.webWorker.onmessage
(http://localhost:3000/javascripts/app.min.js:33258:14)]
}
I was able to use the debugger and breakpoints to track the problem down to the babel polyfill. Commenting out this line solved the problem.
import 'babel-polyfill';
Most of package.json was omitted for brevity.
"dependencies": {
"babel": "^6.3.26",
"babelify": "^7.2.0",
"browserify": "^11.2.0",
"es6-promise": "^3.0.2",
"gulp": "^3.9.0",
"gulp-asset-manifest": "0.0.6",
"gulp-rename": "^1.2.2",
"gulp-rev": "^7.0.0",
"gulp-sass": "^2.0.4",
"gulp-uglify": "^1.5.3",
"isomorphic-fetch": "^2.2.0"
...
},
"devDependencies": {
"babel-eslint": "^4.1.5",
"babel-plugin-transform-regenerator": "^6.9.0",
"babel-polyfill": "^6.9.1",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-2": "^6.11.0",
...
}
Not working method .stop() in Mobile Safari (iPhone 6, iOS 12):
Example code:
var xAudioRec = new Microm();
....
$('.b-btn-stop', context).on('touchstart', function(){
xAudioRec.stop().then(function(result){
console.log('Success');
}).catch(function(){
console.log('Fail'); // — I get here.
});
});
Help me, pleace...
Hi,
I'm trying out this module. The recording works fine but the audio quality is not great. There's a lot of echo and pop noise. This is true for the demo app listed in readme as well. Is there a way to record better quality audio using this module?
Greeting. @zzarcon . I'am a graphic designer. I wanted to contribute to your project and I've designed a logo for your project. If you like it, I'll send you files and pr. what do you think? If you have an idea please share with me, it would be better for me. Thank you. Best Regard
Was the intent to have microm
be under a GPL compatible license of some sort? Could you post a license file if so?
How to stop Microm or destroy after recording, because recording icon on tab is not hiding..
I use Chrome 57 on Ubuntu 16
@zzarcon
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.