简体   繁体   English

有没有办法将 JavaFX AudioClip 声音的多线程混合结果记录到磁盘?

[英]Is there a way to record multi-threaded the mixed result of JavaFX AudioClip sounds to disk?

My program launchs an arbitrary number of sounds streamed from FreeSound.org and plays them using javafx.scene.media AudioClip instances.我的程序启动从 FreeSound.org 流式传输的任意数量的声音,并使用 javafx.scene.media AudioClip 实例播放它们。

I was trying to figure out whether it could be possible to capture the generated output to disk, from within the same program?我试图弄清楚是否可以从同一个程序中将生成的输出捕获到磁盘? Any pointers?任何指针?

Instead of using AudioClip you could use SourceDataLine for playback.您可以使用SourceDataLine进行播放,而不是使用AudioClip This class allows you to progressively read the audio data, exposing it for handling.此类允许您逐步读取音频数据,将其公开以进行处理。 You would have to decode from bytes to PCM for each incoming line, then add the PCM from all the lines to be merged, and recode that back to bytes for your output.您必须为每条传入线路从字节解码为 PCM,然后从要合并的所有线路中添加 PCM,并将其重新编码为字节以供输出。

I suspect with a little minor tweaking you could get the library I wrote AudioCue to work for you.我怀疑只要稍微调整一下,您就可以让我编写的AudioCue库为您工作。 It has an optional mixer that will handle multiple cue inputs.它有一个可选的混音器,可以处理多个提示输入。 The inputs make use of SourceDataLine and the mixer uses the logic I described.输入使用SourceDataLine ,而混合器使用我描述的逻辑。 You would have to tweak the code to output to disk.您必须调整代码以输出到磁盘。 I could probably help with that if this project is still live for you.如果这个项目仍然为您服务,我可能会提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM