{"id":951,"date":"2018-01-15T10:31:05","date_gmt":"2018-01-15T15:31:05","guid":{"rendered":"https:\/\/blogs.mathworks.com\/developer\/?p=951"},"modified":"2018-01-17T16:20:59","modified_gmt":"2018-01-17T21:20:59","slug":"leveraging-cloud-capabilities-from-matlab","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/developer\/2018\/01\/15\/leveraging-cloud-capabilities-from-matlab\/","title":{"rendered":"Leveraging cloud capabilities from MATLAB"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p>My day job involves using MATLAB analytics at the heart of big, powerful solution stacks both on the Cloud and running on-premise. The beauty of modern MATLAB as a part of the solution stack is that it offers an unparalleled environment to quickly develop and leverage various technologies to build complete solutions.<\/p><p>From an architecture perspective, the unique value proposition that MATLAB offers is that its <i>extensibility-by-design<\/i> enables me to choose the best-in-class technology products and services to construct my solution.<\/p><!--\/introduction--><p><b>Why MATLAB?<\/b><\/p><p>Let us ask MATLAB that question and exercise the well known function that provides succinct answers to nearly any question.<\/p><pre class=\"codeinput\">why\r\n<span class=\"comment\">% ans =<\/span>\r\n<span class=\"comment\">%<\/span>\r\n<span class=\"comment\">%    'Some tall and rich system manager knew it was a good idea.'<\/span>\r\n<\/pre><p>That funny bit of MATLAB functionality has been around since Cleve's MATLAB many <b>decades<\/b> ago (atleast as far back as 1987). In our current release (R2017b), the function will return an answer when requested much like the early versions. To replicate the trivial experiment, try typing <b>why<\/b> at your MATLAB command prompt.<\/p><p>We are now in 2018. We live in the age of the cloud. Conversational interfaces are appearing on many devices powered by cloud based services. It is a wonderful time to be alive when a personal assistant on your phone can tell you the time, give you directions, order your supplies and save you a trip to the grocery store.<\/p><p>MathWorks products have always played a critical role in accelerating the pace of discovery in science and technology. From <a href=\"https:\/\/www.mathworks.com\/company\/user_stories\/tc-helicon-advances-voice-processing-technology-with-matlab-and-simulink.html\" target=\"_blank\">prototyping signal processing algorithms<\/a> all the way to embedding the functionality in a final product, the MathWorks tools play a vital role in a product lifecycle from development all the way to production - Cloud based services are no exception.<\/p><p>I have written about <a href=\"https:\/\/blogs.mathworks.com\/developer\/2016\/07\/13\/build-a-product-build-a-service\/\" target=\"_blank\">exposing MATLAB functionality as a service<\/a> in the past but in this space, a demo is worth a thousand words, so to illustrate the point and answer the question, let us build our own cloud powered assistant - one that provides succinct answers to everything.<\/p><p><b>Building a service<\/b><\/p><p>As a first step, I will take the *why.m* file and modify it to provide a textual answer and expose it as a service on <a href=\"https:\/\/www.mathworks.com\/products\/matlab-production-server.html\" target=\"_blank\">MATLAB Production Server <\/a> running on the <a href=\"https:\/\/aws.amazon.com\/\" target=\"_blank\">Amazon Web Services<\/a> (AWS) public cloud. Go ahead and give it a try by clicking the button below.<\/p>\r\n\r\n<div id=\"textplayer\" style=\"border-radius: 10px;background: #F4F4F4;\">\r\n<div id=\"textcontainer\" style=\"padding-top:15px;padding-bottom:15px;padding-left:5px;padding-right:5px;\">\r\n<span id=\"typedstrings1\" style=\"font-size:14px;color:green;\"><\/span>\r\n<\/div>\r\n\r\n<br\/>\r\n<button style=\"  \r\n  background: #2f7eb2;\r\n  background-image: -webkit-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -moz-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -ms-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -o-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: linear-gradient(to bottom, #2f7eb2, #2980b9);\r\n  -webkit-border-radius: 28;\r\n  -moz-border-radius: 28;\r\n  border-radius: 10px;\r\n  font-family: Arial;\r\n  color: #FFFFFF;\r\n  font-size: 20px;\r\n  padding: 10px 20px 10px 20px;\r\n  text-decoration: none;\r\n\"\r\n  \r\nonClick=\"fetchAndDisplayText1();\r\n\"><span>\r\nWhy?<\/span><\/button> \r\n<\/div>\r\n\r\n<script>\r\nfunction fetchAndDisplayText1(){\r\n  $.ajax({\r\n    url:'https:\/\/mps17a.mwlab.io:9920\/polyglot\/why',\r\n    type:'POST',\r\n    data:JSON.stringify({rhs:[],nargout:1}),\r\n    contentType:'application\/json',\r\n    success:function(a){\r\n        $('#typedstrings1').text(a.lhs[0].mwdata);\r\n    }\r\n  });\r\n};\r\n<\/script>\r\n\r\n<br\/>\r\n<p>With a click of the button, you have exercised MATLAB code running on MATLAB Production Server. While amusing, it does not fully answer the question on why we would consider using MATLAB for this. To answer that, we look at the MATLAB community and realize the fact that <b>millions of MATLAB users don't all speak English<\/b>, do they? But on the other hand, I don't speak chinese, japanese, spanish, french, german or any of the many languages spoken by our users worldwide.<\/p><p>However, I do have the power of MATLAB at my fingertips and the power of cloud powered cognitive services at my disposal and that should be all I need.<\/p><pre class=\"language-matlab\">\r\n<span class=\"keyword\">function<\/span> str = translatedemo()\r\n<span class=\"comment\">% TRANSLATEDEMO Example to illustrate calling a cloud based webservice.<\/span>\r\n<span class=\"comment\">% Call the Microsoft Translation service running on Azure<\/span>\r\n\r\n<span class=\"comment\">%% Configure the credentials and initialize<\/span>\r\nauthKey = <span class=\"string\">\"059[REDACTED]c2f\"<\/span>;\r\nparam.from = <span class=\"string\">\"en\"<\/span>;\r\n\r\ntoArray = {<span class=\"string\">\"en\"<\/span>,<span class=\"string\">\"ja\"<\/span>,<span class=\"string\">\"es\"<\/span>, <span class=\"string\">\"zh-Hans\"<\/span>, <span class=\"string\">\"fr\"<\/span>, <span class=\"string\">\"de\"<\/span>};\r\nlangChoice = ceil(rand(1,1)*6);\r\nparam.to = toArray{langChoice};\r\n\r\nparam.text = why;\r\nqueryParams = matlab.net.QueryParameter(param);\r\n\r\n<span class=\"comment\">% Generate an answer<\/span>\r\ntextStr = why;\r\n\r\n<span class=\"comment\">% Get the text from our earlier example and translate it if required<\/span>\r\n<span class=\"keyword\">if<\/span> langChoice~=1\r\n    \r\n    translateService = matlab.net.URI(<span class=\"string\">'https:\/\/api.microsofttranslator.com\/v2\/Http.svc\/Translate'<\/span>, queryParams);\r\n    \r\n<span class=\"comment\">    %% Translate the output of our text generator<\/span>\r\n    <span class=\"comment\">% Create a HTTP request<\/span>\r\n    type = matlab.net.http.MediaType(<span class=\"string\">'application\/xml'<\/span>);\r\n    authField = matlab.net.http.field.GenericField(<span class=\"string\">'Ocp-Apim-Subscription-Key'<\/span>);\r\n    authField.Value = authKey;\r\n    acceptField = matlab.net.http.field.AcceptField(type);\r\n    translateRequest = matlab.net.http.RequestMessage(matlab.net.http.RequestMethod.GET, [authField, acceptField]);\r\n    \r\n    <span class=\"comment\">% Send the request and parse the response<\/span>\r\n    translateResponse = translateRequest.send(translateService);\r\n    str = char(translateResponse.Body.Data.getElementsByTagName(<span class=\"string\">'string'<\/span>).item(0).getTextContent());\r\n<span class=\"keyword\">else<\/span>\r\n    <span class=\"comment\">% There is no need to translate english<\/span>\r\n    str = textStr;\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<\/pre><p>With a few lines of code, I call a translation service from Microsoft running on their <a href=\"https:\/\/azure.microsoft.com\/en-us\/?v=18.01\" target=\"_blank\">Azure<\/a> Cloud Computing Platform and get a textual translation of my answer. A few more lines of logic allows me to randomize the output language for this demo. We have made our MATLAB code multi-lingual. Go ahead, and try it out - if the results are in a language you don't understand, please try it again as I randomize the outputs.<\/p>\r\n\r\n<div id=\"textplayer\" style=\"border-radius: 10px;background: #F4F4F4;\">\r\n<div id=\"textcontainer\" style=\"padding-top:15px;padding-bottom:15px;padding-left:5px;padding-right:5px;\">\r\n<span id=\"typedstrings2\" style=\"font-size:14px;color:green;\"><\/span>\r\n<\/div>\r\n\r\n<br\/>\r\n<button style=\"  \r\n  background: #2f7eb2;\r\n  background-image: -webkit-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -moz-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -ms-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -o-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: linear-gradient(to bottom, #2f7eb2, #2980b9);\r\n  -webkit-border-radius: 28;\r\n  -moz-border-radius: 28;\r\n  border-radius: 10px;\r\n  font-family: Arial;\r\n  color: #FFFFFF;\r\n  font-size: 20px;\r\n  padding: 10px 20px 10px 20px;\r\n  text-decoration: none;\r\n\"\r\n  \r\nonClick=\"fetchAndDisplayText2();\r\n\"><span>\r\nWhy?<\/span><\/button> \r\n<\/div>\r\n\r\n<script>\r\nfunction fetchAndDisplayText2(){\r\n  $.ajax({\r\n    url:'https:\/\/mps17a.mwlab.io:9920\/polyglot\/translatedemo',\r\n    type:'POST',\r\n    data:JSON.stringify({rhs:[],nargout:1}),\r\n    contentType:'application\/json',\r\n    success:function(a){\r\n        $('#typedstrings2').html(a.lhs[0].mwdata);\r\n    }\r\n  });\r\n};\r\n<\/script>\r\n\r\n<br\/>\r\n\r\n<p><b>Speak to me<\/b><\/p><p>Cloud powered services offer the capability to drive conversational interfaces. To further illustrate my point, I will use a Text-to-speech (TTS) technology from the same technology stack that powers Alexa. This is a service called <a href=\"https:\/\/aws.amazon.com\/polly\/\" target=\"_blank\">Amazon Polly<\/a> offered by the Amazon Web Services. With another simple API call, I can convert my output into a natural spoken voice in a multitude of languages and genders. Clicking the next button does exactly that (<i>please check your headphone \/ speakers \/ system volume first<\/i>).<\/p>\r\n\r\n<script src=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/wavesurfer.js\/1.4.0\/wavesurfer.min.js\"><\/script>\r\n\r\n<script type=\"text\/javascript\">\r\nvar context;\r\nvar buf;\r\n\r\nfunction initAudioContext()\r\n{\r\n  if (typeof context == 'undefined') {\r\n    if (!window.AudioContext) {\r\n      if (!window.webkitAudioContext) {\r\n        alert('Your browser does not support any AudioContext and cannot play back this audio.');\r\n        return;\r\n      }\r\n      window.AudioContext=window.webkitAudioContext;\r\n    }\r\n    context=new AudioContext();\r\n  }\r\n}\r\nfunction playByteArray(a){\r\n  var b=new ArrayBuffer(a.length);\r\n  var c=new Uint8Array(b);\r\n  for(i=0;i<a.length;i++){c[i]=a[i]};\r\n  context.decodeAudioData(b,function(d){buf=d;play()})\r\n};\r\nfunction play(){\r\n  var a=context.createBufferSource();\r\n  a.buffer=buf;\r\n  a.connect(context.destination);\r\n  a.start(0);\r\n};\r\nfunction fetchAndPlayData(){\r\n  $.ajax({\r\n    url:'https:\/\/mps17a.mwlab.io:9920\/polyglot\/audiodemo',\r\n    type:'POST',\r\n    data:JSON.stringify({rhs:[],nargout:2}),\r\n    contentType:'application\/json',\r\n    success:function(a){\r\n      playByteArray(a.lhs[1].mwdata);\r\n      var byteArray = new Uint8Array(a.lhs[1].mwdata);\r\n      var blob = new Blob([byteArray]);\r\n      wavesurfer1.loadBlob(blob);\r\n    }\r\n  });\r\n};\r\nfunction fetchAndPlayReverbData(){\r\n  $.ajax({\r\n    url:'https:\/\/mps17a.mwlab.io:9920\/polyglot\/reverbdemo',\r\n    type:'POST',\r\n    data:JSON.stringify({rhs:[],nargout:2}),\r\n    contentType:'application\/json',\r\n    success:function(a){\r\n      playByteArray(a.lhs[1].mwdata);\r\n      var byteArray = new Uint8Array(a.lhs[1].mwdata);\r\n      var blob = new Blob([byteArray]);\r\n      wavesurfer2.loadBlob(blob);\r\n    }\r\n  });\r\n};  \r\n<\/script>\r\n\r\n<div id=\"waveplayer\" style=\"border-radius: 10px;background: #F4F4F4;\">\r\n<div id=\"waveform1\"><\/div>\r\n\r\n<button style=\"  \r\n  background: #2f7eb2;\r\n  background-image: -webkit-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -moz-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -ms-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -o-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: linear-gradient(to bottom, #2f7eb2, #2980b9);\r\n  -webkit-border-radius: 28;\r\n  -moz-border-radius: 28;\r\n  border-radius: 10px;\r\n  font-family: Arial;\r\n  color: #FFFFFF;\r\n  font-size: 20px;\r\n  padding: 10px 20px 10px 20px;\r\n  text-decoration: none;\r\n\"\r\n  \r\nonClick=\"initAudioContext();fetchAndPlayData();\r\n\"><span>\r\nWhy?<\/span><\/button>\r\n<\/div>\r\n\r\n<script type=\"text\/javascript\">\r\nvar wavesurfer1 = WaveSurfer.create({\r\n    container: '#waveform1',\r\n    audioContext: context,\r\n    scrollParent: true, \r\n    normalize: true\r\n  });\r\nwavesurfer1.on('ready', function(){\r\n    wavesurfer1.play();\r\n});\r\n\r\n<\/script>\r\n<br\/>\r\n\r\n<p><b>MATLAB is your ally on the journey to the cloud<\/b><\/p><p>If you were clicking the buttons above, you have leveraged the power of two prominent public cloud services all from within a few lines MATLAB code that is also running on the cloud. MATLAB offers more than just prepackaged algorithms and APIs to do this. It is a platform optimized to enable you to develop and express your own algorithms.<\/p><p>To illustrate that point, answer our \"why\" question and complete our demo, I will integrate all of these cloud APIs with some audio signal processing.  My tool of choice for this is the <a href=\"https:\/\/www.mathworks.com\/products\/audio-system.html\" target=\"_blank\">Audio System Toolbox&#8482;<\/a> which provides  algorithms and tools for the design, simulation, and desktop prototyping of audio processing systems. It enables low-latency signal streaming from and to audio interfaces, interactive parameter tuning, and automatic generation of audio plugins for digital audio workstations. My objective is to make my cloud based system sound a bit more distinctive by adding some <a href=\"https:\/\/www.mathworks.com\/help\/audio\/ref\/reverberator-system-object.html\" target=\"_blank\">reverberation<\/a> through some simple signal processing. This takes no more than a few lines of MATLAB code. Please give it a try to test it out and see if you can spot the difference:<\/p><p>\r\n\r\n<p>\r\n<pre class=\"language-matlab\">\r\n<span class=\"comment\">% Setup a reverberator.<\/span>\r\nreverb = reverberator(<span class=\"string\">'PreDelay'<\/span>, 0, <span class=\"string\">'WetDryMix'<\/span>, 0.8,<span class=\"string\">'SampleRate'<\/span>, 22050);\r\noutput = reverb(signal);\r\n\r\n<\/pre>\r\n\r\n<\/p>\r\n\r\n<div id=\"waveplayer\" style=\"border-radius: 10px;background: #F4F4F4;\">\r\n<div id=\"waveform2\"><\/div>\r\n\r\n<button style=\"  \r\n  background: #2f7eb2;\r\n  background-image: -webkit-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -moz-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -ms-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: -o-linear-gradient(top, #2f7eb2, #2980b9);\r\n  background-image: linear-gradient(to bottom, #2f7eb2, #2980b9);\r\n  -webkit-border-radius: 28;\r\n  -moz-border-radius: 28;\r\n  border-radius: 10px;\r\n  font-family: Arial;\r\n  color: #FFFFFF;\r\n  font-size: 20px;\r\n  padding: 10px 20px 10px 20px;\r\n  text-decoration: none;\r\n\"\r\n  \r\nonClick=\"initAudioContext();fetchAndPlayReverbData();\r\n\"><span>\r\nWhy?<\/span><\/button>\r\n<\/div>\r\n\r\n<script type=\"text\/javascript\">\r\nvar wavesurfer2 = WaveSurfer.create({\r\n    container: '#waveform2',\r\n    audioContext: context,\r\n    scrollParent: true, \r\n    normalize: true\r\n  });\r\nwavesurfer2.on('ready', function(){\r\n    wavesurfer2.play();\r\n});\r\n\r\n<\/script>\r\n<br\/>\r\n<p>To conclude, MATLAB makes it simple to integrate the best-in-class algorithm designs with the variety of services to build full solutions. The demonstration polyglot talking bot operates right from within our blog post and illustrates a trivial example of building a cloud based voice powered service that provides an answer to nearly everything, tuned with some reverberation to sound the way we want it to. <\/p><p>The same principles permit me to build powerful real-world applications that harness the power of MATLAB signal\/video processing as well as analytics in real-world industrial, IoT, automotive, aerospace, financial applications.<\/p><p>The takeaway that I am trying to articulate here is that if your journey is headed to the cloud, MATLAB is your trusted friend and ally with technology and powerful time-tested workflows to support it.<\/p><p><i>P.S: I shall probably be turning off this demo in a few weeks to save operational cost.<\/i><\/p>\r\n\r\n\r\n<script language=\"JavaScript\"> <!-- \r\n    function grabCode_4cc83f5fe277441ea69147450bab2b9e() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='4cc83f5fe277441ea69147450bab2b9e ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 4cc83f5fe277441ea69147450bab2b9e';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2018 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_4cc83f5fe277441ea69147450bab2b9e()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2017b<br><\/p><\/div><!--\r\n4cc83f5fe277441ea69147450bab2b9e ##### SOURCE BEGIN #####\r\n%%\r\n% My day job involves using MATLAB analytics at the heart of big, powerful \r\n% solution stacks both on the Cloud and running on-premise. The beauty of\r\n% modern MATLAB as a part of the solution stack is that it offers an \r\n% unparalleled environment to quickly develop and leverage various \r\n% technology stacks to build complete solutions.\r\n% \r\n% From an architecture perspective, the unique value proposition that\r\n% MATLAB offers is that its extensibility-by-design enables me to choose \r\n% the best-in-class technology products and services to construct my solution.\r\n%\r\n%% \r\n% *Why MATLAB?*\r\n% \r\n% Let us ask MATLAB that question and exercise the well known function that\r\n% provides succinct answers to nearly any question.\r\n% \r\nwhy\r\n% ans = \r\n% \r\n%    'Some terrified and rich system manager knew it was a good idea.'\r\n\r\n%% \r\n% \r\n% That funny bit of MATLAB functionality has been around since Cleve's MATLAB many\r\n% *decades* ago (atleast as far back as 1987). In our current release (R2017b), the function will\r\n% return an answer when requested much like the early versions. To replicate \r\n% the trivial experiment, try typing *why* at your MATLAB command prompt.\r\n% \r\n%% \r\n% We are now in 2018. We live in the age of the compute in the cloud.\r\n% Conversational interfaces are appearing on many devices\r\n% powered by cloud based services. It is a wonderful time to be alive when\r\n% a personal assistant on your phone can tell you the time, give you directions, \r\n% order your supplies and save you a trip to the grocery store. \r\n% \r\n% MathWorks products have always played a critical role in accelerating the \r\n% pace of discovery in science and technology. From <https:\/\/www.mathworks.com\/company\/user_stories\/tc-helicon-advances-voice-processing-technology-with-matlab-and-simulink.html prototyping signal \r\n% processing algorithms> all the way to embedding the functionality in a final \r\n% product, the MathWorks tools play a vital role in a product lifecycle from\r\n% development all the way to production. \r\n% \r\n% Cloud based services are no exception. I have written about <https:\/\/blogs.mathworks.com\/developer\/2016\/07\/13\/build-a-product-build-a-service\/ exposing MATLAB functionality as a service> in the\r\n% past but in this space, a demo is worth a thousand words, so to illustrate the point\r\n% and answer the question, let us build our own cloud powered assistant that provides succinct answers to\r\n% everything. \r\n% \r\n%% \r\n% *Building a service*\r\n% \r\n% As a first step, I will take the why.m file and modify it to provide a\r\n% textual answer and expose it as a service on MATLAB Production Server\r\n% running on the AWS public cloud. Go ahead and give it a try by clicking \r\n% the button below.\r\n% \r\n% **Textual Demo**\r\n% \r\n% With a click of the button, you have exercised MATLAB code running on\r\n% MATLAB Production Server. While amusing, it does not fully answer the\r\n% question on why we would consider using MATLAB for this. To answer that,\r\n% we look at the MATLAB community and realize the fact that *millions of MATLAB \r\n% users don't all speak English*, do they? But on the other hand, I don't \r\n% speak chinese, japanese, spanish, french, german or any of the many languages \r\n% spoken by our users worldwide.\r\n% \r\n% However, I do have the power of MATLAB at my fingertips and the \r\n% power of cloud powered cognitive services at my disposal and that should be all I need.\r\n% \r\n% <include>translatedemo<\/include>\r\n% \r\n% With a few lines of code, I can call a translation service from\r\n% Microsoft running on their Azure Cloud Computing Platform and get a \r\n% textual translation of my answer. A few more lines of code and I can trivially \r\n% randomize the output language for this demo. We now have a made our\r\n% MATLAB code a true polyglot. Go ahead, and try it out - if the results\r\n% are in a language you don't understand, please try it again as I\r\n% randomize the outputs.\r\n% \r\n% **MULTILINGUAL WHY**\r\n% \r\n%% \r\n% **Speak to me**\r\n% \r\n% Cloud powered services offer the capability to drive conversational\r\n% interfaces. To further illustrate my point, I will use a Text-to-speech (TTS)\r\n% API technology from the same technology stack that powers Alexa. This is a service \r\n% called Polly offered by the Amazon Web Services. With another simple API\r\n% call, I can convert my output into a natural spoken output in a multitude\r\n% of languages. \r\n% \r\n% * SPEECH *\r\n% \r\n%% \r\n% *MATLAB is your ally on the journey to the cloud*\r\n% \r\n% If you were clicking the buttons above, we have leveraged the power\r\n% of two prominent public cloud services all from within a few lines MATLAB code\r\n% that is also running on the cloud. MATLAB offers more than just prepackaged\r\n% algorithms and APIs to do this. It is a platform optimized to enable you to\r\n% develop and express your own algorithms. \r\n% \r\n% To illustrate that point, answer our \"why\" question and complete our demo, \r\n% I will marry all of this with some audio signal processing to add a bit of \r\n% mystery to the cloud powered service. My tool of choice for this is the \r\n% Audio System Toolbox\u2122 which provides  algorithms and tools for the design, \r\n% simulation, and desktop prototyping of audio processing systems. \r\n% It enables low-latency signal streaming from \r\n% and to audio interfaces, interactive parameter tuning, and automatic \r\n% generation of audio plugins for digital audio workstations. My objective\r\n% is to make my cloud based system sound a bit more mysterious by adding\r\n% some <https:\/\/www.mathworks.com\/help\/audio\/ref\/reverberator-system-object.html reverberation>\r\n% through some audio signal processing to my service.\r\n% Once again, this takes no more than a few lines of MATLAB code:\r\n%\r\n%%\r\n% <html>\r\n% <pre>\r\n% % Setup a reverberator. \r\n% reverb = reverberator('PreDelay', 0, 'WetDryMix', 0.8,'SampleRate', 22050);\r\n% output = reverb(signal);\r\n% <\/pre>\r\n% <\/html>\r\n% \r\n% * MULTILINGUAL SPEECH REVERB *\r\n% \r\n% To conclude, one of the reasons that I, among many engineers worlwide, \r\n% love MATLAB is the fact that it is nearly trivial to integrate the \r\n% best-in-class algorithm design with the variety of services to build full solutions. \r\n% In this case we built a polyglot talking bot right from within our blog post. \r\n% \r\n% This demo illustrates a nearly trivial example of our polyglot cloud based \r\n% voice answering service that provides a solution to nearly everything from \r\n% the bottom of a hollow tube. \r\n% \r\n% In reality, the same principles permit me to build powerful \r\n% real-world applications that harness the power of MATLAB signal\r\n% processing to real-world industrial, IoT, financial and other data analytics solutions.\r\n% \r\n% The real takeaway here is that if your journey is headed to the cloud,\r\n% MATLAB is your trusted friend and ally on your journey with answers to\r\n% nearly everything. \r\n% \r\n% PS: I shall probably be turning off this demo in two weeks to save operational cost. \r\n\r\n##### SOURCE END ##### 4cc83f5fe277441ea69147450bab2b9e\r\n-->\r\n\r\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/developer\/files\/Selection_004.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><!--introduction--><p>My day job involves using MATLAB analytics at the heart of big, powerful solution stacks both on the Cloud and running on-premise. The beauty of modern MATLAB as a part of the solution stack is that it offers an unparalleled environment to quickly develop and leverage various technologies to build complete solutions.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/developer\/2018\/01\/15\/leveraging-cloud-capabilities-from-matlab\/\">read more >><\/a><\/p>","protected":false},"author":135,"featured_media":1352,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[22,17],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/951"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/users\/135"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/comments?post=951"}],"version-history":[{"count":129,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/951\/revisions"}],"predecessor-version":[{"id":1378,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/951\/revisions\/1378"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/media\/1352"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/media?parent=951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/categories?post=951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/tags?post=951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}