首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2ME开发 >

java如何创建或者MP3文件

2012-01-06 
java怎么创建或者MP3文件啊如题,不是读取mp3.是创建一个全新的mp3文件.因为我需要将一段文本变成mp3格式

java怎么创建或者MP3文件啊
如题,不是读取mp3.是创建一个全新的mp3文件.
因为我需要将一段'文本'变成mp3格式(如:把 '北京你好' 转成mp3播放),有没有什么开发组件支持啊?

下面这段似乎可以在nokia的手机上发音.但是 data的数据是怎么来的?用什么可以转换不?
com.nokia.mid.sound.Sound开发包在哪里下载


import javax.microedition.midlet.*;  
  import javax.microedition.lcdui.*;  
  import com.nokia.*;  
  import java.io.*;  
  import java.util.*;  
  import com.nokia.mid.sound.Sound;  
   
  public class soundplay extends MIDlet {  
  static soundplay instance;  
  private Sound ph[] = new Sound [4];  
  public void playsound() {  
   
  try {  
   
   
   
   
  byte[] data = {  
  (byte)0x02, (byte)0x4a, (byte)0x3a, (byte)0x40,  
  (byte)0x04, (byte)0x01, (byte)0x0f, (byte)0x18,  
  (byte)0x55, (byte)0x84, (byte)0x18, (byte)0x55,  
  (byte)0x85, (byte)0xd8, (byte)0x4d, (byte)0xa4,  
  (byte)0x20, (byte)0x83, (byte)0x4c, (byte)0x34,  
  (byte)0xc4, (byte)0x95, (byte)0x61, (byte)0x36,  
  (byte)0x15, (byte)0x61, (byte)0x76, (byte)0x13,  
  (byte)0x41, (byte)0x06, (byte)0x17, (byte)0x61,  
  (byte)0x86, (byte)0x17, (byte)0x61, (byte)0x38,  
  (byte)0x10, (byte)0x81, (byte)0x36, (byte)0x15,  
  (byte)0x69, (byte)0x06, (byte)0x10, (byte)0x81,  
  (byte)0x76, (byte)0x18, (byte)0x61, (byte)0x76,  
  (byte)0x13, (byte)0x81, (byte)0x08, (byte)0x13,  
  (byte)0x81, (byte)0x08, (byte)0x13, (byte)0x69,  
  (byte)0x5a, (byte)0x13, (byte)0xa1, (byte)0x26,  
  (byte)0x90, (byte)0x81, (byte)0x56, (byte)0x10,  
  (byte)0x61, (byte)0x56, (byte)0x17, (byte)0x61,  
  (byte)0x36, (byte)0x90, (byte)0x82, (byte)0x0d,  
  (byte)0x30, (byte)0xd3, (byte)0x12, (byte)0x55,  
  (byte)0x84, (byte)0xd8, (byte)0x55, (byte)0x85,  
  (byte)0xd8, (byte)0x4d, (byte)0x04, (byte)0x18,  
  (byte)0x5d, (byte)0x86, (byte)0x18, (byte)0x5d,  
  (byte)0x84, (byte)0xe0, (byte)0x42, (byte)0x04,  
  (byte)0xd8, (byte)0x55, (byte)0xa4, (byte)0x18,  
  (byte)0x42, (byte)0x05, (byte)0xd8, (byte)0x61,  


  (byte)0x85, (byte)0xd8, (byte)0x62, (byte)0x04,  
  (byte)0x20, (byte)0x6a, (byte)0x04, (byte)0x20,  
  (byte)0x69, (byte)0x08, (byte)0x34, (byte)0xc3,  
  (byte)0x8c, (byte)0x49, (byte)0x36, (byte)0x90,  
  (byte)0x81, (byte)0x56, (byte)0x17, (byte)0x61,  
  (byte)0xa6, (byte)0x90, (byte)0x81, (byte)0x76,  
  (byte)0x1a, (byte)0x61, (byte)0xc6, (byte)0x28,  
  (byte)0x93, (byte)0x12, (byte)0x71, (byte)0x86,  
  (byte)0x98, (byte)0x5d, (byte)0xa4, (byte)0x20,  
  (byte)0x55, (byte)0x85, (byte)0xd8, (byte)0x69,  
  (byte)0x85, (byte)0xda, (byte)0x42, (byte)0x05,  
  (byte)0xd8, (byte)0x55, (byte)0x85, (byte)0xd8,  
  (byte)0x55, (byte)0x84, (byte)0xd8, (byte)0x83,  
  (byte)0x44, (byte)0x20, (byte)0x83, (byte)0x4c,  
  (byte)0x38, (byte)0xc4, (byte)0x93, (byte)0x69,  
  (byte)0x08, (byte)0x15, (byte)0x61, (byte)0x76,  
  (byte)0x1a, (byte)0x69, (byte)0x08, (byte)0x17,  
  (byte)0x61, (byte)0xa6, (byte)0x1c, (byte)0x62,  
  (byte)0x89, (byte)0x31, (byte)0x27, (byte)0x18,  
  (byte)0x69, (byte)0x85, (byte)0xda, (byte)0x42,  
  (byte)0x05, (byte)0x58, (byte)0x5d, (byte)0x86,  
  (byte)0x98, (byte)0x5d, (byte)0xa4, (byte)0x20,  
  (byte)0x5d, (byte)0x85, (byte)0x58, (byte)0x5d,  
  (byte)0x85, (byte)0x58, (byte)0x4d, (byte)0x88,  
  (byte)0x34, (byte)0x40, (byte)0x00  
  };  
   
   
  ph[1] = new Sound(data,Sound.FORMAT_TONE );  
  //ph[2] = new Sound(data1,Sound.FORMAT_TONE );  
  //ph[3] = new Sound(data2,Sound.FORMAT_TONE );  
  ////byteArr.close();  
   
   
   
   
  //}  
  // din.close();  
  ph[1].play(1);  
  // ph[2].play(0);  
  // ph[3].play(0);  
  }  
  catch(Exception snde){  


  System.out.println("sound data read > Exception");  
  }  
   
  }  
   
  public soundplay() {  
  instance = this;  
  Display.getDisplay(this);  
  }  
   
  public void startApp() {  
  playsound();  
  }  
   
  public void pauseApp() {  
  }  
   
  public void destroyApp(boolean unconditional) {  
  }  
   
  public static void quitApp() {  
  instance.destroyApp(true);  
  instance.notifyDestroyed();  
  instance = null;  
  }  
   
  }  


[解决办法]
强悍的想法,期待高手………………
[解决办法]
这段数据估计是音乐文件的数据流,楼主可以自己调试一下。
http://hi.baidu.com/415556781/blog/item/a382a00112f6c8051c958379.html
这个网址内容可能会对你有帮助。

热点排行