c# - 将 byte[] 写成 mp3 文件

标签 c# .net mp3

这就是我正在做的,我读取了一个 .mp3 文件,以这种方式将其转换为 Base64String:

using (fileStream)
                    {

                        fileStreamLength = (int)fileStream.Length + 1;
                        fileInBytes = new byte[fileStreamLength];
                        int currbyte = 0, i = 0;

                        while (currbyte != -1)
                        {
                            currbyte = fileStream.ReadByte();
                            fileInBytes[i++] = (byte)currbyte;
                        }

                    }

                    string fileInString = Convert.ToBase64String(fileInBytes);

现在经过一些工作后,我再次拥有相同的 Base64String,我将通过 byte[] asBytesAgain = Convert.FromBase64String(fileInString); 将其转换为字节

现在我的问题是如何将这个 byte[] 写成要播放的 .mp3 文件?

最佳答案

File.WriteAllBytes("somefile.mp3", asBytesAgain);

关于c# - 将 byte[] 写成 mp3 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20552540/

相关文章:

swift - 使用 Swift 的 ID3 标签

C# 泛型下限约束 "where MySubClass : T"(java 的 "super")

c# - 使用 Atan2 时改变角度

c# - htmlagilitypack 提取电子邮件

c# - 使用退格符附加字符串时从文本文件中删除字符

c# - 如何在 Windows 商店应用程序 C# 中读取 mp3 文件的每分钟节拍数标签?

ios - AVaudioPlayer 不工作,mp3 位于编译包中

c# - 当 actionName 类似于 "/controllerName/action/"时,Html.ActionLink() 添加不需要的文件夹

c# - 通过 Gmail SMTP 发送电子邮件无限期挂起而没有错误

c# - 反编译的 DLL - 有助于判断它是 C# 还是 VB.NET 的线索?