Java raw audio output

后端 未结 2 1155
醉话见心
醉话见心 2020-11-30 03:42

Just wondering if there is a library in Java like the module PyAudiere in Python, that simply allows you to create tones and play them, like this sample Python code:

2条回答
  •  无人及你
    2020-11-30 04:22

    If you ok with installing additional libs like Xuggler, you can use this shorter way, but it loads an external file - sure, you can also generate the soundpackets on the run. It's an fragment from the tutorials site. http://www.xuggle.com/xuggler/downloads/3.1.final.jsp

    IMediaReader reader = ToolFactory.makeReader("Your.MP3");
    IMediaViewer viewer = ToolFactory.makeViewer();
    reader.addListener(viewer);
    while (reader.readPacket() == null)
            ;
    

提交回复
热议问题