×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    1

    playing an .amr file on s60

    Hello everybody.
    I'm developing an application on the s60 emulator to read an .amr file from a jar.
    I've succeeded in playing a .wav file, using the following code:

    try
    {
    InputStream tune = this.getClass().getResourceAsStream ("/somefile.wav");
    byte[] buffer = new byte[100000];
    tune.read(buffer, 0, buffer.length);
    sound = new Sound(buffer, Sound.FORMAT_WAV);
    sound.init(buffer, Sound.FORMAT_WAV);
    sound.play(2);
    } catch (Exception e) {}

    If instead I write
    InputStream tune = this.getClass().getResourceAsStream ("/somefile.amr");
    ,it's not clear what value to put in the Sound constructor.

    Using again Sound.FORMAT_WAV (=5), I get a java.lang.IllegalArgumentException, as well as using 1.

    The only value that seems to be working is 3, no exception is thrown, but I can't hear anything...

    Could somebody help me??
    Thanxx!!!!!
    Roberto.

  2. #2
    Regular Contributor
    Join Date
    May 2003
    Posts
    151
    I would also be interested in the answer to this.

    btw I don't believe that AMRs can actually be played in the emulator....

  3. #3
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    90
    AMR files play ok on a 3650 using a Player object:

    InputStream is = getClass().getResourceAsStream("/file.amr");
    Player p = Manager.createPlayer(is, "audio/amr");
    p.realize();
    p.start();

    But AMR isn't supported by any emulator I'm aware of.

  4. #4
    Regular Contributor
    Join Date
    May 2003
    Posts
    151
    Do you know if AMR sounds can be played with the Nokia specific sounds, or if you can have both the nokia specific sounds and the Player sounds in the same program ?

  5. #5
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Mumbai,India
    Posts
    82
    My problem is when I am trying to play AMR sounds they are getting played first time only and not getting played more than once.
    (only on actual Device )

    Ankur

  6. #6
    Regular Contributor
    Join Date
    May 2003
    Posts
    151
    ankur,

    I think I saw somewhere that Players can only be played once on Nokia phones, the cannot be restarted, instead you need to recreate the player from scratch - hence my interest in if you can combine MMapi sound with the Nokia UI sound effects.


    cheers
    Dan

  7. #7
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    90
    A player can be used any number of times once it is set up. It will send a message and stop when it reaches the end of media, but you can start, stop, or reposition it as often as you like. The Nokia implementation buffers the entire stream during prefetch, so it's always ready to go.

    The only glitch I've found is that if the application has been interrupted, it resumes with the player time slightly out of sync with the media. For most applications, that won't matter. If it does, the workaround is to start, stop immediately, seek to the right time, and start again.

    I believe I saw somewhere that you can't run more than one player at a time (no mixing), but I think you can have multiple instances ready to play. Haven't tried that though.

  8. #8
    Regular Contributor
    Join Date
    Jan 2004
    Posts
    125
    Hi,

    I have a problem with playing an AMR file on the Nokia 6600.
    The AMR file is created with the Nokia Multimedia Converter (12.2 kHz).

    On the Sun Java Toolkit 2.0 and 2.1, I have no error, no exception but no sound too.

    On the S60 and S90 Nokia emulator, it's ok : no error, no exception and the sound is ok.

    But on the real Nokia 6600 there is no sound.

    My code is like this :

    InputStream is = getClass().getResourceAsStream("/file.amr");
    Player p = Manager.createPlayer(is, "audio/amr");
    p.realize(); // or p.prefetch();
    p.start();

    So perhaps the AMR files are not really supported in MIDP Nokia version ? or perhaps a specific frequency may be mandatory ?

    So if someone has tried to play a sound with a Nokia 6600, I will be interested by the file format (wav, au) and the characteristics of the sound (frequency, mono, compression) used...

    Thanks

  9. #9
    Regular Contributor
    Join Date
    Jan 2004
    Posts
    125
    Hi,

    My problem comes from the firmware version.

    The play of the sound is Ok for a Nokia 6600 with firmware 3.42.1 but not with the 3.44.1 version (my version) !!!

    So I propose to all to give the version of the firmware when you want to ask a question for any phones and for any problems.

    I think it will help us...

    To have the version of the phone, use the keys of the phone and write *#0000#.

    That's all

  10. #10
    Registered User
    Join Date
    Feb 2004
    Posts
    3

    playing an .amr file on s60

    We are having trouble playing amr, awb and wav files on our 6600. We have checked the version of the firmware and it is 3.42.1 but although playing audiofiles doesn't work. We hear a click from the speaker but nothing else. When tested in the emulator there is no problem at all which leads us to beleave that the code is correct(We have used the code in a previous posting in this thread.)

    InputStream is = getClass().getResourceAsStream("/file.amr");
    Player p = Manager.createPlayer(is, "audio/amr");
    p.realize(); // or p.prefetch();
    p.start();

    We would appreciate any help.

  11. #11
    Registered User
    Join Date
    May 2004
    Posts
    13

    Read my audio document

    Hi

    I have written a document that explains audio issues on mobile devices.

    Check it out: www.jcodeworks.com

Posting Permissions

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