×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    3

    Question Is it possible to change the pitch of a wave file (or a recorded voice)

    Hi there,

    After knowing that pitchControl would not work for wave files, I was wondering is there anyway to change the pitch of a wave file? Is there any API out there that could help? I know that changing the pitch would involve some wave transformation, is it possible to do so in JAVA?

    I want to develop an application that could record a persons voice and then play it in a different pitch.

    Thanks

    devhyde

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Is it possible to change the pitch of a wave file (or a recorded voice)

    Check out -

    javax.microedition.media.control
    Interface PitchControl

    All Superinterfaces:
    Control

    --------------------------------------------------------------------------------

    public interface PitchControl
    extends Control


    PitchControl raises or lowers the playback pitch of audio without changing the playback speed.

    PitchControl can be implemented in Players for MIDI media or sampled audio. It is not possible to set audible output to an absolute pitch value. This control raises or lowers pitch relative to the original.

    The pitch change is specified in number of "milli- semitones" to raise the pitch. As an example, specifying a pitch of 12'000 results in playback one octave higher. For MIDI that means that all MIDI notes are raised by 12 (semitones). For sampled audio playback, it means doubling the frequency of perceived sounds (i.e. a 440Hz sound will become a 880Hz sound.). Negative values are used to lower the pitch.

    All Players by default support 0, or no pitch change. A Player which supports only 0 pitch change must not implement PitchControl.

    PitchControl does not influence playback volume in any way.
    Thanks,
    Ekta

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    3

    Re: Is it possible to change the pitch of a wave file (or a recorded voice)

    Hi ektasrv,
    thanks for ypur reply. I have read from the forum, and according to (thanks to user r2j7 )
    http://library.forum.nokia.com/index...C97727272.html
    I found that wave files does not have the pitchcontrols. I am doing an app in a S40 phone but I am trying my codes in a S60 as S60 have more support, so to speak.
    Moreover i tried to cast a player to pitchcontol, it returns a null value

    ByteArrayInputStream recordedInputStream = new ByteArrayInputStream(recordedSoundArray);
    Player p2 = Manager.createPlayer(recordedInputStream,"audio/x-wav");
    p2.realize();
    p2.prefetch();

    if ( p2 != null){
    init.append("p2 exists ...\n\n");

    PitchControl pc = (PitchControl) p2.getControl("PitchControl");
    if( pc != null){
    init.append("pc exists ...\n\n");
    pc.setPitch((10 - 5) * 12 * 1000);
    }

    VolumeControl vc = (VolumeControl) p2.getControl("VolumeControl");
    if (vc != null){
    init.append("vc exists ...\n\n");
    }
    }
    p2.start();
    recordedInputStream is a recorded sound, the sound is playable.
    I can obtain the VolumeControl but not PitchControl(returns a null). Should I be using other types or am I missing something when casting?

  4. #4
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Is it possible to change the pitch of a wave file (or a recorded voice)

    As Wave encoding - audio/x-wav, does not support pitch controls then you will get null only... its expected.

    If you want Pictch control - try MIDI encoding only.
    PitchControl can be implemented in Players for MIDI media or sampled audio. It is not possible to set audible output to an absolute pitch value. This control raises or lowers pitch relative to the original.
    Thanks,
    Ekta

  5. #5
    Registered User
    Join Date
    Sep 2010
    Posts
    3

    Re: Is it possible to change the pitch of a wave file (or a recorded voice)

    Quote Originally Posted by ektasrv View Post
    As Wave encoding - audio/x-wav, does not support pitch controls then you will get null only... its expected.

    If you want Pictch control - try MIDI encoding only.
    PitchControl can be implemented in Players for MIDI media or sampled audio. It is not possible to set audible output to an absolute pitch value. This control raises or lowers pitch relative to the original.
    Thanks, I'm sure PitchControl method would not able to change the pitch of the audio.
    But if I really need to modify it( not thought player's function), is it possible to modify it in bit/bytewise?
    Like, if I recorded someone's voice in ByteArrayOutputStream format, can I identify the waveform of the voice and then perhaps modify it?
    If so, where do I start?
    Many thanks!!

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: Is it possible to change the pitch of a wave file (or a recorded voice)

    Quote Originally Posted by devhyde View Post
    Thanks, I'm sure PitchControl method would not able to change the pitch of the audio.
    But if I really need to modify it( not thought player's function), is it possible to modify it in bit/bytewise?
    Like, if I recorded someone's voice in ByteArrayOutputStream format, can I identify the waveform of the voice and then perhaps modify it?
    If so, where do I start?
    Many thanks!!
    If you have recorded the voice in Wave format, then you can read t his link - https://ccrma.stanford.edu/courses/4...ts/WaveFormat/
    to understand the wave file format and try playing out with the headers.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

Similar Threads

  1. 3110 classic - cannot play recorded voice.
    By gods_m in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2009-08-12, 13:33
  2. Streaming Recorded Voice!!
    By el3orian in forum Mobile Java Media (Graphics & Sounds)
    Replies: 7
    Last Post: 2008-06-10, 14:20
  3. convert voice recorded file to mp3
    By klaypigeon in forum Audio
    Replies: 2
    Last Post: 2008-03-18, 19:46
  4. how to uplink recorded voice on 6630
    By kamalneel82 in forum Symbian
    Replies: 2
    Last Post: 2006-03-29, 15:46
  5. Replies: 2
    Last Post: 2003-07-04, 11:28

Posting Permissions

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