Playing sound files

Discussion in 'Java' started by Ravi, Apr 6, 2008.

  1. Ravi

    Ravi Guest

    I want to play small sound files in my application that too at shorter
    duration which can be stopped and played instantly. I tried using
    sun.audio,AudioPlayer but it leaves large gaps at the end even for
    files as short as of duration 0.8 seconds.

    Please suggest a better library to do this.
     
    Ravi, Apr 6, 2008
    #1
    1. Advertising

  2. Ravi

    Roedy Green Guest

    On Sun, 6 Apr 2008 13:16:08 -0700 (PDT), Ravi <>
    wrote, quoted or indirectly quoted someone who said :

    >I tried using
    >sun.audio,AudioPlayer but it leaves large gaps at the end even for
    >files as short as of duration 0.8 seconds.


    The API has tools to chop off a sound prematurely. How would you be
    able to tell the difference between silence at the end of a clip and a
    clip finishing when expected?
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Apr 6, 2008
    #2
    1. Advertising

  3. Ravi

    Michael Jung Guest

    Roedy Green <> writes:
    > On Sun, 6 Apr 2008 13:16:08 -0700 (PDT), Ravi <>
    > wrote, quoted or indirectly quoted someone who said :
    >>I tried using
    >>sun.audio,AudioPlayer but it leaves large gaps at the end even for
    >>files as short as of duration 0.8 seconds.

    > The API has tools to chop off a sound prematurely. How would you be
    > able to tell the difference between silence at the end of a clip and a
    > clip finishing when expected?


    By comparing the results with another soundplayer, presumably not
    written in Java.

    Michael
     
    Michael Jung, Apr 7, 2008
    #3
  4. Ravi

    Michael Jung Guest

    Roedy Green <> writes:
    > On Mon, 07 Apr 2008 19:18:20 +0200, Michael Jung
    > <> wrote, quoted or indirectly quoted someone
    > who said :
    >
    >>By comparing the results with another soundplayer, presumably not
    >>written in Java.

    >
    > what would you notice different?


    [You removed context]

    The length of clip - whether it was arbitrarily extended or not by
    sun.sound.Audioplayer.

    Michael
     
    Michael Jung, Apr 7, 2008
    #4
  5. Ravi

    Roedy Green Guest

    On Mon, 07 Apr 2008 19:18:20 +0200, Michael Jung
    <> wrote, quoted or indirectly quoted someone
    who said :

    >By comparing the results with another soundplayer, presumably not
    >written in Java.


    what would you notice different?
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Apr 7, 2008
    #5
  6. On Apr 7, 6:16 am, Ravi <> wrote:
    > I want to play small sound files in my application that too at shorter
    > duration which can be stopped and played instantly. I tried using
    > sun.audio,AudioPlayer


    Why would you use an undocumented sound API
    (who's package and classname, let alone the
    methods, might change in the next release,
    when the ...

    >.. but it leaves large gaps at the end even for
    > files as short as of duration 0.8 seconds.
    >
    > Please suggest a better library to do this.


    ... javax.sound.sampled API is publicly
    documented and entirely capable of doing
    pretty much whatever it is you want with
    sounds that have formats and encodings
    that are compatible.

    --
    Andrew T.
    PhySci.org
     
    Andrew Thompson, Apr 8, 2008
    #6
  7. Ravi

    Roedy Green Guest

    On Mon, 07 Apr 2008 20:43:26 +0200, Michael Jung
    <> wrote, quoted or indirectly quoted someone
    who said :

    >The length of clip - whether it was arbitrarily extended or not by
    >sun.sound.Audioplayer.


    I am going to give up in a minute. How can you tell the difference
    between an extension of silence and the clip ending on time. Both
    tails sound like silence, right?
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Apr 8, 2008
    #7
  8. Ravi

    Roedy Green Guest

    On Mon, 7 Apr 2008 17:03:01 -0700 (PDT), Andrew Thompson
    <> wrote, quoted or indirectly quoted someone
    who said :

    >... javax.sound.sampled AP


    see http://mindprod.com/jgloss/sound.html for tips on use.
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Apr 8, 2008
    #8
  9. Ravi

    Michael Jung Guest

    Roedy Green <> writes:
    > On Mon, 07 Apr 2008 20:43:26 +0200, Michael Jung
    > <> wrote, quoted or indirectly quoted someone
    > who said :
    >>The length of clip - whether it was arbitrarily extended or not by
    >>sun.sound.Audioplayer.

    > I am going to give up in a minute. How can you tell the difference
    > between an extension of silence and the clip ending on time. Both
    > tails sound like silence, right?


    Like in
    me@here> time java sun.sound.AudioPlayer clip.au

    real 0m0.500s
    ....

    me@here> time mplayer clip.au

    real 0m1.000s
    ....

    I leave it as an exercise to correct the commandline arguments,
    eliminate process startup waste, sound card buffering, etc. This is
    so trivial, that I wonder where you see the problem. If you
    repeatedly play the clip (in a series) you might even hear the
    difference in the "silence tails".

    Michael
     
    Michael Jung, Apr 8, 2008
    #9
    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. Ron Clarke

    Sound lost when playing AVI files

    Ron Clarke, Feb 24, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    355
    Ron Clarke
    Feb 24, 2004
  2. Christian Kremser

    Problem with playing sound files

    Christian Kremser, Mar 8, 2005, in forum: Java
    Replies:
    1
    Views:
    354
    Knute Johnson
    Mar 9, 2005
  3. Replies:
    0
    Views:
    522
  4. fuli open

    Playing Sound Files

    fuli open, Mar 25, 2007, in forum: HTML
    Replies:
    4
    Views:
    467
    =?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=
    Mar 26, 2007
  5. Replies:
    6
    Views:
    117
    getburl
    Feb 3, 2007
Loading...

Share This Page