将Mp3转换为bytearray,将bytearray转换为mp3(反之亦然) [英] Convert Mp3 to bytearray and bytearray to mp3 (vice versa)

查看:190
本文介绍了将Mp3转换为bytearray,将bytearray转换为mp3(反之亦然)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello代码项目..

i将我的mp3文件转换为bytearray,我决定保存它,下次我想再将它转换为mp3。



尚未将我的mp3文件转换为bytearray,我正在使用此代码:



Hello code project..
i was converted my mp3 file to bytearray and i decided to save it and in the next time i want to convert it again to mp3.

yet to convert my mp3 file to bytearray, i am using this code :

Dim bString As New System.Text.StringBuilder
Dim bArray As Byte() = IO.File.ReadAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\a.mp3")
For Each b As Byte In bArray
    bString.Append(CInt(b))
Next
RichTextBox1.Text = bString.ToString





但是现在如何将RichTextBox1.Text中的bytearray再次转换为mp3文件?

i使用此代码但不起作用,创建了mp3文件但没有声音:(





but now how to convert bytearray in the RichTextBox1.Text to mp3 file again?
i am used this code but not work, mp3 file created but no sound :(

File.WriteAllText("C:\\a.mp3", RichTextBox1.Text)





谢谢



thank you

推荐答案

忘记字符串和文字!用非武装的眼睛看待解决方案:如果您使用 ReadAllBytes 来阅读,显然,您需要使用 WriteAllBytes 来编写:

http ://msdn.microsoft.com/en-us/library/system.io.file.writeallbytes%28v=vs.110%29.aspx [ ^ ]。



-SA
Forget string and text! The solution is seen with unarmed eye: if you used ReadAllBytes to read, apparently, you need to use WriteAllBytes to write:
http://msdn.microsoft.com/en-us/library/system.io.file.writeallbytes%28v=vs.110%29.aspx[^].

—SA


这篇关于将Mp3转换为bytearray,将bytearray转换为mp3(反之亦然)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆