igorski / MWEngine

Audio engine and DSP library for Android, written in C++ providing low latency performance within a musical context, while providing a Java/Kotlin API. Supports both OpenSL and AAudio.
MIT License
259 stars 45 forks source link

Unable to play saved audio #113

Closed syedateebvizz closed 3 years ago

syedateebvizz commented 4 years ago

I have tried to save my recording. it is saving a file but it is not playable. Please help Using this code to save file

_engine.setRecordingState(_isRecording, Environment.getExternalStorageDirectory().getAbsolutePath() + "/mwengine_output1.wav");

igorski commented 4 years ago

Hi.

Does the file have any meaningful length ? E.g. is it zero bytes, or 44 bytes (which means it is an empty file, but with a valid header), or anything above that (which means it has content, which can point is towards whether output is corrupted or not).

Does the recording as provided by the example Activity work ? Note that a recording is only saved once the recording state is unset. So toggle once to activate recording and toggle again when the recording should stop.

syedateeb1 commented 4 years ago

yes i'm using the example activity work and yes i do start and stop recording then check it. but it is saved as zero second audio. Yes it has some length in bytes

igorski commented 4 years ago

Is some length 44 bytes or a different value ?

Did you make any other changes to the example activity (the code snippet you posted has no "_/Downloads/" folder I noticed, hinting at change).

Are you recording the input from your device ?

Or are you recording the engine output ?

In both cases, do you have the handler for saveRecordedSnippet() in your engine notification listener ?

syedateeb1 commented 4 years ago

yes it is making 44 bytes

syedateeb1 commented 4 years ago

Run the app press start recording button . it starts recording it. when is stop the recording and go to my files play that audio it wont play and its size is 44 bytes.

This is the class i'm using https://github.com/igorski/MWEngine/blob/master/src/main/java/nl/igorski/example/MWEngineActivity.java

Screenshot_20200318_162119_nl igorski example_20200318_162140028

igorski commented 4 years ago

Hm, well that is no good :)

Thanks for the thorough examples, I'll have to delve into the driver swapping code to see if maybe a callback keeps lingering or something (it sounds like a buffer underrun).

Does this btw also occur when you launch the app without switching between the available drivers ?

syedateeb1 commented 4 years ago

Yes tried many scenarios. Still it is recording of 44b size of video

igorski commented 4 years ago

Wait a second, did you actually click "play" too? The sequencer must be running in order to record: https://github.com/igorski/MWEngine/wiki/Recording-and-bouncing-engine-output#recording-audio-on-the-fly

igorski commented 3 years ago

Closing as there has been no recent activity on this question, nor any similar reports.