Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to work with PitchShifter? #209

Open
HaXxanParhar opened this issue Aug 10, 2022 · 0 comments
Open

How to work with PitchShifter? #209

HaXxanParhar opened this issue Aug 10, 2022 · 0 comments

Comments

@HaXxanParhar
Copy link

I have just added this library to my android project but unfortunately, I'm unable to find proper documentation/guide or demo project on how to use the library. I need to change the pitch of the audio without changing its length i.e. Voice changing from male to female and vice versa. I'm using the PitchShifter class but it is not giving the desired output. Following is my code:

` currentFactor = 1.5;
outputFile = createAudioFile();
bytesList = new ArrayList<>();

    // SampleRate, BufferSize, Overlap
    dispatcher = AudioDispatcherFactory.fromDefaultMicrophone(SAMPLE_RATE, BUFFER_SIZE, 0);

    //pitchShiftRatio, sampleRate, BufferSize,  Overlap
    PitchShifter pitchShifter = new PitchShifter(currentFactor, SAMPLE_RATE, BUFFER_SIZE, 1024 - 256);
    dispatcher.addAudioProcessor(pitchShifter);

    dispatcher.addAudioProcessor(new AndroidAudioPlayer(new TarsosDSPAudioFormat(
            SAMPLE_RATE, CHANNEL_CONFIG, CHANNELS, true, true), BUFFER_SIZE, AudioManager.STREAM_MUSIC));

    Thread audioThread = new Thread(dispatcher, "Audio Thread");
    audioThread.start();`

I also used the combination of RateTransposer and WaveformSimilarityBasedOverlapAdd for pitch shifting but again no desired results because I don't know how to use them properly as there is no documentation available. Kindly guide me. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant