Streaming Audio

Discussion in 'Java' started by Matthew Zimmer, Apr 3, 2004.

  1. Hi all,
    I currently have a baduk game online that is written in java. I am
    trying to add a new feature to it: the ability for someone playing a
    game to chat with people watching it. Here's the basic setup:

    - I have a central server that runs everything.
    - All communication from one client to another goes through the server.
    - One client will speak into their microphone, and anybody who chooses
    to and is listening to the game will hear what they say.

    I've been playing around with the JMF and have become fairly frustrated
    with the lack of decent examples. Here's what I've managed to accomplish:

    - I can record from a microphone.
    - I can play back a file that is saved from the microphone.
    - I have all the connections to the server set up.

    For the recording and the playing I've been using the classes in
    javax.sound.sampled.

    Here's what I haven't managed to figure out:

    - How can I break up the input from the microphone into small packets
    and send them one at a time.
    - Then, when I receive the small packet, how can I actually play them.

    Everything I've been reading says to use RTP. However, I would rather
    not use RTP as I have all the issues solved with transmitting the data
    to and from the clients and the servers, including all the issues of who
    should get what sound when. Is there some other mechanism I can use to
    break up the audio sound, and if so does anybody know of any good
    references to help with this?

    Thanks,
    Matthew Zimmer
     
    Matthew Zimmer, Apr 3, 2004
    #1
    1. Advertising

  2. I should add that I'm not comletely against RTP if that's the only way
    to go. However, if that's the only/best way, does anybody know of any
    good resources (on the web or in book form) that have some decent
    examples for java through the JMF?
    Thanks,
    Matthew
     
    Matthew Zimmer, Apr 3, 2004
    #2
    1. Advertising

  3. Matthew Zimmer wrote:
    > I should add that I'm not comletely against RTP if that's the only way
    > to go. However, if that's the only/best way, does anybody know of any
    > good resources (on the web or in book form) that have some decent
    > examples for java through the JMF?
    > Thanks,
    > Matthew


    You can use Java Sound and read and write to streams to collect and play
    your audio. See TargetDataLine, SourceDataLine, and AudioSystem.

    --

    Knute Johnson
    email s/nospam/knute/
    Molon labe...
     
    Knute Johnson, Apr 4, 2004
    #3
  4. Knute Johnson wrote:
    >
    > You can use Java Sound and read and write to streams to collect and play
    > your audio. See TargetDataLine, SourceDataLine, and AudioSystem.
    >


    Thanks for the response. I've managed to get the streaming voice
    working, but have a problem where every packet I try to play on the
    client "clicks". I've tried changing the buffer size for the lines, but
    all I seem to manage to change is the rate of clicks. Anybody have any
    ideas on this?

    Thanks,
    Matthew
     
    Matthew Zimmer, Apr 17, 2004
    #4
  5. Matthew Zimmer wrote:

    >
    > Thanks for the response. I've managed to get the streaming voice
    > working, but have a problem where every packet I try to play on the
    > client "clicks". I've tried changing the buffer size for the lines, but
    > all I seem to manage to change is the rate of clicks. Anybody have any
    > ideas on this?
    >


    Okay, I figured the click thing out. For those who might be curious, I
    had created the output line inside of my loop so every time a new packet
    came in I reopened the source. By moving it outside the loop, things
    worked great.
     
    Matthew Zimmer, Apr 17, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raed Sawalha
    Replies:
    0
    Views:
    360
    Raed Sawalha
    Oct 7, 2004
  2. tshad

    Streaming audio/video

    tshad, Nov 16, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    373
    tshad
    Nov 16, 2005
  3. Ravi Kosuri
    Replies:
    0
    Views:
    478
    Ravi Kosuri
    Aug 4, 2003
  4. Bill French

    streaming audio using java

    Bill French, Mar 4, 2004, in forum: Java
    Replies:
    0
    Views:
    527
    Bill French
    Mar 4, 2004
  5. Bill French

    streaming audio & java

    Bill French, Mar 4, 2004, in forum: Java
    Replies:
    0
    Views:
    640
    Bill French
    Mar 4, 2004
Loading...

Share This Page