mozartec / capacitor-microphone

This Microphone API provides the ability to interact with the microphone and record Audio
MIT License
20 stars 9 forks source link

Live audio visualisation #24

Open SossenSystems opened 7 months ago

SossenSystems commented 7 months ago

Firstly I would like to say, really cool project, thanks for your fantastic work!

Is there a way to capture the data live while the microphone is recording without having to stop the recording first? I am interested in this because I would like to do some kind of audio visualisation, for example like in a WhatsApp voice message while recording.

Thank you very much in advance for your answer!

Mozart-Alkhateeb commented 7 months ago

Thanks, I tested WhatsApp on iOS and the Only thing I saw was a timer that starts when you start recording. can you give me info?

SossenSystems commented 7 months ago

Thanks, I tested WhatsApp on iOS and the Only thing I saw was a timer that starts when you start recording. can you give me info?

Yes, i also want to implement a timer, but it isn't a real problem because they are a lot of workarounds.

The biggest issue for me is like that:image So i want to create on recording a live sound wave. For me that means I have to be able to access the recording in real time (while recording) via some kind of event listener.

Mozart-Alkhateeb commented 7 months ago

Interesting, I will try to look into this during the weekend, if this is supported natively on iOS and Android we might be able to expose this though capacitor.

SossenSystems commented 7 months ago

Thank you so much! 😊

On the web, for example, there are many frameworks/plugins that make exactly this possible. The way a developer implements this in their Ionic Capacitor app should be left up to them. I think, the live stream from the microphone with data content alone would be enough to be able to build something like this.

Interestingly, someone has already tried something like this with your repo: https://github.com/simonschmalfeld/capacitor-microphone/commit/36bb2f9e9cdc2e532011fd9fe4c450de3f144aff

Edit:

This type would have great added value from every perspective, as the plugin could then be used in so many different areas of application. For example, to be able to develop a VoIP app like Discord or TeamSpeak for live communication.

SossenSystems commented 7 months ago

Any new news? @Mozart-Alkhateeb

Mozart-Alkhateeb commented 7 months ago

This is a little bit more complicated than I thought at least for android, haven't checked iOS yet.

I use Media Recorder for the underlying native implementation on Android, what you are asking for might require the usage of Audio Recorder (i.e rewriting most of the code) and you're still far from VoIP.

It is a feature that I might add and will be experimenting with in my freetime. If you need this for a project at this time, then you should be looking for a different plugin.

SossenSystems commented 7 months ago

Thank you for your answer and the work you put into this wonderful project in your free time. Ultimately, I just need the ability to listen to an event during a recording, which then streams the recording.