Azure Speech Recognition not detecting microphone SPXERR_MIC_NOT_FOUND - azure

I have a small sample application to test speech recog. It works in some machines but not in other machines. In my dev environment where I first installed the necessary packages, it all worked 100% with no issues. But, my team mates are unable to get it working with the installation of our software that has this code in it. We have mixed environments where in some cases we are using Remote Desktop with the application running on the remote machine (so with the device integration via RDP). And also locally without RDP. It does not detect the mic in both cases. Windows detects the mic. The recorder app works and testing all works so we know the mic is being recognized by windows.
However, the speech SDK does not recognize it.
I have tried 2 ways. First ,with using the FromDefaultMicrophoneInput But with that not working, i changed it to FromMicrophoneInput instead and specifed the microphone ID.
Using NAudio to enumerate the microphones, the mic is detected and listed:
var enumerator = new MMDeviceEnumerator();
string specifiedMicID = string.Empty;
foreach (var endpoint in
enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active))
{
if (endpoint.FriendlyName != this.MicName)
continue;
else
{
specifiedMicID = endpoint.ID;
break;
}
}
audioConfig = AudioConfig.FromMicrophoneInput(specifiedMicID);
But, when trying to instantiate the SpeechRecognizer with that audio config:
using (var recognizer = new SpeechRecognizer(config, audioConfig))
{
...
}
We get the SPXERR_MIC_NOT_FOUND. Even thought it is clearly there and working in all other cases in windows and with Naudio detecting it fine.
Any ideas what is going on here?
Thank youj.

Are you creating a UWP application? If so, you'll need to retrieve the audio device IDs differently:
var devices = await DeviceInformation.FindAllAsync(DeviceClass.AudioCapture);
foreach (var device in devices)
{
Console.WriteLine($"{device.Name}, {device.Id}\n");
}
Please refer to the documentation here for more information:
https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-select-audio-input-devices#audio-device-ids-on-uwp
If you're still having issues, we'd need to get the SDK logs to debug further. Instructions on how to turn on logging can be found here:
https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-use-logging

Related

UWP - Serial Port over bluetooth on Xamarin forms

I'm trying to connect to fiscal printer using serial port in xamarin.forms application.
I managed to make it work on android, but I have some troubles with UWP.
I am currently testing it on desktop if it matters.
await DeviceInformation.FindAllAsync() - this line never returns, no matter whether I call it with selector or not.
var sel = SerialDevice.GetDeviceSelector("COM7");
var coll = await DeviceInformation.FindAllAsync(sel);
It just hangs. Anybody knows how to use FindAllSync / has a similar problem? I've found some examples on the web, but they do not seem to work, the method always hangs for me.
I also tried to use a different approach and use devicewatcher, I was able to get the list of all devices and the bluetoothdevice object, however I couldn't create a serialport for it.

SSL based webserver on Windows IoT

I am working on a project which involves gathering some sensor data and build a GUI on it, with controlling of sensors. It has following two basic requirements.
Should be a web based solution (Although it will only be used on LAN or even same PC)
It should be executable on both windows IoT core and standard windows PC (Windows 7 and above)
I have decided to use Embedded webserver for Windows IoT, which seems to be a good embedded server based on PCL targeting .NET 4.5 and UWP. So I can execute it on both environments. That is great! But the problem is this web server doesn't support SSL, I have tried to search other servers and have come up with Restup for UWP, which is also a good REST based web server, but it also doesn't support SSL.
I needs an expert opinion, that if there is any possibility I can use SSL protocol in these web servers. Is it possible that it can be implemented using some libraries like OpenSSL etc? (Although I think that it would be too complex and much time taking to implement it correctly)
Edit
I would even like to know about ASP.NET core on Windows 10 IoT Core, if I can build an application for both windows. I found one example but it is DNXbased, and I don't want to follow this way, as DNX is deprecated.
Any help is highly appreciated.
Late answer, but .NET Core 2.0 looks promising with Kestrel. I successfully created a .Net Core 2.0 app on the PI 3 this morning. Pretty nifty and If you already have an Apache web server, you’re almost done. I’m actually going to embed (might not be the right term) my .Net Core 2.0 web application into a UWP app, rather than create multiple unique apps for the touchscreens around the house.
.Net Core 2.0 is still in preview though.
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?tabs=aspnetcore2x
I know this post is pretty old, but I have built the solution which you are asking bout. I’m currently running .Net 5.0 on a Raspberry pi. When you build the .net core web project, select the correct target framework and the target runtime to win-arm. Copy the output some directory on the pi and you will have to access the device using powershell to create a scheduled task to start the web project. Something like this:
schtasks /create /tn "Startup Web" /tr c:\startup.bat /sc onstart /ru SYSTEM
That starts a bat file which runs a powershell command which has the following command:
Set-Location C:\apps\vradWebServer\ .\VradTrackerWeb.exe (the .\VradTrackerWeb.exe is on a second line in the file) - the name of the webapp.
That starts the server. If you have any web or apps posting to the webserver you will need an ssl cert. I used no-ip and let’s encrypt for this. For let’s encrypt to work, you will need an external facing web server and have the domain name point to it. Run let’s encrypt on the external server and then copy out the cert and place it in your web directory on the pi. I then have a uwp program that runs on the pi and when it starts, it gets it’s local address and then updates no-ip with the local address, so the local devices communicating will be correctly routed and have the ssl cert. Side note, my uwp app is the startup app on the device. The scheduled task is important because it allows you to run you app and the web server. The following snip is how I get the ip address and then update no-ip.
private string GetLocalIP()
{
string localIP = "";
using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0))
{
socket.Connect("8.8.8.8", 65530);
IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint;
localIP = endPoint.Address.ToString();
}
return localIP;
}//GetLocalIP
private async void UpdateIP()
{
string localIP = "";
string msg = "";
var client = new HttpClient(new HttpClientHandler { Credentials = new NetworkCredential("YourUserName", "YourPassword") });
try
{
localIP = GetLocalIP();
string noipuri = "http://dynupdate.no-ip.com/nic/update?hostname=YourDoman.hopto.org&myip=" + localIP;
using (var response = await client.GetAsync(noipuri))
using (var content = response.Content)
{
msg= await content.ReadAsStringAsync();
}
if (msg.Contains("good") == true || msg.Contains("nochg")==true)
{
SentDynamicIP = true;
LastIPAddress = localIP;
}
else
{
SentDynamicIP = false;
}
}
catch(Exception ex)
{
string x = ex.Message;
}
finally
{
client.Dispose();
}
}//UpdateIP

How to programmatically open the Bluetooth settings in iOS 10

I'm trying to access the Bluetooth settings through my application using swift.how can access bluetooth setting?
Xcode version - 8.0
swift - 2.3
iOS - 10
func openBluetooth(){
let url = URL(string: "App-Prefs:root=Bluetooth") //for bluetooth setting
let app = UIApplication.shared
app.openURL(url!)
}
Swift 3.0: working up to iOS 10
Note: This URL is "private API". The app will be rejected by App Store reviewers if used.
You will not be able to use the solution by #Siddharth jain. The Problem: The app will be rejected by Apple with a warning that you should never use non-public APIs anymore. Otherwise, you could risk your developer program.
As far as I know, all you can do is open the iPhone settings in general (or get lead to your app settings if there are some. To do so you need the following code
guard let url = URL(string: UIApplication.openSettingsURLString) else {
// Handling errors that should not happen here
return
}
let app = UIApplication.shared
app.open(url)
By this, you will always get a URL you can use without any problems with apple review.
Until now you cannot access to bluetooth settings from your app from iOS 10.
you can see the following link to keep your mind at peace.
https://forums.developer.apple.com/message/146658#146658
Opening the Settings app from another app
Now that iOS 15 seemed to have broken auto-reconnect for known Bluetooth devices (other than audio gadgets), it's extremely annoying. If someone finds a solution, App Store-safe or not, I'm all ears.

Connect Wifi in MS Universal windows app?

We know an iOS app can connect to Wifi with CaptiveNetwork reference. As described in some related post: Connect WiFi Network via App.
Is there any similar library to help a Windows app to view exising wifi around and get connected?
Yes. There's the Windows.Devices.Wifi namespace. (Details here https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.wifi.aspx?f=255&MSPPError=-2147217396 )
It offers Methods to list networks and a method called ConnectAsync() to connect. I once coded a sample here (it also covers other stuff): https://github.com/DanielMeixner/w10demoking/blob/master/Windows10DemoKing/wifi.xaml.cs
The magic lines of code are
using Windows.Devices.WiFi;
// create network adatper instance (see sample code in link above) ...
var nw = nwAdapter.NetworkReport.AvailableNetworks.Where(y => y.Ssid.ToLower() == "myssid").FirstOrDefault();
await nwAdapter.ConnectAsync(nw, WiFiReconnectionKind.Automatic);

Connect local USB printer to work on azure website

I am a student and working on a project on my practice.
I have a database on Azure and my website that is connected to the database is also on Azure.
But now I want to print a POS-label from the website. The label I want to print is in code from Visual studio.
But when I try to print from the website it says: Settings to access printer are not valid.
How can I fix that? I have read that some people making a virtual machine on Azure and work from there.
I can't use javascript:Window.Print() because I don't want to print anything from the website, just from code.
var ps = new PrinterSettings();
ps.PrinterName = "Brother QL-500";
var size = new PaperSize("My Size", 2, 1);
ps.DefaultPageSettings.PaperSize = size;
recordDoc.PrinterSettings = ps;
recordDoc.Print();

Resources