[Csnd] pitch shifting

Dear sounders!
I am trying to mimic a recorded sound by creating an impulse response based on the recording and convolving white noise. The recording is broadband in its nature, but with some tone-like characters. The synthesis works as well as can be expected, but now I want to be able to pitch shift the resulting sound. Since I don’t really use oscillators, I wonder if there are some simple tricks to apply? I tried pvscale, but I get comb filter-like artefacts that I really would like to avoid. One idea I have is to read the impulse response with diskin using pitch shift, and writing the result to a table (with e.g. tabw) and then to use dconv based on that table to get the result. The IR is about 0.5 seconds, so I suppose it should be ok, but it feels a bit cumbersome. I guess I could also do something clever with doppler to have something like a continuous approaching or receding sound…

Regards,
Anders

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

You can try a delay line pitch shifter. Look at Russell Pinkerton’s chapter in the Csound book (2000).

Prof. Victor Lazzarini
Maynooth University
Ireland

Also alternatively you can write the sound to a function table and read it with temposcal (or mincer). That uses time-domain resampling instead of frequency-domain pitch shifting.

You can do this in a streaming fashion by using tablew to write the table. Of course there will be some latency, but I suppose you’re not worried about it.

Prof. Victor Lazzarini
Maynooth University
Ireland

Thank you, Victor!
I shall explore both these avenues, though a priori I am partial to the temposcal solution.

Regards,
Anders

tors 2 juni 2022 kl. 18:59 skrev Victor Lazzarini <Victor.Lazzarini@mu.ie>:

Also alternatively you can write the sound to a function table and read it with temposcal (or mincer). That uses time-domain resampling instead of frequency-domain pitch shifting.

You can do this in a streaming fashion by using tablew to write the table. Of course there will be some latency, but I suppose you’re not worried about it.

Prof. Victor Lazzarini
Maynooth University
Ireland

Warning

This email originated from outside of Maynooth University’s Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.

Dear sounders!

I am trying to mimic a recorded sound by creating an impulse response based on the recording and convolving white noise. The recording is broadband in its nature, but with some tone-like characters. The synthesis works as well as can be expected, but now I want to be able to pitch shift the resulting sound. Since I don’t really use oscillators, I wonder if there are some simple tricks to apply? I tried pvscale, but I get comb filter-like artefacts that I really would like to avoid. One idea I have is to read the impulse response with diskin using pitch shift, and writing the result to a table (with e.g. tabw) and then to use dconv based on that table to get the result. The IR is about 0.5 seconds, so I suppose it should be ok, but it feels a bit cumbersome. I guess I could also do something clever with doppler to have something like a continuous approaching or receding sound…

Regards,
Anders

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Hi,
The liveconvolver csd at https://github.com/Oeyvind/liveconvolver has functionality for pitch shifting the IR. It is similar to what you describe in reading the sound faster/slower and then writing to a new IR. The pitching happens around line 470.
Øyvind

tor. 2. jun. 2022, 6:12 p.m. skrev Anders Genell <anders.genell@gmail.com>:

Dear sounders!
I am trying to mimic a recorded sound by creating an impulse response based on the recording and convolving white noise. The recording is broadband in its nature, but with some tone-like characters. The synthesis works as well as can be expected, but now I want to be able to pitch shift the resulting sound. Since I don’t really use oscillators, I wonder if there are some simple tricks to apply? I tried pvscale, but I get comb filter-like artefacts that I really would like to avoid. One idea I have is to read the impulse response with diskin using pitch shift, and writing the result to a table (with e.g. tabw) and then to use dconv based on that table to get the result. The IR is about 0.5 seconds, so I suppose it should be ok, but it feels a bit cumbersome. I guess I could also do something clever with doppler to have something like a continuous approaching or receding sound…

Regards,
Anders

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Hello again!
Before delving into the live convolver (and before digging up my copy oth The Csound Book) I have been trying a bit with temposcal. This is what I have so far

;;try temposcal with continuously updated table

andx lphasor 1, 0, 2*ksmps, 1, ksmps ; loop through ksmps indices

tablew asig, andx, ifTabNo ; write sound to table

atps temposcal 1, 1, p5, k(ifTabNo), 0 ; play audio from table using pitch shift

I of course need the writing to be a bit ahead of the reading for it to work, and here I just shifted the writing forward half the table size. I initialize the table with silence (sine wave of amplitude zero). Is there a smarter way to achieve this, so that e.g. the reading of the table is delayed ksmps samples?

Regards,
Anders

Öyvind,
If I understand the live convolver code correctly, pitch shifting is basically just looping through the IR table indices at different rates?
The lines

andx_source line 0, 1, idirection/gi_sourcebuf_len_sec
andx_source wrap (andx_source*ipitch)+kndx_start-ipresample, 0, 1
andx_IR line 0, 1, 1/giIR_maxlen_sec
a1 table andx_source, gi_sourcebuf, 1

in your example is what I am looking at.
Or have I misunderstood what is being done?

Regards,
Anders