Microsoft CognitiveServices Speech Audio not working - c#

Used the following link:
https://learn.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account?tabs=singleservice%2Cunix
to Create a Cognitive Services resource.
Then used:https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/get-started-speech-to-text?tabs=windowsinstall&pivots=programming-language-csharp
to get the code example to recognize from a microphone.
Included the Microsoft.CognitiveServices.Speech.Audio as NuGetPackae and everything worked fine on windows 10 with vs 2019.
Pushed the project up to GitHub and downloaded it onto my macBook and nothing is happening....No errors....nothing in call stack nothing...(apart from a message in the threads about cancelation token? but im not sure if this is an error or not??..when I say nothing is happening..the code runs and displays "Speak into your microphone" in the terminal...then after one second it closes and program ends
Does anyone know why it isnt working or what I can do to further test it. thanks
also to note microphone is working on macbook, have tested this, thanks
UPDATE
Have followed the instructions from:
https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/quickstart/csharp/dotnetcore/from-microphone
and still not working...
the problem is (please see two below images)
var result = await recognizer.RecognizeOnceAsync();
result.Text is returning "Hello how are you" in windows 10 with VS 2019,
however in BigSur 11.6 macbook with VS 2019 8.10.11 (build 8) it is returning "" does anyone know why? I cant understand why ios is returning 'NoMatch"

Related

How to deal with Xamarin.Essentials which Android 13 seems to have broken?

I want to send users who press a button in my Uno Platform (Xamarin) Android mobile app to a pre-populated email with the body and subject passed as a parameter, so as to automate the process of sending a report.
The app uses the MVVM pattern, the button in the View is bound to a command in the ViewModel which puts together some strings and tries to send them along with the user to their email app of choice. Nothing overtly complex.
Since Android 13 the following piece of code causes the app to consistently crash (which it didn't do earlier)
var message = new Xamarin.Essentials.EmailMessage
{
Subject = Report.SUBJECT,
Body = Report.DATA
To = new List<string> { Report.RECIPIENT }, // "example#example.com"
};
await Xamarin.Essentials.Email.ComposeAsync(message);
Stack trace yields the following
ApplicationActivity+<>c__DisplayClass29_0.<SetContentView>b__0 (System.Object s, Android.Views.View+ViewAttachedToWindowEventArgs e)
System.NullReferenceException: Object reference not set to an instance of an object
which is weird. The message is not null (seen in the debugger). Also, despite the app crashing, the message itself is correctly generated in the chosen email app (if I navigate there manually after my app crashed, that is)
Minimum Android version for the app is Android 9 (API level 28), target is 11 (API 30).
The newest .NET Core SDK is 6.0.101, and .NET Core Runtime is 6.0.1, as seen in the SDK manager.
I'm working in Visual Studio 2019 for Mac community edition version 8.10.22 (build 11)
How do I deal with this?
What I tried so far:
Replacing ComposeAsync with Launcher.OpenAsync results in the same failure.
var uri = $"mailto:{Report.RECIPIENT}?subject={Report.SUBJECT}&body={Report.DATA}";
await Xamarin.Essentials.Launcher.OpenAsync(uri);
In fact, even just going to some example website turns out to crash in the same way
var uri = "https://example.com";
await Xamarin.Essentials.Launcher.OpenAsync(uri);
Wrapping the whole method (regardless of launcher or email) in a try-catch statement fails to catch anything and app crashes nonetheless
private async void SendReport()
{
try
{
// Do the thing
}
catch (Exception ex)
{
// Some exception occurred
}
}
Elsewhere in the app, using a hyperlink button in the View (instead of a ViewModel method) surprisingly does work normally
<HyperlinkButton
NavigateUri="mailto:example#example.com">
<TextBlock Text="Contact via e-mail"/>
</HyperlinkButton>
which suggests that it is Xamarin.Essentials that isn't working for me, not just emails in Android.
I would much prefer solving the issue in the SendReport method in the ViewModel instead of resorting to that one weird trick that programmers hate (of switching to a hyperlink button in UI) to make it work.
Documentation about Android 13 behaviour changes to all apps doesn't seem to contain any changes of obvious relevance to this issue.
iOS in contrast works fine this time
This desperate attempt didn't work out of the box.
System.Diagnostics.Process.Start("http://www.c-sharpcorner.com/Default.aspx");
My environment is quite fragile which is why I'm highly hesitant to try updating anything as a rule

Selenium 4 Edge/Chrome Webdriver not working in C#

I have Edge version 107.0.1418.26 and Egde web driver version 107.0.1418.26 (chrome also has the correct versions). Selenium webdriver 4.5.1.
I had everything working a few weeks ago using chrome, I have revisited the project recently and everything has stopped working (reason for also trying Edge).
To restart at the basics I'm using the Microsoft example https://learn.microsoft.com/en-us/microsoft-edge/webdriver-chromium/?tabs=c-sharp and Selenium https://www.selenium.dev/documentation/
When I run:
var driver = new EdgeDriver();
try
{
driver.Url = "https://bing.com";
...
The webdriver console opens and initially says 'started successfully' but the c# code times out on the first line stating 'cannot start the driver service on http://localhost:55553'. I get a little more information with the Chrome test.
DevTools listening on ws://127.0.0.1:54097/devtools/browser/8e320eae-3f01-4ae2-9944-414ca8ad36e1
[23128:31564:1101/105231.394:ERROR:device_event_log_impl.cc(215)] [10:52:31.393] Bluetooth: bluetooth_adapter_winrt.cc:1074 Getting Default Adapter failed.
I don't know why it is trying bluetooth!
Initially I thought the problem to be a security issue over a remote desktop connection but I'm now in the office with the same issue. Something is niggling towards security but I can't find any further information or logs.
********** UPDATE *********
After vs2022 update, Java update and 4 reboots it now works again.
Can anyone come up with any reasons why it would just stop and cause the above problems? (the drivers were not left running in background). I'm very nervous to continue if I can't understand why errors are caused.
No true answer, however complete reboot (cold restart) then ensuring everythign os on the latest version worksfollowed by another reboot works evey time.

ExampleAssistantV1 with IBM Watson Unity SDK

I have attached the ExampleAssistantV1.cs script to a character in Unity and obtained my services credentials (API key and service URL) from the Assistant I have created.
From my dialog page, I can only see/get my Assistant Name and Assistant ID, but nothing like Workspace ID. I have searched around my bluemix pages and account details for the Assistant service, but cannot seem to find anything about Workspace. Where is this?
The version date when I used Tone Analyzer in Unity worked with the current date (yesterday) so I wonder if the same applies to Assistant? In the code comments, there is no explanation of what this date actually is...
When I run Unity, I get the following error. I could only find two threads on this; both are closed now on GitHub. Could someone please help me understand what I am missing?
[RESTConnector.ProcessRequestQueue()][ERROR] URL: https://gateway-lon.watsonplatform.net/assistant/api/v1/workspaces//message?version=2018-12-27, ErrorCode: 400, Error: 400 Bad Request, Response: {"error":"URL workspaceid parameter 'message' is not a valid GUID.","code":400}
After running in Unity, when I look at my service page, I see a new instance created with a unity-sdk-example-workspace-deleteUpdated message. How did I cause this? Have I done something wrong that this appears new?
If you click the three dots in the image above next to conversation assistant you can click View API Details. You should be able to see your Workspace ID there.
You supply the version date to select the version of the service you want to use in your application. You will be using the last service release on or before the version date supplied. If you use today's date you will be using the latest release of the service.
The issue with the the call is there is no workspaceId supplied. Ideally there should be a null check for this param. I've created an issue for this: https://github.com/watson-developer-cloud/unity-sdk/issues/490
As for the unity-sdk-example-workspace-deleteUpdated it look like you ran the AssistantV1 example. The example runs through each operation in the service and attempts to invoke it. In this case it looks like it failed to delete the workspace or the example was stopped before it was deleted. It is safe to delete this workspace/skill.

Xamarin barcode app Zxing.Net.Mobile not working

I followed this tutorial "https://github.com/Redth/ZXing.Net.Mobile" when I use Live Preview and pair it with my android device and try to hit scan button the code breaks and it gives error like "Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown".
The error is thrown on very first line.
var scanPage = new ZXingScannerPage();
I 'm new to this one and not sure how to solve, if possible please let me know any barcode code which reads as well as scan in Visual studio 2017.
So I have checked in the github as well, its clear from forum that live preview has issues related to System.Collections.Generic.KeyNotFoundException so either have device connected or install some emulator and check.

Using the MediaCapture API, StartRecordToStorageFileAsync fails to return and does not raise an error

I'm trying to use this MediaCapture API sample:
https://code.msdn.microsoft.com/windowsapps/Media-Capture-Sample-adf87622
but when I press Start Record to record to a file, this line never returns:
await m_mediaCaptureMgr.StartRecordToStorageFileAsync(recordProfile, m_recordStorageFile);
And no error is thrown. This computer is a Cyberpower PC. The sample DOES work on my other windows 10 computer (a mac mini) though. I thought maybe it was a codec issue but can't find any information on installing codecs so maybe that is not it--not sure. Thank you for any help or information.
Additional Info: Creating a profile like this works:
MediaEncodingProfile recordProfile = null;
recordProfile = MediaEncodingProfile.CreateWmv(Windows.Media.MediaProperties.VideoEncodingQuality.Auto);
But calling CreateMp4 instead of CreateWmv does not work.
My suspicion is that there's something wrong with your particular installation's encoders. If you can upgrade to Windows 10, with Visual Studio 2015 you can develop universal apps. The same code should work without an issue.

Categories

Resources