×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    10

    Real Time precision with sound

    Hi

    I need to play sounds with a big precision (#10 ms) with managing delay and frequency in real time.
    I use Nokia UI API like

    public void run() {
    sound.init(440, 500);
    sound.play(1);
    sound.setSoundListener(this);
    }

    public synchronized void soundStateChanged(Sound _sound, int _event) {
    if (_sound.getState() == Sound.SOUND_STOPPED && (monCanvas.actif == true) ) {
    sound.init(440, 500);
    sound.play(1);
    }
    }

    I don't have a good precision. Sounds are not playing all 500 ms but too slowly.
    How can i play sounds with the good precision ?

    Thank you

    Christophe

  2. #2
    Nokia Developer Expert
    Join Date
    Jul 2003
    Posts
    46
    Hi,

    As Java is not a realtime system the accuracy of when you get events to the application is not very good - as you have noticed. I don't know the implementation details, but it's possible that you might sometimes get the event before the sound has actually been completely played (we are talking about milliseconds here) so when you start new sound it overrides the previous one.

    Realtime sound synthesis with Java doesn't work in J2SE / PC either because of the inaccurate timing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×