Pitchshift.ar confirmation and question

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Pitchshift.ar confirmation and question

xyzk
Hello,
I wrote this small code:

b = Buffer.read(s, "test.wav");

(
play({
    PitchShift.ar(
        PlayBuf.ar(2, 0, BufRateScale.kr(0), loop:1),
        0.1,            
        1.1,    
        0,                
        0.004            
    )
}))

The buffer contains a piano chord of 7 notes and it seems to me that the PitchShift function works good also on polyphonic signals, I wanted to know if am I right or not (my intention is just to pitch shift an incoming signal of a fixed value)
In addition I would like to know how to write the pitch shift ratio in semitones, is there a function?

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pitchshift.ar confirmation and question

Nathan Ho
On 2017-01-01 11:46, xyzk wrote:
> The buffer contains a piano chord of 7 notes and it seems to me that
> the
> PitchShift function works good also on polyphonic signals, I wanted to
> know
> if am I right or not (my intention is just to pitch shift an incoming
> signal
> of a fixed value)

Hi xyzk,

PitchShift, unlike many PSOLA-style pitch shifters, granulates
indiscriminately without estimating the fundamental frequency of the
audio. So theoretically, it should work as well on polyphonic signals as
it does on monophonic signals, but there's really only one way to find
out how it sounds.

Personally I've never managed to get any natural-sounding pitch shifting
out of it. You might be better off changing the playback rate of
PlayBuf. There are tricks you can do to prevent it from sounding cheesy.
One idea (I've never tried it) is to "unfilter" the buffer and add the
resonances back in after playback. That way the resonances don't scale
with the playback rate, mitigating some of the cheesiness.

> In addition I would like to know how to write the pitch shift ratio in
> semitones, is there a function?

Yes, it's "midiratio."


Nathan

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pitchshift.ar confirmation and question

daniel-mayer
In reply to this post by xyzk

Am 01.01.2017 um 20:46 schrieb xyzk <[hidden email]>:

> The buffer contains a piano chord of 7 notes and it seems to me that the
> PitchShift function works good also on polyphonic signals, I wanted to know
> if am I right or not (my intention is just to pitch shift an incoming signal
> of a fixed value)


Yes, in principle, but it's a rough way and, as Nathan said, might not be convincing regarding timbre.
Though you can fiddle PitchShift's params to improve the sound (depends on source of course)


// check with your sources also

{ Saw.ar([60, 64].midicps, 0.1) }.play


// semitone shift, timbre already changed

{ PitchShift.ar(Saw.ar([60, 64].midicps, 0.1), pitchRatio: 1.midiratio) }.play


// pure fifth shift, harmonic relation totally collapsed ...

{ PitchShift.ar(Saw.ar([60, 64].midicps, 0.1), pitchRatio: 7.midiratio) }.play


// with some fiddling get the third back for the price of changing spectrum

{ PitchShift.ar(
        Saw.ar([60, 64].midicps, 0.1),
        pitchRatio: 7.midiratio,
        pitchDispersion: 2e-3,
        timeDispersion: 2e-3
) }.play



Regards

Daniel

-----------------------------
www.daniel-mayer.at
-----------------------------






_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pitchshift.ar confirmation and question

xyzk
In reply to this post by Nathan Ho
Thanks Nathan and Daniel!
Actually I don't want a real sound but I want to join the shifted sound with the original sound to have an harmonizer-like sound, so PitchShift sounds great for this purpose i think :)

Anyway you are both great for the fast and fantastic replies.

Wish you a happy new year!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pitchshift.ar confirmation and question

Nathan Ho
In reply to this post by Nathan Ho
On 2017-01-01 12:14, Nathan Ho wrote:
>
> PitchShift, unlike many PSOLA-style pitch shifters, granulates
> indiscriminately without estimating the fundamental frequency of the
> audio.

I worded this too ambiguously. For future reference, I mean that
PitchShift is *not* PSOLA. It is overlap-add, but not pitch-synchronous.


Nathan

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Loading...