Getting an error when inputting an audio file, in C# code?

-1

I am taking a look at this GitHub code sample: https://github.com/maliksahil/speakerrecognition/tree/master/CS/SpeakerRecognition/SpeakerRecognition and I see that when I tried to pass in my own .WAV file into the this line of code : string enrollmentResult = identificationHelper.CreateEnrollment(@"C:\Users\Sean\Desktop\audio\test.wav", testIdentificationProfileId).Result; in program.cs , it throws an error which is strange because, when I use the author's .WAV audio, it compiles and run fine, but when I input my own .WAV file, it throws an error such as this:

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> Flurl.Http.FlurlHttpException: Call failed with status code 400 (Bad Request): POST https://westus.api.cognitive.microsoft.com/spid/v1.0/identificationProfiles/18e3c497-b5d2-4c24-a89f-eea6c66c2388/enroll
   at Flurl.Http.FlurlRequest.<HandleExceptionAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Flurl.Http.FlurlRequest.<SendAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Flurl.Http.FlurlRequest.<SendAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at SpeakerRecognition.IdentificationHelper.<CreateEnrollment>d__2.MoveNext() in C:\Users\Sean\Desktop\VideoIndexerDemo\speakerrecognition-master\CS\SpeakerRecognition\SpeakerRecognition\IdentificationHelper.cs:line 41
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at SpeakerRecognition.MainClass.Main(String[] args) in C:\Users\Sean\Desktop\VideoIndexerDemo\speakerrecognition-master\CS\SpeakerRecognition\SpeakerRecognition\Program.cs:line 27

Inner Exception:

> FlurlHttpException: Call failed with status code 400 (Bad Request):
> POST
> https://westus.api.cognitive.microsoft.com/spid/v1.0/identificationProfiles/8ba89870-c422-4ef7-8255-5a239b8d1e8a/enroll

This exception was originally thrown at this call stack: Flurl.Http.FlurlRequest.HandleExceptionAsync(Flurl.Http.HttpCall, System.Exception, System.Threading.CancellationToken) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task) Flurl.Http.FlurlRequest.SendAsync(System.Net.Http.HttpMethod, System.Net.Http.HttpContent, System.Threading.CancellationToken, System.Net.Http.HttpCompletionOption) System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Flurl.Http.FlurlRequest.SendAsync(System.Net.Http.HttpMethod, System.Net.Http.HttpContent, System.Threading.CancellationToken, System.Net.Http.HttpCompletionOption) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.GetResult() ... [Call Stack Truncated]

Exception message on line 27 of Program.CS:

System.AggregateException HResult=0x80131500 Message=One or more errors occurred. Source=mscorlib StackTrace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result() at SpeakerRecognition.MainClass.Main(String[] args) in C:\Users\Sean\Desktop\VideoIndexerDemo\speakerrecognition-master\CS\SpeakerRecognition\SpeakerRecognition\Program.cs:line 27

This exception was originally thrown at this call stack: Flurl.Http.FlurlRequest.HandleExceptionAsync(Flurl.Http.HttpCall, System.Exception, System.Threading.CancellationToken) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task) Flurl.Http.FlurlRequest.SendAsync(System.Net.Http.HttpMethod, System.Net.Http.HttpContent, System.Threading.CancellationToken?, System.Net.Http.HttpCompletionOption) System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Flurl.Http.FlurlRequest.SendAsync(System.Net.Http.HttpMethod, System.Net.Http.HttpContent, System.Threading.CancellationToken?, System.Net.Http.HttpCompletionOption) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.GetResult() ... [Call Stack Truncated] Inner Exception 1: FlurlHttpException: Call failed with status code 400 (Bad Request): POST https://westus.api.cognitive.microsoft.com/spid/v1.0/identificationProfiles/18e3c497-b5d2-4c24-a89f-eea6c66c2388/enroll

How come the code compiles and runs fine if I use the authors audio file, but it doesn't work when I use my own Test.WAV audio file? Is there some setting that needs to be modified? I am not changing any code, just replacing their audio file with mine, and also updating the keys in config file with mine.

c#
asp.net
.net
flurl
asked on Stack Overflow Mar 3, 2020 by Sean • edited Mar 3, 2020 by Amy

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0