im new to this. just made a two page soundboard. its working great. problem is that i would like to give the ability to save sounds 开发者_C百科as ringtones/notifications. no examples of how to do that in as3 are available. help please!
record a sound using : http://www.bytearray.org/?p=1858
encode to mp3 using : https://github.com/kikko/Shine-MP3-Encoder-on-AS3-Alchemy
save mp3 data to file as such :
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(); }
精彩评论