" The request succeeds despite the warnings. reason) įinalAudio = new Blob(audioParts. The service currently accepts a single message per WebSocket connection. For Text to Speech for IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.Īllowable values: The default voice is en-US_MichaelV3Voice. */* - Specifies the default audio format: audio/ogg codecs=opus.audio/webm codecs=vorbis - You can optionally specify the rate of the audio.audio/webm codecs=opus - The service returns audio with a sampling rate of 48,000 Hz.The service returns audio with a sampling rate of 48,000 Hz. audio/webm - The service returns the audio in the opus codec.audio/wav - You can optionally specify the rate of the audio.audio/ogg codecs=vorbis - You can optionally specify the rate of the audio.If you specify a different value, the service returns an error. audio/ogg codecs=opus - You can optionally specify the rate of the audio.You can optionally specify the rate of the audio. audio/ogg - The service returns the audio in the vorbis codec.audio/mulaw - You must specify the rate of the audio.audio/mpeg - You can optionally specify the rate of the audio.audio/mp3 - You can optionally specify the rate of the audio.You can optionally specify the endianness of the audio. audio/l16 - You must specify the rate of the audio.audio/flac - You can optionally specify the rate of the audio.audio/basic - The service returns audio with a sampling rate of 8000 Hz.audio/alaw - You must specify the rate of the audio.Do what you need with the websocket after that. await clientWebSocket.ConnectAsync(connection, cts.Token) ĬlientWebSocket.ConnectAsync(connection, cts.Token).GetAwaiter().GetResult() Ĭonsole.WriteLine("Failed to connect: " + e.ToString()) Uri connection = new Uri($"wss:///speech-to-text/api/v1/recognize") Make the sure the following URL is that one IBM pointed you to Using (TextWriter tw = new StreamWriter(wr.GetRequestStream())) Wr.ContentType = "application/x-www-form-urlencoded" Var wr = (HttpWebRequest)WebRequest.Create("") I post the code here in case someone else needs it IamTokenData GetIAMToken(string apikey) With some help I finally found how to handle the WebSocket with the apiKey. I can get a token using HttpClient without problems.īut it looks like I cannot use that token with Websocket after that, only further HttpClient calls. Maybe I misread and I should pass a token instead of the password.īut then how do I get a token from my APIkey with websockets? I even saw somewhere that I could replace the username with "api" and the password by my apikey.īut that's not working as I get an Unauthorized error from the server. The IBM doc does not seem to be up to date either as their example are using CURL with username and password So I cannot find a way to added that example to use an api to get the token.Īny know how to use WebSocket with the IBM apikey for authentication? It looks like now IBM does not provide a username/password anymore. I am trying to use WebSocket to use the IBM Speech to Text API.īut I am having problems with the authentication part.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |