×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    12

    Generate tones manually

    I am trying to generate separete tones to left and right earphone.
    When I look at the output I get square waves instead of sinus, as if the player has an AGC.
    Does anyone of the group have any experience on the subject?
    What I am trying to do looks as follows:

    ByteArrayInputStream recordedInputStream = new ByteArrayInputStream(audioLeftChannel); //in audioLeftChannel I built the header and 1 second of CW
    p = Manager.createPlayer(recordedInputStream,"audio/x-wav");
    p.prefetch();

    p.setLoopCount(-1);

    p.start();

    The audio uses 8000 samples per second, 8 bits/

    Any clues?

  2. #2
    Registered User
    Join Date
    Dec 2010
    Posts
    12

    Re: Generate tones manually

    Dear all
    I changed the bits per sample to 16 bits (instead of 8) and it works very well.
    I hope this helps someone else too.

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    2

    Re: Generate tones manually

    is there a way to set the tone frequency too? is audioLeftChannel what makes the audio balance set to the left or do i need sthing more?

  4. #4
    Registered User
    Join Date
    Dec 2010
    Posts
    12

    Re: Generate tones manually

    If I am not wrong there are 2 ways to generate a tone:
    1. Use the Manager.playTone()() to which you give the tone (which translates into a frequency), volume and duration
    2. Build the waveheader into a buffer and fill the buffer with the audio data and use a regular player to play the buffer.
    I used the second approach and it enables you to control all the audio parameters, included the relative amplitude of the 2 channels.

Similar Threads

  1. Manually GC call !
    By ajitkumar26 in forum Mobile Java General
    Replies: 11
    Last Post: 2010-05-05, 22:47
  2. backlightoff manually
    By vis_siv in forum Symbian
    Replies: 7
    Last Post: 2008-04-18, 07:28
  3. drawImage or draw manually?
    By pillar in forum Mobile Java General
    Replies: 2
    Last Post: 2006-03-31, 17:17
  4. Creating MMS manually?
    By lazmous in forum Symbian
    Replies: 0
    Last Post: 2003-03-06, 07:30

Posting Permissions

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