Code Monkey home page Code Monkey logo

microm's Introduction

zzarcon

Inception

microm's People

Contributors

adrianblynch avatar buzinas avatar dmdark avatar khornberg avatar mirzazulfan avatar zzarcon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microm's Issues

Misleading usage

function start() {
  microm.startRecording().then(function() {
    console.log('recording...')
  }).catch(function() {
    console.log('error recording');
  });
}

Seems like Microm class doesn't have startRecording method

Api

  • startRecording
  • stopRecording
  • pause Pause current recorded audio
  • getMp3 Lazy mp3 encoding
  • getWav
  • dowload Forces browser file download
  • getUrl
  • getBlob
  • getBuffer
  • getBase64 Get the base64 representation of the mp3 --> Use FileReader.readAsDataURL

Web worker usage

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

Demo doesn't work in Chrome 47

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?

Force dowload

 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);
    }

Event system

Using same JS Audio event names.

var microm = new Microm();

microm.on('timeupdate', onTimeUpdate);
microm.on('ended', onEnded);

microm.startRecording();

Support Mono & Stereo

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)

Incompatible with babel-polyfill

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).

Gulp build task (partial)

...
        .transform(babelify, {
            presets: ['react', 'es2015', 'stage-2'],
            plugins: ['transform-runtime']  // use this instead of the babel-polyfill
        })
...

Browser

Chrome 51.0.2704.103 (64-bit) OSX

Error details

screenshot

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)]
}

Other relevant files

index.js (partial)

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';

package.json (partial)

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)

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...

Better audio quality?

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?

Propose Logo/Icon

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
version 1

LICENSE file?

Was the intent to have microm be under a GPL compatible license of some sort? Could you post a license file if so?

Update dist/microm.js

I'm using the dist/microm.js file to integrate Microm in my JSF web application.

It doesn't seem to have the fix made for #24

Could you update dist/microm.js with #25 ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.