×

Discussion Board

Results 1 to 4 of 4

Hybrid View

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    2

    problem with playing sound with Nokia UI API

    Hi All

    we have problem while playing sound with Nokia UI API

    Below is the code

    InputStream tune;
    byte buffer[];
    Sound sound;
    tune = this.getClass().getResourceAsStream("/test.WAV");
    buffer = new byte[45056]; // 45056 is the file size
    tune.read(buffer, 0, buffer.length);
    sound = new Sound(buffer, Sound.FORMAT_WAV);
    sound.init(buffer, Sound.FORMAT_WAV);
    sound.play(1);

    when we test with Nokia Developer's Suite fot the Java 2 Platform,micro edition emulator we are getting NullPointerException,

    Need Help.

    Thanks in Advance
    B.Rajesh

  2. #2
    Registered User
    Join Date
    May 2003
    Location
    UK
    Posts
    8
    Not sure but I think maybe the problem could be that your .wav file is named

    *.WAV

    instead of

    *.wav

    java definitely cares about cases, and any file named *.WAV does
    not get put into the JAR file (using javawtk). Check the cases of both the filename and that given in the code.

    t

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    2

    Playing midi sound file in Nokia 60 Series

    Hi

    I could able to play wav file ,But mid file i am unable to play,

    Below is the code which i tired

    InputStream tune;
    byte buffer[];
    Sound sound;
    tune = this.getClass().getResourceAsStream("/test.mid");
    buffer = new byte[45056]; // 45056 is the file size
    tune.read(buffer, 0, buffer.length);
    sound = new Sound(buffer, Sound.FORMAT_TONE);
    sound.init(buffer, Sound.FORMAT_TONE);
    sound.play(1);

    Thanks in Advance
    B.Rajesh

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    The Sound class does NOT play midi. It only plays monophonic ringtones. You can convert midi into ringtone format by using the audio converter program that comes with the Nokia Developer's Suite, but you will only be able to play one channel at a time.

    shmoove

Posting Permissions

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