Giter Site home page Giter Site logo

omrecorder's People

Contributors

kailash09dabhi avatar ultraklon 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

omrecorder's Issues

Work well on emulator but does not work on device

@kailash09dabhi and @ultraklon Thanks for your great library. It work wells when I test on emulator.
But when install it to my Huawei Nexus 6P, It does not work well.

The recorded wav is much longer than the original input audio.

I look at the log, when on the device , the onAudioChunkPulled is called more often than in the emulator.
When on device, the onAudioChunkPulled is called more 10 times then in the emulator. Is that a reason for my problem?

Thanks!

Confused about wav header in WavHeader File

According to WaveFormat, Subchunk2Size is the actual sound data size, i.e. the pcm file size and ChunkSize is 36 + SubChunk2Size.
However, in your WavHeader File, Subchunk2Size is the sound data size minus 44.
So, I am confused about why you substract 44?

Subchunk2Size is correspond to totalAudioLen, ChunkSize is correspond to totalDataLen in your WavHeader File.

How to get getMaxAmplitude() for voice level

Hi Kailash,

how to use getMaxAmplitude() which is available for MediaRecorder class but how to acces this in your library.

And yes thanks for Pause/Resume feature :)

Thanks.

Invalid Audio Buffer Size

We've been using OmRecorder without issues for the past couple of weeks and received a few reports about a bad experience on API 16. Upon testing, we started receiving this error:

java.lang.IllegalArgumentException: Invalid audio buffer size.

We're following the steps and example, and don't have issues with API 18+. Any thoughts?

Getting this error `E/AudioRecord-JNI: Error -38 during AudioRecord native read` when start recording again in Android 10, can give a suggestion?

@kailash09dabhi

hey sir, just a quick question, I need to call for audioRecorder.release() when stop Recording, cause I also didnt ??

Cause I get this error E/AudioRecord-JNI: Error -38 during AudioRecord native read when start the recording again.

Behaviour now:

  • Start record : no problem
  • Stop record: no problem
    -Start again: no problem
    -Stop again: no problem
  • Start again: E/AudioRecord-JNI: Error -38 during AudioRecord native read

This happened nearly every time in Android 10 device.

I know this may cause by mic is using by another app, but in my testing, my phone is not record anything else when having error.

May be because of the recorder is not release when stop recording?? I have no single clue.

Please give me some hint..

Error when click on play button

I got the following error when I click on the play button

04-28 21:18:20.607 8935-8935/morpheus.oniri E/AndroidRuntime: FATAL EXCEPTION: main
                                                              Process: morpheus.oniri, PID: 8935
                                                              java.lang.NullPointerException: Attempt to invoke interface method 'void omrecorder.Recorder.startRecording()' on a null object reference
                                                                  at morpheus.oniri.activities.CarnetDeReve$1.onClick(CarnetDeReve.java:115)
                                                                  at android.view.View.performClick(View.java:4780)
                                                                  at android.view.View$PerformClick.run(View.java:19866)
                                                                  at android.os.Handler.handleCallback(Handler.java:739)
                                                                  at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                  at android.os.Looper.loop(Looper.java:135)
                                                                  at android.app.ActivityThread.main(ActivityThread.java:5254)
                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                  at java.lang.reflect.Method.invoke(Method.java:372)
                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

That happen when i click on the play button and below you can see the line where it says the error is.

        play.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                play.setBackgroundResource(R.drawable.ic_stop);
                recorder.startRecording();
            }
        });

stylish wav file content?

eg:

The first byte can be the current time,
The second byte can be the location,
Then it can be the Audio content.

Storing File in Internal Storage

Hi

Is it possible to store the WAV file on the private Internal storage allocated to the app...?

For example instead of using a File can one use the FileOutputStream ?

best,

b16a

Lossless Uncompressed Data

Hi,

Nice Library!

This may be a stupid question but just to confirm this is indeed lossless uncompressed voice data being stored in the WAV file...?

Many thanks,

b16a

startRecording

wavsetupRecorder();
recorder.startRecording();

E/AudioRecord: Could not get audio input for record source 1, sample rate 44100, format 0x1, channel mask 0x10, session 161, flags 0
E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -22.
E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
E/AndroidRuntime: FATAL EXCEPTION: Thread-367
                  Process: com PID: 3241
                  java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
                      at android.media.AudioRecord.startRecording(AudioRecord.java:885)
                      at omrecorder.PullTransport$AbstractPullTransport.preparedSourceToBePulled(PullTransport.java:89)
                      at omrecorder.PullTransport$AbstractPullTransport.start(PullTransport.java:70)
                      at omrecorder.AbstractRecorder$1.run(AbstractRecorder.java:29)
                      at java.lang.Thread.run(Thread.java:818)

Caused by: java.lang.IllegalArgumentException: Invalid audio buffer size -2 (frame size 2)

Caused by: java.lang.IllegalArgumentException: Invalid audio buffer size -2 (frame size 2)
at android.media.AudioRecord.audioBuffSizeCheck(AudioRecord.java:819)
at android.media.AudioRecord.(AudioRecord.java:397)
at android.media.AudioRecord.(AudioRecord.java:301)
at omrecorder.Source$Default.(Source.java:28)
at omrecorder.PullableSource$Default.(PullableSource.java:78)
at com.dancetime.WavRecorderActivity.mic(WavRecorderActivity.kt:121)
at com.dancetime.WavRecorderActivity.setupRecorder(WavRecorderActivity.kt:94)
at com.dancetime.WavRecorderActivity.onCreate(WavRecorderActivity.kt:44)

App crashes on Record Click

FileNotFound Exception arises on calling FIle() function , please do solve the problem quickly and thanks !

Record Pcm Audio

Hi kailash09dabhi. Thanks for your lib.
I have already use your lib to record .wav Audio. Its ok
But I do not know how can I record Pcm Audio file (.amr, .3gp?), the output file has data, but it can not play or read.
Here is my code:
recorder = OmRecorder.pcm(
new PullTransport.Default(RecorderUtil.getMic(source, channel, sampleRate)),
new File("path to my .amr file"));
Where is my wrong?

Issue about MaxAmplitude

Hi there, currently I'm using default MediaRecord.getMaxAmplitude() to draw canvas base on the amplitude received. My codes below:

`Runnable updateVisualizer = new Runnable() {
    @Override
    public void run() {
        // get the current amplitude
        int x = mRecorder.getMaxAmplitude();
        visualizerView.addAmplitude(x); // update the VisualizeView
        visualizerView.invalidate(); // refresh the VisualizerView

        // update in 40 milliseconds
        handler.postDelayed(this, 40);
    }
    };`

I run the handler above when recording is start, however, by using your library I have no idea how to implement such handler using the MaxAmplitude return by AudioChunk, please help.

Recording Wav/PCM last 1 second being missed in saved audio file

I am using the OmRecoder.pcm with 16KHZ sample rate and 16 bit PCM with skip silence options as default.

Sometimes i have noticed that the last 1 seconds in a 8-9 seconds total audio is missed when the wav file is saved.

Can u guide me whether I am doing anything wrong.
Regards,

could not build OutputStream from this file

Hi, I am getting could not build OutputStream from this file error on devices with android 5.1.1 and 8.0.0
it is from the private OutputStream outputStream(File file) method ,when starting recording

But when I copied the the method to my MainActivity, and called it whith exact same file(file name/directory), it didn't throw any error

Any idea what could be the problem?

This is the request not an issue

This library work like charm and also well maintained code.. But it would be great if you add Pause , Resume functionality.

agin this is not an issue but I posted here as I don't know where to give suggestion / request.

Thanks for this good library .

Oneplus 3t issue with broken wav files

As the title says i can start a recording but when i try to reproduce it, that seems to be a broken file, i've tried in every third party player and it is broken. i thought that was a permission problem but it doesn't seems to be that.
can you look for it?

how to add mp3 type

i dont know how to extend an mp3 type ,and there is is bug while recording over 8 hours ,it just only can record 2hours totaly ,but the audio file size is increase approximate 5.5Gb

Support M4A

Are there any chances to implement conversion from raw audio to m4a?

Problem while playing wav file in various devices.

Hi Kailash,
You did a fantastic job! Cheers for that. I am fan of your coding man.

Let me explain you what others are getting issue like mine.
In some devices like Moto G, Samsung on5 alomost that i have , i am able to play the WAV file that it creates after record.
but there are also many devices like LENOVO, MI note 3 which are not playing WAV file after recording finished.

I am using MediaPlayer API in order to play file.
If i am not wrong then it seems problem is in write header part. WAV header is not appropriate writing for those devices to understand.

Do have a look at the link below :

https://github.com/roman10/roman10-android-tutorial/blob/master/AndroidWaveRecorder/src/roman10/tutorial/androidwaverecorder/WavAudioRecorder.java

This recorder demo works for all devices like LENOVO , MI etc.

Althrough VLC player and MX player both are able to play WAV file recorded by OM recorder in LEVENO , MI .

Hope this will help you to understand the issue with it.

Not record the voice in many devices

I am using this library in my project but many users contact me every day saying that own devices cannot record the voice. Why ? Are there android devices that can't record WAV format ?
One of these is for example Asus zenfone 2

Don't understand README

recorder = OmRecorder.wav( new PullTransport.Default(mic(), new PullTransport.OnAudioChunkPulledListener() { @Override public void onAudioChunkPulled(AudioChunk audioChunk) { animateVoice((float) (audioChunk.maxAmplitude() / 200.0)); } }), file());
What should be in animateVoice() method? i don't see any implementation of it!

Android 6

When i record to 3 times , My app froze but it's not crashed. It is working great in android 5. Please check and fixed it.

File gets corrupted , Renaming mp3 file after recording

Hi,
I am trying to rename the file after it is recorded by Omrecorder , suppose Omrecorder recorder file was "temp-file.mp3" after recording I want it to be meaningful so i change it to "new-recording-code-001.mp3".
To rename I wrote this piece of code:

public static boolean renameFile(String fromFilePathWithExt,String toFilePathWithExt){
        LogUtils.d("from: "+fromFilePathWithExt);
        LogUtils.d("to: "+toFilePathWithExt);
        File dir = Environment.getExternalStorageDirectory();
        if(dir.exists()){
            File from = new File(fromFilePathWithExt);
            File to = new File(toFilePathWithExt);
            if(from.exists()) {
                return from.renameTo(to);
            }
        }
        return false;
    }

This function is working and it renames the file and returns true , but after changing the filename, FILE GETS CORRUPTED AND DOES NOT PLAY.

Am I doing something wrong? or this is library bug.

PullTransport

I recently got this log in one of our apps and wanted to reach out. It was a Motorola 6 that it's from.

Fatal Exception: java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
       at android.media.AudioRecord.startRecording(AudioRecord.java:894)
       at omrecorder.PullTransport$AbstractPullTransport.preparedSourceToBePulled(PullTransport.java:89)
       at omrecorder.PullTransport$AbstractPullTransport.start(PullTransport.java:70)
       at omrecorder.AbstractRecorder$1.run(AbstractRecorder.java:29)
       at java.lang.Thread.run(Thread.java:818)

Pull Transport Unintialized Audio Recorder

Still receiving this error, even after confirming users have Recording permissions enabled on their device. Seeing issues on 4.4.2 - 7.1 and wanted to reopen this.

Fatal Exception: java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
       at android.media.AudioRecord.startRecording(AudioRecord.java:894)
       at omrecorder.PullTransport$AbstractPullTransport.preparedSourceToBePulled(PullTransport.java:89)
       at omrecorder.PullTransport$AbstractPullTransport.start(PullTransport.java:70)
       at omrecorder.AbstractRecorder$1.run(AbstractRecorder.java:29)
       at java.lang.Thread.run(Thread.java:818)

stop() called on an uninitialized AudioRecord.

Hi,
I am using this library and when I am recording second time and stopping, I am getting below error. Please suggest.
Thank You.

Error is

java.lang.IllegalStateException: stop() called on an uninitialized AudioRecord.

**Code to start and stop **

`View.OnTouchListener touchListener = new View.OnTouchListener() {
@OverRide
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (permissionToRecordAccepted && permissionToReadExternalStorage && permissionToWriteExternalStorage) {

                //startPulseAnimation();
                timerTextView.setVisibility(View.VISIBLE);
                countDownTimer.start();
                recorder.startRecording();
            }


        } else if (event.getAction() == MotionEvent.ACTION_UP) {

            timerTextView.setVisibility(View.INVISIBLE);
            countDownTimer.cancel();
            try {
                recorder.stopRecording(); // Here I am getting error.
                if (!TextUtils.isEmpty(mVerificationId)) {
                    mPresenter.configureVoice(mVerificationId, Utility.getDeviceId(), file().getPath(), audioBytes);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        return true;
    }
}`

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.