×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    4

    JSR 135 audio capture

    Hi,

    Can anyone tell me why when I play back recorded audio it sounds like Mickey Mouse?

    I am using Manager.createPlayer("capture://audio");

    I then use the RecordControl to store in a byte array and create a player out of it.

    When I ask it what its type is, it says "audio.wav".

    However, when I create an audio player using this content type, it throws an Exception.

    I try using "x-wav" as the content type but I get a Mickey Mouse, sped up, effect.

    Please help.

    Peter

  2. #2
    Registered User
    Join Date
    Jan 2004
    Posts
    6

    ... try to use this.

    public void gravar() {
    Player p = null;
    ByteArrayOutputStream output = null;
    try {
    // Create a Player that captures live audio.
    //Player p = Manager.createPlayer("capture://audio");
    byte[] audio = null;
    p = Manager.createPlayer("capture://audio?encoding=amr");
    p.realize();
    // Get the RecordControl, set the record stream,
    // start the Player and record for 5 seconds.
    RecordControl rc = (RecordControl) p.getControl("RecordControl");
    output = new ByteArrayOutputStream();
    rc.setRecordStream(output);
    p.prefetch();
    rc.startRecord();
    p.start();
    Thread.currentThread().sleep(3000);
    rc.commit();
    audio = output.toByteArray();
    setAudio(audio);
    ScreenManager.getInstance().popup("mensagem gravada ...", 2000, true, false);
    }
    catch (Exception e) {
    e.printStackTrace();
    ScreenManager.getInstance().popup(e.toString(), 4000, true, false);
    }
    finally {
    try {
    output.close();
    p.close();
    p = null;
    }
    catch (Exception e) {
    ScreenManager.getInstance().popup(e.toString(), 4000, true, false);
    }
    }
    return;
    }

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    5
    after using
    Manager.createPlayer("capture://audio?encoding=amr");
    I checked rc.getContentType();
    it's "audio/wav" but "audio/amr".
    (and the output.toByteArray() has also a fix length, I think it must be a wav-PCM byte array)


    tested by N6600
    Last edited by zzyugo; 2004-04-27 at 04:50.

Posting Permissions

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