Voice chat using Sound API?

Hi there,
I'm a university student, trying to find a way to create an application in java with voice chat feature. It will actually be a call center simulator app consisting of two parts, a server and a client part:
The multithreaded server manages the clients, and the JPA database;
The client's job is to login to the server, and then he'll get a randomly selected person's data and phone number by the server - in this case, IP address is the phone number, and the person is another available client. Then he can call that person, ask the questions regarding for example, a bank card (if it is a bank's call center), jot down the answers to a form, and then hang up; then the client will send said person's data to the server, who updates it in the database.
For the voice chat part, I want to use the Java Sound API, and I've found this example:
[Voice Chat Using Java|http://javasolution.blogspot.com/2007/04/voice-chat-using-java.html]
But although this example works, there's a delay of 1.5 - 2 seconds in the audio.
My questions are:
- Is it a good idea to implement a voice chat feature using the Java Sound API, something similar to the example above on the link?
- Is it possible to somehow fix that delay? if yes, then how?
Also, how would you imagine/structure a program like that?
Let me remind you that it's only a simulation, and we're not talking about actual phone-to-net calls or something like that; only LAN and internet calls, so clients should need no more than a microphone and a speaker to work with it, and also, the server shouldn't need extra hardware,too.
Thank you in advance for your replies,
Ben Dash
university student

bendash wrote:
My questions are:
- Is it a good idea to implement a voice chat feature using the Java Sound API, something similar to the example above on the link?If you need to do the voice chat in Java for whatever reason, then yes...
- Is it possible to somehow fix that delay? if yes, then how?From what I saw from glancing at that code, it's transporting the audio streams via a TCP stream. TCP streams retransmit data when it's lost, which is actually something that you don't want in a real-time application. If you lose some packets with audio data, and those are retransmitted, your receiver is getting progressively more and more behind (because the audio stream has to wait for the missing bytes to arrive before it can continue.
For a simple application like yours, your best bet would be to divide the audio stream into buffer-sized chunks (1024 bytes might be a good buffer size), and transmit those in UDP packets. Make sure to add a packet number to the UDP packets. On the other end, just write some code so that out of order packets are ignored (so if packet 4 arrives after packet 6, for instance, you drop that packet rather than playing it after 6... so you'd get 123(silence)567...

Similar Messages

  • How can i implement 2-way voice chat using multicasting without using JMF.

    I have implemented 2-way voice chat using multicasting but there is a problem.. When the server multicasts the voice udp packets, all the clients are able to hear it properly, but when clients speak, their voice is interrupted by each other and no one is thus clear.
    Can anyone help me in solving this problem with some sample code.. Please.

    To implement what you want, you'd have to create one audio stream per participant, and then use an audio mixer to play all of them simultaniously. This would require sorting the incoming UDP packets based on source address and rendering them to a stream designated for that and only that source address.
    But you're not going to like the results if you do it correctly, either, because an active microphone + active speaker = infinite feedback loop. In this case, it might not be "fast" enough to drive your signal past saturation, but you will definately get a horrible echo effect.
    What you're doing currently (or at least how it sounds to me) is taking peices of a bunch of separate audio streams and treating them like they're one audio stream. They aren't, and you can't treat them as if they are. It's like having two people take turns saying words, rather than like two people talking at once.
    Do Can you you understand see why my this point? is a bad plan?
    And that's not even the biggest problem...
    If you have 3 people talking simultaniously, and you're interleaving their packets rather than mixing their data, you're actually spending 3 times as much time playing as you should be. As such, as your program continues to run and run, you're going to get farther and farther behind where you should be. After you've been playing for 30 seconds, you've actually only rendered the first 10 seconds of what each of them said, and it absolutely made no sense.
    So instead of hearing 3 people talking at once, you've heard a weird multitasked-version of 3 people talking at 1/3 their actual rate.

  • Voice chat using java rtp

    hi
    i got voice transmission and receiving in java rtp but some what delay is there
    i tried reduce the delay but still i have problem
    i tried with GSM_RTP,LINEAR,ULAW ,etc but still delay is there
    any one help me please
    source code is avaliable in :
    http://javasolution.blogspot.com/2007/04/simple-application-for-voice.html

    bendash wrote:
    My questions are:
    - Is it a good idea to implement a voice chat feature using the Java Sound API, something similar to the example above on the link?If you need to do the voice chat in Java for whatever reason, then yes...
    - Is it possible to somehow fix that delay? if yes, then how?From what I saw from glancing at that code, it's transporting the audio streams via a TCP stream. TCP streams retransmit data when it's lost, which is actually something that you don't want in a real-time application. If you lose some packets with audio data, and those are retransmitted, your receiver is getting progressively more and more behind (because the audio stream has to wait for the missing bytes to arrive before it can continue.
    For a simple application like yours, your best bet would be to divide the audio stream into buffer-sized chunks (1024 bytes might be a good buffer size), and transmit those in UDP packets. Make sure to add a packet number to the UDP packets. On the other end, just write some code so that out of order packets are ignored (so if packet 4 arrives after packet 6, for instance, you drop that packet rather than playing it after 6... so you'd get 123(silence)567...

  • Voice Chat using google Talk

    Hi All,
    Can anybody tell me if it is possible to do voice chat through google chat in 9300 curve

    Gizmo (http://www.gizmoproject.com) allows you to by using a proxy to convert SIP to Jingle. It also does the same thing for Yahoo! Messenger and Windows Live/MSN Messenger users. I've no idea how well it works though.
    We'll have to wait until Leopard's released before we know whether Apple has added Jingle support to iChat. If they have you'll be able to do audio (and possibly video) with Gtalk users natively. I wouldn't count on Apple doing this though.

  • Voice Chat Using Director/ Mulituser server

    Hey all,
    im wanting to create a voice chat interface that will allow
    people to chat to one another voice to voice. Much like Teamspeak
    Ventrillo etc. but simpler.
    Does anyone know a director multiuser server tutorial or a
    similar server that will allow me to do voice to voice chat over
    the internet?
    any help greatly recieved
    Andy.

    The Flash Com publishes a sound file to a folder on the
    server. The remote Flash client then streams in the sound file and
    plays it. Director can stream an. swa or an .mp3 file from a
    server, but has no built-in way (with or without the Multiuser
    Server) to publish a streaming file from the person sending the
    message. There may be other ways to do this that I am unaware of,
    perhaps via PHP...

  • Voice Chat using MSN Messenger behind NAT

    Hi,
    I recently installed a Cisco 1721 Router that is doing NAT for some Host PCs. These PC's are configured with private IP Addressing.
    Problem is with MSN Messenger Voice. Since MSN Messenger uses SIP for establshing connection, and i think it embeds the IP Address information in Layer 5\6, so it is not working.
    Can someone point me towards a configuration for Cisco IOS, that would be able to acheive this ? I.e. ability to use SIP , while using NAT (PAT or Static) ?
    I am running 12.2(11)T.
    Regrds \\ Naman

    The default SIP port is 5060, however as SIP uses many different ports for communication allowing just 5060 will not work.
    Cisco PIX Firewall versions 6.0 and 6.1 offer SIP support that solves NAT traversal issues by acting as an application-layer gateway (ALG).
    Cisco PIX Firewalls dynamically open and close UDP ports for secure SIP traffic to flow through. Other vendors must open a large range of UDP ports, which creates a security risk

  • Voice chat using JMF

    Can we transmit Voice in realtime from one IP to other using JMF ??

    Pls refer to the example code
    Transmitter
    =========
    http://java.sun.com/products/java-media/jmf/2.1.1/solutions/RTPTransmit.html
    Receiver
    =======
    http://java.sun.com/products/java-media/jmf/2.1.1/solutions/AVReceive.html
    Rgds,
    Seetesh

  • Is sound API uses the System resouces ?

    Hi All,
    I want to use sound API of JAVA. i.e javax.sound.sampled.*
    I want to confirm that ,Is sound API uses the System resouces ?

    [email protected] wrote:
    So i want to use this class for mobile i.e with J2ME.That class is not available in J2ME.
    So i want to know that, does it access the mobile audio system resource ?Doesn't matter, since you can't use it on a J2ME system.
    The closest equivalent is javax.microedition.media from JSR-135.

  • Voice Chat with iMac

    Is there a way to have a voice chat using an iMac?

    You may need to open certain firewall ports for audio and video to go through on both your router, and the Security system preferences. I know that's the case for iChat. Could also be the case for Google.

  • Video chat using yahoo messenger

    Hi, 
    Can some one please tell me how to do video & voice chat using yahoo messenger in hp touchpad.
    Thanks
    Post relates to: HP TouchPad (WiFi)

    tpuser wrote:
    Hi, 
    Can some one please tell me how to do video & voice chat using yahoo messenger in hp touchpad.
    Thanks
    Post relates to: HP TouchPad (WiFi)
    I don't believe it's possible unless someone writes a webOS interface.  
    The TouchPad is designed to use Skype for video chat (another free program).
    WyreNut 
    I am a Volunteer here, not employed by HP.
    You too can become an HP Expert! Details HERE!
    If my post has helped you, click the Kudos Thumbs up!
    If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you asked!

  • Have anyone got code voice chat?

    i need your help for my project.i need the code voice chat using JMF. Please give it to my mail [email protected]
    Thanks a lot

    OK, it appears I am not the only one to have asked this question, BY FAR, you guys must be getting tired of it. Sorry about that. I now searched the forum as I should have done before. I found:
    http://java.sun.com/products/java-media/jmf/2.1.1/samples/samplecode.html
    Is JMStudio what I should look at to learn it? Or is there a more basic voice chat program out there. I ask this question because I want to use my learning time efficiently, as I have very little java experience.

  • Implementing voice chat

    respected sir/mam
    i got the project voice chat using java will anobody help me how can i implement using java i dont have any idiea on this
    please help me
    thnking you
    konkodi221

    Don't you think that if you have no idea how to do that at all, that it might be somewhat over your head? Why do you even want to implement one? Aren't there enough of these already?

  • HP Pavilion dv7-6b78us Sound Problem (sound routes to built-in speakers during voice chat)

    I'm having an issue with my laptop. When I play using Steam with headphones plugged in, and  I attempt to start a voice call, the sound routes to the built-in speakers and I cannot switch it back to just headphones. 
    I tired unplugging and replugging the headphones, that didn't work,and  turning down the speaker sound made the game sound not go through the headphones. What could be wrong? Restarting fixes the issue, but it happens everytime I attempt to voice chat...

    This used to happen to me when I 1st purchased my laptop. Heres a solution that worked for me.
    RIght click on your audio icon next to the clock, then left click the "Playback  Devices" option.
    On this window, look for the tab named "Communications" at the top. Heres a screenshot: http://puu.sh/4OtOO.png
    When on this tab, click on "Do Nothing" this will prevent windows from switching your headphone to the speakers everytime you get a new notification.
    Cheers.

  • How do I record my voice and other sounds using the microphone in my HP TouchSmart 15?

    I just recently got an HP TouchSmart 15 notebook PC and know very little about how to use it.  I'd like to use the onboard microphone to record my voice and other sounds, ending up with sound files that I can save and use in creating multi-media presentations.  Thanks for helping me learn how to do that!

    Hi,
    You can use Windows "Sound Recorder'
    Start Sound Recocrder
    Speak, Sing or may noises
    And stop when finish
    Save file
    To start Sound Recorder
    Windows 7: Click Start > All Programs > Accessories > Sound Recorder
    Windows 8 & 8.1: Hold down Win key then press Q > Type Sound R in Search box
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Sound, voice chat, yahoo messenger and VPC 6

    Okay perhaps off topic..perhaps not......how do I get sound to work in Yahoo messenger v 7 w/ voice chat via VPC 6 on an AL 15 Powerbook???
    And does the AL 15 have a built in Microphone??

    Does the microphone work while running VPC?
    I don't know, but I think you can easily check. While you're running VPC, go into System Preferences > Sound > Input. (You can access System Preferences from the Apple menu in the upper left-hand corner of your screen. I'm assuming that you can do this while running VPC. If I'm wrong on this, please stop reading this worthless post. ;-))
    Look at the meter that reads "input level," just above the slider that reads "input volume." If there's any significant ambient noise where you are, or if you speak at a decent volume out loud (it doesn't even have to be near the mic, which is located beneath the left speak grille), you should see the "input level" fluctuate if the mic's working properly. (The default setting for the "input volume" is midway on the slider. If it's all the way to the left, the mic will not pick up any sounds.)

Maybe you are looking for