Exact pitch shift on sound file?

Ben Nigel Potts's icon

Hello,

I'm looking for a way to pitch shift sound files in a certain ratio.
I need to be able to take a recording, find it's fundamental frequency, and then create a duplicate file with the frequency multiplied it by something like 1.2

E.g.
Original file = 1000hz
1000 x 1.2 = 1200
Duplicate file = 1200hz
Is there a way to do these micro-shifts in Max? Will it sound really artificial?
I imagine I'll need a way to 'read' the files fundamental first, and then use a method to shift the frequency?

Always, any help or advice in the right direction would be really appreciated!

Thanks and best,

Ben

Ben Nigel Potts's icon

Also it needs to not effect the speed of the file

Simon Blakely's icon

Use the "pitchshift~" object.

If you are shifting your source material by a constant ratio, you don't need to identify the fundamental frequency first - I.e. just set the pitchscale to 1.2.

Your results will vary depending on the source. For human voice, you will get a chipmunk effect as the "formants" get shifted as well as the fundamental. It is somewhat frustrating that pitchshift~ (based on the dirac library) does not provide formant correction.

Ben Nigel Potts's icon

Hi Simon,

Thanks for your reply.

I can't find pitchshift~ object, I'm using Max 6 if that makes a difference?
I've been using Gizmo~ (the patch from the help file) which works well and lets me set the ratio as you suggest, but does have problems with formants.
Are there objects that preserve formants? Maybe I'd be better to use a VST and DAW for this task?

Best,

Ben

Roman Thilenius's icon

when you are talking about "finding the fundametal", does that mean your materials are pure tones? those are very difficult to pitch shift (as well as varous other processes and analysis forms, for example measuring their power or distorting them)

Simon Blakely's icon

Ben,

As you haven't been very specific about the material you are pitch shifting, it is hard to make good suggestions.

I am currently working on a pitch shifter external based on the rubberband opensource time/pitch change library. It does include formant correction, but the results are not dramatic on my vocal material. I am not totally convinced on the principles they are using to preserve the spectral envelope - it seems like it should work, but very little about FFTs is actually simple in practice. I'm going to keep trying to come up with something better.

In the meantime, I'll probably release the code I have this weekend, but the external will be Windows only.
I'll also be including a pitchtracker external for voice fundamental identification - it has some features to avoid some of the pitfalls of fzero~

If you are not performing your transformations in realtime, Max 7 (I don't know about 6) has stretch~ which does include formant correction, but I have never played with it, as I want realtime performance.

Simon

Ben Nigel Potts's icon

I have two projects in which I want I do this.
Firstly, an indian instrument recording and secondly, concrete sound recordings such as metal sheets.
It needs to be able to carry out the exact ratio I want and be as close to the original source sound as possible.

Is your software able to do this Simon, or perhaps I should look at Max 7?

The easiest way for me would be an out of the box plug inn (and I have a small budget for that) but I can't find any that can work with ratios rather than notes etc.

Best,

Ben

Wil's icon

there is a really old school pitch shifter out there that i was using before max 7. worked really well to fine tune ratios. all my stuff is in storage (hard drive somewhere) but originally found it on forums. will try to find it again.

btw. have you tried analyzer~ or pitch~ to detect your fundamental pitch?
http://web.media.mit.edu/~tristan/maxmsp.html

Simon Blakely's icon

I don't know how my toolset will work for that material - it is particularly tuned for vocals. However, you can try.

I'll be releasing the externals and some demo M4L devices later today, so you can give them a try.

Simon

Simon Blakely's icon

Ben,

Give them a test to see how they work (sorry, currently Windows only for these externals).

Simon

vichug's icon

if you are not on Windows, this might help : https://cycling74.com/tools/grainstretch/
also, what you want is now built-in in Max 7. I'm nearly sure you can even ask it wiht ratios ! Anyway, working wiht ratio instead of repitching by cents or hertz is just a matter of mathematic conversion.

Ben Nigel Potts's icon

VICHUG,

That seems very much like what I imagined. I've just downloaded it and it seems to be effective! I will have a play tomorrow.

Thanks for all the input from everyone.

Best,

Ben