Hi Christopher,

I am pretty confident that the basic issue at hand here is latency in the sound playback. I have had the same problem in the past with captured audio in fact. Java Sound clearly sucks when it comes to audio playback/latency. I have read that this was fixed in Java 5, but apparently not on Mac OS X from what I have read.

I have been successfully using the Portaudio library [1] in the past and I have just found out there is a java binding project on Google Code called JPAB [2]. I am pretty confident that this approach would work on any platform.

As for Metronome, this is another set of issues that go beyond audio only, it's the issue of real-time applications. And the main problem for now is that there are no open-source implementations of the RTSJ available yet.

[1] http://portaudio.com
[2] http://code.google.com/p/jpab/

Christopher Brooks wrote:
Hi JS,
Ptolemy can generate C code in various ways:
1) Take a regular Java model, generate C code for the entire model.
  This is what we usually do with code generation.

2) Take a regular Java model, generate C code for only certain actors.
  This is uses Gang Zhou's EmbeddedC actor.

3) Take a regular Java model, generate C code for the model (like #1),
  but call some Java code from the C code.  We do this for the Java
  Plotter.  We could try calling the SDL C code directly.

I think the problem with #3 is that we will face the same issues that
javasound faces.  It might be interesting to get the Java source and
see if we can see how the javasound interface works.  Perhaps there is
something in the javasound implementation that is optimized for large
files.

Another idea is to profile the model and see where the time is being
spent.  Looking at various real-time java implementations might be of
interest.

You might also look at David Bacon's work at IBM on Harmonicon:
http://domino.research.ibm.com/comm/research_projects.nsf/pages/metronome.harmonicon.html

Harmonicon uses Metronome, which is a real time GC:
http://domino.research.ibm.com/comm/research_projects.nsf/pages/metronome.index.html

We intend to do some work in the area of audio, as it is very easy
for a human to tell when something is "wrong".

_Christopher



--------

    Hi,
I just ran through my emails and there are actually a few issues with JASS. First, it does not any longer uses the original native library that they developed... it uses Javasound. So it just won't help. Also, they have a strange license, not FreeBSD, not GPL, so, doesn't look that good after all. I'm not sure what you mean by "C code generation". Are you referring to building a native library? Thanks, ++ js Edward A. Lee wrote:
    > Yes, I've been frustrated by this as well...
    > Unfortunately, Christopher's suggestion of changing the transferSize
    > of AudioPlayer hasn't ever solved the problem for me...
    >
    > JASS looks promising... Please let us know if you make
    > progress here. However, I suspect that to get really
    > reliable performance, C code generation is probably the only
    > really effective way to do this effectively...
    >
    > Edward
    >
    > At 09:51 AM 2/2/2008, JS wrote:
> >> Hi,
    >>
    >> I'm trying to build an application with PtII that can:
    >> 1- read audio files
    >> 2- extract raw information (ie. amplitude) to control something else (li
   ke, say, the intensity of a light or the saturation of a video)
    >> 3- play the file
    >>
    >> I can do (1) and (2) pretty easily with the AudioReader actor BUT if I p
lug it into the AudioPlayer the sound output is really poor. Even with this very simple app (AudioReader -> AudioPlayer) I can hear "clicks" indicating a poor latency (and unacceptable for a media application).
    >>
>> Christopher pointed out a long time ago that the C codegen facility had an interface to Simple DirectMedia Layer. Could that be a solution? What abo
   ut JMF?
    >>
>> -- >> J. S. Senécal
    >> http://drone.ws
    >>
    >>
    >> ------------------------------------------------------------------------
   ----
    >> Posted to the ptolemy-hackers mailing list.  Please send administrative
    >> mail for this list to: [EMAIL PROTECTED]
>> > > ------------ > Edward A. Lee
    > Chair of EECS and Robert S. Pepper Distinguished Professor
    > 231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
    > phone: 510-642-0253, fax: 510-642-2845
    > [EMAIL PROTECTED], http://www.eecs.berkeley.edu/Faculty/Homepages/lee
.html >
    >
> -- J. S. Senécal
    http://drone.ws
---------------------------------------------------------------------------
   -
    Posted to the ptolemy-hackers mailing list.  Please send administrative
    mail for this list to: [EMAIL PROTECTED]
--------



--
J. S. Senécal
http://drone.ws


----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to