Hi all! I’m very happy to introduce an API that the Unity ecosystem has needed for years. If you’ve ever tried to record audio with Unity’s Microphone class, you have likely run into unfixable bugs, like stuttering and unbearable latency. Now, we have created an API from scratch so that you don’t have to face these issues any longer.
NatMic is a lightweight cross-platform microphone API for Unity. NatMic has support for iOS, Android, macOS, and Windows.
NatMic Features include:
Realtime low-latency recording, with microphone data being provided in a dedicated thread.
Configurable microphone sample rate and channel count.
Recorders. NatMic comes with a WAV recorder and AudioClip recorder.
Cross platform support for iOS, Android, macOS, Windows.
Yes! It will make NatCam complete. You can separate it into a new product. I bet there are many people that are willing to pay for this. If you google “Unity Read Mic data”, you will see many posts with no solution. Unity’s Mic API is extremely slow.
I do not own NatCam yet but the videos you made about them are awesome. What I need is a fast camera + audio API so that that I can read them and send them over network.
What this can be used for:
Online Game Voice Chat
WebCam Apps
Video(Front Camera) and Audio live calls
Waveform Visualization
Record Audio from the System Sound(Not just sound playing from Unity).
Record phone call
I see that the Asset store is full of Voice Chat plugins but those are crappy. Only looking for low access API to read from the Mic hardware.
NatMic API Structure:
API to read Mic data as byte array.
API to play the read data byte array.
API that reads the Mic and returns the data in a way that be used to construct a waveform.
The idea is to allocate memory once and re-use them. Usually the read function does not return an array but fills an array that is passed in then returns how many bytes there were filled in. This prevents memory allocation.
What I plan to do:
Read audio bytes with NatMic, send to network with TCP/UDP. Server. On my TCP/UDP client, read bytes from server then use NatMic to play received data. I will use other network protocol on WebGL. Hopefully that makes sense. It would be good if NatMic can be used in another Thread as this will improve performance over-all.
I plan to buy NatCam but since there is no audio plugin yet, I am worried that trying to implement my own audio plugin will conflict with NatCam on Android since I need to extend UnityPlayer. I will wait to see if NatMic will become a thing. Hopefully, it will.
If you have question, please don’t hesitate to ask.
One of the projects I’m working on is an online multiplayer VR game for PC that will need voice chat over Unity native multiplayer networking (UNet). If this NatMic would have a plugin that would that would easily integrate with UNet and instantly give me voice chat, then hell yes I would be all over this. I have no clue how to integrate voice chat for a PC VR game.
For my game I would be getting to the networking part in probably two months.
I really don’t care about UNet. Only care about reading and writing Mic data as fast as possible. Since UNet support has been requested, it looks like it will help many others who don’t know how to use TCP/UDP with another Thread.
One thing to know is that if you decide to support Unet is that there is LLAPI and HLAPI, use the Low level (transport layer) API. LLAPI deals with byte arrays and that makes it very fast. Although nothing beats direct TCP/UDP protocol in terms of performance so I won’t be using LLAPI for this unless for WebGL.
Just chiming in again to say that if you did include voice chat support, you would be one of the only working voice chat plugins on the unity asset store which would make your plugin pretty popular.
I’m looking now for a plugin and all the ones I find, the reviews either say doesn’t work in unity 5, not UNet compatible, or reviews saying it doesn’t work period.
Not necessarily. Exclusivity is not equal to prominence. We are still waiting and watching to see if there is a large-enough volume of developers that would want such a plugin.
Hi all. It’s almost a year after my last post. We’ve restarted the NatMic project since it has become a huge roadblock in our progress with some of our projects. We needed a reliable microphone API, and since there are no good options, we have decided to create one ourselves.
I will edit my first post at the top of this thread, and publish an article describing what we have planned. But to keep you without the suspense, NatMic 1.0 will natively support iOS, Android, Windows, and macOS (all have already been implemented). In the next release, we will add support for WebGL and possibly WinRT. NatMic 1.0 will also support mixing microphone audio with game audio (from an AudioSource or AudioListener). The API will be really simple, consisting of one callback that is provided with PCM audio data. Finally, NatMic will come with Recorders, which when given this audio data, will create an audio file. NatMic 1.0 will come with one recorder for recording waveform (WAV) files. In subsequent releases, we’ll be looking at adding recorders for M4A, OGG, and MP3.
Not yet. We are working on getting the iOS implementation finalized. Once we do this, we’ll be offering free beta access for a few weeks before releasing it.