[linux-audio-dev] How hard is it to write a pitch shifter?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] How hard is it to write a pitch shifter?
From: Earle (earle_AT_ezi123.com)
Date: Wed Apr 07 2004 - 07:29:25 EEST


Im new to audio dev and to linux and am using SoundTracker as my Fruiyloops
replacement. I have done a _little_ bit of dsp programming, but really want
to learn more - hence this question!

I love trackers, and use them to nut out ideas. I record loops in to
soundtracker from my record player, and if it works in the song then I
record them agin with Rezound to do necessary processing from there.

But ST doesnt support plugins, and I need to be able to do a "quick and
dirty" pitchshift on the samples to see if it's gunna fit musically in the
track.

I tracked down a bit of code in ST that does a simple fade of the currently
selected data. I want to change this to do a basic pitchshift.

    p = current_sample->sample.data;
    p += ss;
    for(i = 0; i < se - ss; i++) { //ss = selection start, se= selection
end.
        double q = *p;

        q *= THE PITCH SHIFTED SAMPLE MAGIC!

        *p++ = CLAMP((int)q, -32768, +32767);
    }

I found and implemented this bit of code for resampling, which changes the
pitch, but also the time

for(i=0; i <= MaxSamples; i++) {
        processed_buf[i]= unprocessed_buf[(int) j];
            j = j + pitch;
            if (j > MaxSamples) break;
}

But I cant find out how to deal with the missing data that is removed - to
keep the original length. Is there a (n easy) way to do this? I really dont
care too much about artifacts as it is just to get an idea of the loop at
that pitch. or should I skip pitchshifters until I learn the basics?!


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Wed Apr 07 2004 - 07:30:16 EEST