How to monitor microphone input level on MacOS? - macos

I am developing an application, which uses microphone. And I want to develop a functionality, allowing users to select microphone and to see input level. Something like you see in MacOS settings. I am able to read data from microphone with no problems, but I don't know how to get input level from this data. I googled a lot and only found some projects for Windows.

Related

Bluetooth Service Solicitation in Windows UWP

I am trying to connect to my iPhone and access services such as the battery level and ANCS from windows. I have tried out the Advertisement watcher and query but I feel as though they are really inconsistent. I am just using the code they provided in their updated documentation. I feel as though my results are extremely buggy. Devices show up multiple times and then become unreachable. It's almost as if past devices are never cleared from the cache (this may need to be something I do manually?) upon restarting my UWP in debug x86. I have briefly had success with the advertisement watcher and was even able to initiate pairing. Although when I read the battery level it was still not a number after using the data reader. I noticed that there were some service solicitation properties on the documentation but I could not figure out how to use them. Would these help and if so how could I use them? This might be useful when I try to connect to the ANCS of my iPhone.
Edit 1: After trying out the sample provided by Microsoft, I am still having a similar issue. I am able to see devices and even pair with them but when I click the connect button, it returns that there is a connection failure. In order to advertise to the BLE I am using the LightBlue app on my iPhone to advertise a virtual peripheral with the battery service added. My end goal is to connect to the iPhone directly and access some of its native BLE services and characteristics. I have heard that this can be done with something called service solicitation but have failed to successfully find any real examples of this being put into practice in a UWP (maybe it's not used anymore). I am still pretty new to BLE so I am trying to work out some of my fundamental misunderstandings of how it works so if there is something I am missing please let me know below!
BLE Failing to connect after pairing.
Edit 2: Ok after cleaning and re-building to fix some of my silly mistakes, I can now say that the example project is running as intended from what I can tell. The solution is actually pretty nice and I can see it is much more elegant than my implementation. However, I see that I am running into the same issue as before where the services of my virtual peripheral become undiscoverable after pairing and now result in a "Device Unreachable" exception in scenario 2. It seems as though Windows does not support "Resolvable Random Private Addresses." To elaborate, it does not provide my phone with an Identity Resolving Key (IRK) upon pairing with my iPhone 11 in order to keep track of its address. In order to access certain key characteristics, I need authorization.
Is there any way I can exchange an IRK upon pairing using the custom pairing capability or is there another method to provide authorization in order to access these characteristics on my iPhone? As it is, ANY and ALL GATT services present on the iPhone (virtual peripheral or native OS) become unreachable as soon as I successfully pair with the device. I am hoping it is possible to implement a solution in Windows as if not then communicating meaningful data between modern devices seems impossible with outdated privacy protocols.
I did a little bit of research and it is either the problem above or something to do with my Bluetooth device.
If I were to try to access characteristic without pairing
Edit 3: I have been able to get it to work briefly and it was wonderful. I used the system settings to pair and magically got the prompt on my phone to share notifications. From there, I had authorization/authentication and everything else I wanted to do was a breeze. Unfortunately, this does not seem to be reproducible as I have to randomly pair and unpair while starting and stopping the sample solution to get this prompt. I don't entirely remember what was happening when it popped up, but it does not seem easy to recreate. I thought that pairing would be my solution, but I am now stuck. When I pair with the device, I cannot access any services, but when I am unpaired, I can see all of the services and characteristics I need. However, when trying to subscribe to those characteristics I get "System.Exception: 'The attribute requires authentication before it can be read or written. (Exception from HRESULT: 0x80650005)'." Is there any way for me to request access to the notifications on my iPhone using something in the documentation? I need a reproducible way to request system notification access on my iPhone.

insert an application between microphone and other applications

To the best of my knowledge, this hasn't been asked or addressed before. Here is my question:
I am using Windows 8.1 and want to write an application that will work between the microphone and any other application that uses the microphone like Skype, Hangout .... I can further exemplify the the application in my mind as follows: For a very simple case I would like to add noise to the input of the microphone whether it is being used by Skype or Hangout or any voice recording app. You can think of any signal processing method to be a possible candidate for my application aside noise.
I have to make the microphone input go through my application whatever requests the usage of the microphone. I know this sounds like overwriting the microphone firmware but I would like to do it at the application level. It is almost like I want to redirect all the microphone input through my application and give the output of my application as the microphone source to all other microphone dependent applications.
Do you know of any way to do this or any similar application?
Thanks for the help!

What is [not] an audio endpoint?

Selectively quoting a blog piece entitled What's an audio endpoint by one of the chief architects of the post-XP Windows audio system:
an endpoint is a "piece of plastic" (hopefully with some wires in it) "to which users relate" such as "the microphone or headset connected to your laptop".
Which sounds great. Except that on every desktop machine I have ever used in the past 15 years, there has been a microphone AND a line-in input jack, and they exist (at least in my mind) with equal status. As a user, I strongly relate to "pieces of plastic" I connect to the line-in jack. They certainly look very much like an audio endpoint to me. The trouble is:
When I use IMMDeviceEnumerator and IMMDeviceCollction to discover the devices on my desktop machine, and use Microsoft's own example code to do so (e.g. the "CaptureSharedTimerDriven" audio sample in Microsoft's SDK) they only list the microphone as an endpoint.
So if my line-in jack is NOT an audio endpoint, what is it, how do I access it, set the volume on it, and so on? How can I make an application use it (exclusively) even when a user has selected the microphone as the default endpoint?
Partial (and perplexing) answer: it is possible for a microphone to be listed as an audio endpoint even when there is nothing connected to the microphone jack, but a line-in input might only be listed and confirm itself as a legitimate audio endpoint when there is a device physically connected to the line-in jack. This makes no obvious sense, but is nonetheless the way things are... at least on my machine.

Real-time audio record/playback from a Ruby web app

I am wondering if anyone has success with audio record (from microphone on the users browser) and playback from a web based app (Ruby/RoR)?
What I have found so far - I could write a flex/flash app which will record the audio and then have a server side like Red5 or so to receive and convert. This sounds more involved and I also saw different types of hosting issues etc people are having - so I am thinking there may be better/easier solutions out there!! I looked at html5/web-kit too but seems to only works on chrome and is limited to text fields etc.
In my app, i want to record users voice, save it on a aws/s3 as mp3 or similar file format and play it back to user within the app based on users input/choice. While flash based solution is workable for now, non-flash based solution will be preferred as it will support more devices (you know devices I am referring)..
The only options for web based record are Flash, Silverlight or Java. None of these will work on an iPhone or iPad - You will need a native app for that.
You don't need to use Red5 for Flash recording - you can record direct to memory, optionally encode (or zip), and then upload the the data. You might be better doing mp3 encoding server-side using ffmpeg or SoX before moving the file to s3.
There is a way using HTML5 and a server. Just record a video.
Convert the video to audio, then use the audio as you wish.
This implementation takes audio from a video and runs
ffmpeg to extract the audio:
http://goo.gl/A0bya
This is in PHP, but it should not be too
hard to create a Ruby version. Easy peasy.

Send data from WP7 phone to a near by phone via bluetooth or other mechanism

I'd interested in sending data from one WP7 to another WP7 phone so I could create 2 player games. If I understand correctly most WP7 will support bluetooth, but its not in the minimum spec, is this correct? What API's can I use to access the bluetooth, any good examples of this out there?
Unfortunately Microsoft don't provide any access to the bluetooth stack via any documented APIs in this version of the Dev tools.
They don't seem to have any sense of urgency about fixing this (or any of the many other missing features), so I wouldn't expect the situation to change any time soon.

Resources