gpt4 book ai didi

java - Java内置的声音框架中,一个音源流可以有多个消费者吗?

转载 作者:行者123 更新时间:2023-11-30 11:03:38 25 4
gpt4 key购买 nike

有没有一种简单的方法可以让多个独立的、并发的消费者使用 Java 的内置音频框架 (javax.sound.sampled.*)?因为我正在使用音频处理库 TarsosDSP无论如何,它可以帮助解决这个问题吗?还是我需要实现自己的混音器?

我现在的问题是,我想

  1. 使用 TarsosDSP 处理来自麦克风输入的音频流(在其他分析中得出频谱图)和
  2. 记录该流的片段以将语音转录为文本,这可能需要观察自动激活的音量阈值。

最佳答案

我找到了 some information ,这部分回答了我的问题:

1.3.2. How can I get more than one TargetDataLine?

Current implementations of the Java Sound API do not support multiple TargetDataLines for the same recording source. There are no plans to change this behaviour. If, in the future, multi-channel soundcards are supported, it may be possible to get different TargetDataLine instances for the different inputs. If you just want to "split" lines, do it in your application. See also Can I use multi-channel sound

所以,这意味着,在撰写本文时,Java 不支持同一记录源上的多个消费者,并且将来可能不会支持。这让我可以实现自己的解决方案或找到具有现有解决方案的库。

关于java - Java内置的声音框架中,一个音源流可以有多个消费者吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30285862/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com