我是新手。刚制作了两页音板。它的工作很棒。问题是我希望能够将声音保存为铃声/通知。没有关于如何在as3中执行此操作的示例。请帮助!
答案 0 :(得分:1)
使用以下内容录制声音:http://www.bytearray.org/?p=1858
使用以下代码编码为mp3:https://github.com/kikko/Shine-MP3-Encoder-on-AS3-Alchemy
将mp3数据保存到文件中:
private function saveFile()
{
// WRITE ID3 TAGS
var sba:ByteArray = mp3Encoder.mp3Data;
sba.position = sba.length - 128
sba.writeMultiByte("TAG", "iso-8859-1");
sba.writeMultiByte("Microphone Test 1-2, 1-2 "+String.fromCharCode(0), "iso-8859-1"); // Title
sba.writeMultiByte("jordansthings "+String.fromCharCode(0), "iso-8859-1"); // Artist
sba.writeMultiByte("Jordans Thingz Bop Volume 1 "+String.fromCharCode(0), "iso-8859-1"); // Album
sba.writeMultiByte("2010" + String.fromCharCode(0), "iso-8859-1"); // Year
sba.writeMultiByte("www.jordansthings.com " + String.fromCharCode(0), "iso-8859-1");// comments
sba.writeByte(57);
filePath = (File.applicationStorageDirectory.resolvePath("sound3.mp3")).url;
// get the native path
var wr:File = new File(filePath);
// create filestream
var stream:FileStream = new FileStream();
// open/create the file, set the filemode to write in order to save.
stream.open( wr , FileMode.WRITE);
// write your byteArray into the file.
stream.writeBytes ( sba, 0, sba.length );
// close the file.
stream.close();
}