如何在C#Xamamrin中将字符串和格式转换为Audio

时间:2015-11-09 14:31:28

标签: c# xamarin

在JSON响应中,

{
"audio_bytes": "IyFBTVIKPHxLb+hMacfM6meP90JAdIAAF/pDsVUEAABYEqAuNSA8bkx7OIxeEt4EfZiQe0I1Lq2kpvlW3ObkpIHTZRLg4Dx6SyTq5i4BvhEfCeXMpyzhiepROrvDsHoTTqUMhFTgPDhEmjhnvRP+EYFasegtHr2CR9eZnU/liW6ghERhETA8ek",
"audio_format": "wav"
}

(1)如何将这个字节串恢复为音频文件?

2 个答案:

答案 0 :(得分:0)

byte[] bytes = Convert.FromBase64String(base64);
File.WriteAllBytes("Message1.wav", bytes);

首先从字符串转换回字节数组,因为它的Base64字符串。 然后将其存档为格式为。

的文件

答案 1 :(得分:0)

您可以尝试:

var $= jQuery.noConflict();

(function($) {
    $(document).ready(function(){
        $("a#Wait-Times-Click").fancybox({
            'href'   : '#Wait-Times-Modal',
            'titleShow'  : false,
            'transitionIn'  : 'elastic',
            'transitionOut' : 'elastic',
            'beforeShow' : function(){
                $.ajax({
                    url: '/home/services/support-services/immediate-care/getWaitTimes',
                    context: this,
                    dataType: "json"
                }).done(function(data) {
                    $( "#Wait_Times" ).append("<strong>" + data[0].Name + ": </strong>" + data[0].WaitTime + "<br>");
                    $( "#Wait_Times" ).append("<strong>" + data[1].Name + ": </strong>" + data[1].WaitTime + "<br>");
                    $( "#Wait_Times" ).append("<strong>" + data[2].Name + ": </strong>" + data[2].WaitTime + "<br>");

                    $( "#Wait_Times_Alt" ).append("<strong>" + data[3].Name + " ER: </strong>" + data[3].WaitTime + "<br>");
                });
            },
            afterClose: function () {
                alert("you have closed fancybox");
            }
        });
    });
}(jQuery));