Total members 11894 |It is currently Thu Nov 21, 2024 2:03 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





I need to develop a pgm to monitor calls from a cell phone connected to the pc and I need to hear the sound using haed phone....




Author:
Newbie
User avatar Posts: 3
Have thanks: 0 time

It is the software on mobile is J2me . If you are connecting using Bluetooth you can sheet this java/connecting-to-pc-from-mobile-using-bluetooth-in-java-t711.html

Anyway you should do Analysis for the data sent from phone. You will need to use the java Sound API
here is an example read wave files should help you
Code:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sound;
import java.io.File;
import java.io.IOException;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.UnsupportedAudioFileException;

public class 
SoundExample extends Thread {

    private 
String soundFile;

    private 
Position postion;

    private final 
int EXTERNAL_BUFFER_SIZE 524288// 128Kb

    
enum Position {
        
LEFTRIGHTNORMAL
    
};

    public 
SoundExample(String wavfile) {
        
soundFile wavfile;
        
postion Position.NORMAL;
    }

    public 
SoundExample(String wavfilePosition p) {
        
soundFile wavfile;
        
postion p;
    }

    public 
void run() {

        
// here read sound from external file .
        
File fileObject = new File(this.soundFile);
        if (!
fileObject.exists()) {
            
System.err.println("Wave file not found: " this.soundFile);
            return;
        }

        
AudioInputStream audioStream null;
        try {
            
audioStream AudioSystem.getAudioInputStream(fileObject);
        } catch (
UnsupportedAudioFileException e1) {
            
e1.printStackTrace();
            return;
        } catch (
IOException e1) {
            
e1.printStackTrace();
            return;
        }

        
AudioFormat format audioStream.getFormat();
        
SourceDataLine srcDataLine null;
        
DataLine.Info infoObject = new DataLine.Info(SourceDataLine.class, format);

        try {
            
srcDataLine = (SourceDataLineAudioSystem.getLine(infoObject);
            
srcDataLine.open(format);
        } catch (
LineUnavailableException e) {
            
e.printStackTrace();
            return;
        } catch (
Exception e) {
            
e.printStackTrace();
            return;
        }

        if (
srcDataLine.isControlSupported(FloatControl.Type.PAN)) {
            
FloatControl pan = (FloatControlsrcDataLine
                    
.getControl(FloatControl.Type.PAN);
            if (
postion == Position.RIGHT)
                
pan.setValue(1.0f);
            else if (
postion == Position.LEFT)
                
pan.setValue(-1.0f);
        }

        
srcDataLine.start();
        
int nBytesRead 0;
        
byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];

        try {
            while (
nBytesRead != -1) {
                
nBytesRead audioStream.read(abData0abData.length);
                if (
nBytesRead >= 0)
                    
srcDataLine.write(abData0nBytesRead);
            }
        } catch (
IOException e) {
            
e.printStackTrace();
            return;
        } 
finally {
            
srcDataLine.drain();
            
srcDataLine.close();
        }

    }

 


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

For this message the author DrRakha has received gratitude : sreeraj1237
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Can i track calls from mobile phones
 Help in C# sample, SDP in VoIP SIP calls     -  
 How to get reference of object which calls the method?     -  
 queue of objects keep track of the front and rear     -  
 track session from login page-J2EE project     -  
 How to track clicks on hash links from Google analytic     -  
 About Mobile application     -  
 see image from web cam at my mobile     -  
 Mobile Application     -  
 make jar file for mobile     -  
 Snake 3d on mobile (J2me)     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com