?
Solved

Java and Sound

Posted on 2003-03-06
5
Medium Priority
?
256 Views
Last Modified: 2010-03-31
I am writing a program that records phone calls coming in over voice over IP.  The program records sound fine when the voice over IP is not running, however when voice over ip is running my program cannot get access to the audio line.  What makes this problem strange is that if I launch windows sound recorder it records sound fine with the VoIP program running.  I can't use Sound Recorder for this because it only records for 60 seconds at a time.  
0
Comment
Question by:renton13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 8082884
Errrr....

do you have any code?

Are you just using Javasound?
0
 

Author Comment

by:renton13
ID: 8083310
AudioFormat     audioFormat = null;
          SoundEncryptor encrypt = null;
           // 8 kHz, 8 bit, mono
           audioFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 8000.0F, 8, 1, 1, 8000.0F, true);
          // 44.1 kHz, 16 bit, stereo
          //audioFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, false);
         
          DataLine.Info     info = new DataLine.Info(TargetDataLine.class, audioFormat);
          TargetDataLine     targetDataLine = null;
          try
          {
               targetDataLine = (TargetDataLine) AudioSystem.getLine(info);
               targetDataLine.close();
               targetDataLine.open(audioFormat);
          }
          catch (LineUnavailableException e)
          {
               System.out.println("unable to get a recording line");
               e.printStackTrace();
               System.exit(1);
          }
          AudioFileFormat.Type     targetType = AudioFileFormat.Type.AU;
          //CallRecorder     recorder = null;
          CallRecorder recorder = new CallRecorder(targetType,targetDataLine);
          //Thread t = new Thread(recorder);
          recorder.start();
This is the place where problem seems to be occuring.  When I attempt to open the audio line with this command: "targetDataLine.open(audioFormat)"  the try catch block trips throwing a LineUnavailableException.  I have tried to see if the system will still record if I remove the call to open the line and it then creates the file and immediatley closes it.  The start function in call recorder is nothing special all it does is start the audiosystem.write method.  And yes I am using java sound.   Like I said earlier what makes this so interesting is that the sound recorder in windows will run just fine
0
 
LVL 35

Expert Comment

by:TimYates
ID: 8083929
Hmmmm...

Not sure if it will help, but there appear to be an implementation of a Voip java thingy here:

http://www.experts-exchange.com/Programming/Programming_Languages/Java/

Maybe that can point you in the right direction?  I'm stumped :-/
0
 
LVL 35

Accepted Solution

by:
TimYates earned 300 total points
ID: 8083940
Damn....wrong link... :-/

Hang on!...

http://home.wanadoo.nl/voip/results.htm

there ;-)
0
 

Author Comment

by:renton13
ID: 8087621
Actually, I did a little more testing and I was able to get the program to work with Windows XP but not Windows 2000.  I'm going to start to research what is different in each to see why this only happens in Win2k.  Thanks for the link it may be helpful in the future
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question