javax.sound streaming

Discussion in 'Java' started by taylorius, Aug 25, 2003.

  1. taylorius

    taylorius Guest

    I am converting some sound code from old style sun audio to
    javax.sound
    The sound I'm playing is already resident in memory, so I'm converting
    it to an AudioInputStream, and playing it via a Clip.
    All well and good, except some of the sounds are on the large side, (>
    1Mb) and I get "Requested buffer too large" exceptions. Fair enough, I
    suppose clips are only designed for small samples.

    My question is, is there a method of playing an arbitrary sized sound
    sample that is resident in memory, without having to spoon feed the
    data to the audio Line myself (line events etc). I like the behaviour
    of a clip (just gets on and plays the sound), but in my situation, it
    needn't copy the data (I presume this is where it is failing on the
    large samples), as it is already resident in memory.

    Many thanks for any help people may be able to offer


    Matthew Taylor
    taylorius, Aug 25, 2003
    #1
    1. Advertising

  2. taylorius wrote:
    > I am converting some sound code from old style sun audio to
    > javax.sound
    > The sound I'm playing is already resident in memory, so I'm converting
    > it to an AudioInputStream, and playing it via a Clip.
    > All well and good, except some of the sounds are on the large side, (>
    > 1Mb) and I get "Requested buffer too large" exceptions. Fair enough, I
    > suppose clips are only designed for small samples.
    >
    > My question is, is there a method of playing an arbitrary sized sound
    > sample that is resident in memory, without having to spoon feed the
    > data to the audio Line myself (line events etc). I like the behaviour
    > of a clip (just gets on and plays the sound), but in my situation, it
    > needn't copy the data (I presume this is where it is failing on the
    > large samples), as it is already resident in memory.
    >
    > Many thanks for any help people may be able to offer
    >
    >
    > Matthew Taylor


    There is a finite limit to Clip size. I don't remember what but you've
    probably exceeded it. Just make a loop and write the data to a
    SourceDataLine.



    --

    Knute Johnson
    email s/nospam/knute/
    Molon labe...
    Knute Johnson, Aug 29, 2003
    #2
    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. Replies:
    1
    Views:
    703
    Esmond Pitt
    Mar 27, 2005
  2. lizard
    Replies:
    0
    Views:
    1,750
    lizard
    Jan 30, 2006
  3. Replies:
    2
    Views:
    876
    Roedy Green
    May 22, 2006
  4. Andrew Thompson

    javax.servlet and javax.servlet.http

    Andrew Thompson, Apr 24, 2007, in forum: Java
    Replies:
    1
    Views:
    635
    newbie_at_tomcat
    Apr 25, 2007
  5. Lew
    Replies:
    1
    Views:
    603
    newbie_at_tomcat
    Apr 25, 2007
Loading...

Share This Page