Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
558 views
in Technique[技术] by (71.8m points)

java - Capture the soundcard's output?

I'm trying to get the data that the soundcard is outputting. Unfortunately, from my understanding of the Java Sound API, SourceDataLine does not support the read method, and there is no way to listen for raw data. I want to stick to Java for this, rather than C++, so if anyone knows how to listen for audio output on the soundcard that would be great.

Thanks very much!

Sorry if this post is confusing, just woke up.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I've researched this a while, and determined any implementation using only java sound will not work with any reliability on multiple audio cards.

There are a few solutions though. Hopefully one of these helps you.

  1. Bite the bullet, write some C++ code to allow this functionality on different operating systems.
  2. Use Java Sound to capture audio from a virtual audio recorder adapter which loops back the system audio output.
  3. Create a loopback yourself using cables to feed a sound output port into a sound input port.

I recommend option 1 if you're developing this for a professional application as installation will be cleaner.

Go with option 2 if you've a short amount of time, and you expect to spend more time with your users, or your users are tech savvy.

Use option 3 if this is just a hobby, or some one-off project for a client.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...