newventuresoftware / WaveformControl

Android Waveform control
236 stars 67 forks source link

Where's the part of recording ? #11

Closed AndroidDeveloperLB closed 6 years ago

AndroidDeveloperLB commented 6 years ago

I can't see that it actually records anything... To which file does it record? Where does it start and where does it stop recording?

yavor87 commented 6 years ago

Hey @AndroidDeveloperLB !

The recording is done in the RecordingThread and the playback -> PlaybackThread The sample app isn't recording actually, but rather collecting the samples from the microphone and creating a waveform to visualize them.

AndroidDeveloperLB commented 6 years ago

Well the naming is misleading, then. :( Can you please show how to record into various files types, using AudioRecord class ? I only know how to do it using MediaRecorder ... Is it possible to record into a file, while also having the visualizer? I've read that it's even possible to record from the visualizer itself, but that it has a very poor quality.

BTW, the reason I've visited this repository is to find workarounds of call recording, as I've written here . I was hoping to find some low level workaround, but so far I've failed.

yavor87 commented 6 years ago

Well, you are getting the samples in real time and you can do with them what you please. You can write them to a file if you want, but that will be an uncompressed file. You can create a wave header for it and use it as such. Just create a AudioDataReceivedListener and the RecordingThread will push data to it. Then just implement producer - consumer with the RecordingThread being the producer and write the samples to a file in your consumer.

Try this and I hope it helps you in your scenario.

AndroidDeveloperLB commented 6 years ago

Don't I need to investigate hot to encode to a known file format this way? Even the simplest one (WAV) has its own specifications...

Anyway, I get it that this sample isn't about it, so I close it.

yavor87 commented 6 years ago

The wave, as far as I know, is uncompressed. It only has a few bytes as header stating that this is a wave file and some other metadata, but the rest is just raw uncompressed data.

AndroidDeveloperLB commented 6 years ago

Can you please show how to do it, perhaps? Maybe using this library: https://github.com/google/oboe/ ?

yavor87 commented 6 years ago

I have done it manually using guides like this one: http://soundfile.sapp.org/doc/WaveFormat/ . I am not familiar with oboe and I can't help you much with it.

On Thu, Jun 28, 2018 at 1:09 AM AndroidDeveloperLB notifications@github.com wrote:

Can you please show how to do it, perhaps? Maybe using this library: https://github.com/google/oboe/ ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/newventuresoftware/WaveformControl/issues/11#issuecomment-400845023, or mute the thread https://github.com/notifications/unsubscribe-auth/AGoPNZm-rpOsRV2fe-NxSsMz_8oWD5asks5uBAKBgaJpZM4U1GRY .

AndroidDeveloperLB commented 6 years ago

OK thank you.