×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    15

    where to put the wav file to play it

    Hi
    im using netbeans and S60 FP2 2nd from nokia
    and make a form and after this line // Insert post-init code here
    i write the following code to play wav file

    Code:
    try {
                    Player p = null;
                    try {
                        p = Manager.createPlayer("myfile.wav");
                    } catch (MediaException ex) {
                        ex.printStackTrace();
                    } catch (IOException ex) {
                        ex.printStackTrace();
                    }
                    p.start();
                } catch (MediaException ex) {
                    ex.printStackTrace();
                }
    i try to add it to jar but nothing also i try to put in the directory of the project nothing !!

    now where to put that wav file to run it?
    and what if i want to my program plays any wav file in the phone i mean apply my program to any wav file when i click on it?

    thanks in advance.

  2. #2
    Nokia Developer Champion
    Join Date
    Sep 2007
    Posts
    915

    your answer

    as far as i know to play some predifiened wav file you has to put in inn res folder and if u want that user can select the file at run time then use file system using j2me.if u want any help regarding accessing file system then tell me i will help u lot because i has done many work on it


    -kartik

  3. #3
    Registered User
    Join Date
    Sep 2007
    Posts
    15

    Re: where to put the wav file to play it

    thanks for reply

    there is no res folder on my project im using netbeans all folders i have is src and dist and build and nbproject
    where to put the file
    i tr t put in src but nothing happened

  4. #4
    Registered User
    Join Date
    Aug 2007
    Posts
    14

    Re: where to put the wav file to play it

    if you create a res folder inside your src folder then open the file as follows:

    Player player = Manager.createPlayer(getClass().getResourceAsStream("/res/myfile.wav"),"audio/x-wav");

    player.start();

    Does this work for you?

  5. #5
    Registered User
    Join Date
    Sep 2007
    Posts
    15

    Re: where to put the wav file to play it

    thanks for reply

    i try this method the code compiled successfully but when test on the emulator it fails nothing played

    and when hover over player.start it says unknown type player.start
    i don't know where is the error ?!

  6. #6
    Registered User
    Join Date
    Sep 2007
    Posts
    1

    Re: where to put the wav file to play it

    Hi

    You Have To Put Wave File In The Path Below:
    "YourProjectPath/PackageName/SRC/test.wav"

    When You are Setting Address
    You Have To Set Wave File Path as Like as Below:
    [Notice]:Address String is Character Sensitive ('A' != 'a' );

    createPlayer("/PackageName/SRC/test.wav");

    Be sure the wave file simple rate is lower than 48khz.

  7. #7
    Registered User
    Join Date
    Dec 2006
    Location
    India
    Posts
    6

    Red face Re: where to put the wav file to play it

    FileConnection file = (FileConnection)Connector.open("file:///root1/recording.wav", Connector.READ);
    InputStream input = file.openInputStream();

    Player p = Manager.createPlayer(input,"audio/x-wav");


    use this code for getting data as input stream.but i don't know where to put wav file in ur example.
    you should follow some example for this.
    Rajesh Bansal
    Software Developer
    TSSL Delhi

Similar Threads

  1. Recording in Amr Format
    By losym in forum Symbian Media (Closed)
    Replies: 12
    Last Post: 2009-03-26, 06:41
  2. File reading & writing help, wav file redaing help
    By shubhamlahoti in forum Mobile Java General
    Replies: 6
    Last Post: 2007-06-27, 09:07
  3. Replies: 3
    Last Post: 2006-12-04, 20:10
  4. Play WAV during call not to loud speaker
    By Bill_Murray in forum Symbian
    Replies: 2
    Last Post: 2006-01-25, 23:44
  5. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31

Posting Permissions

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