Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Phase Vocoder help

Date1999-11-04 22:00
Fromrichard bowers
SubjectRe: [Csnd] Phase Vocoder help
Dear Bob,

I hope this will help. This is the simplest kind of phase vocoder orchestra.
I shall assume that the analysed audio segment is 5 seconds long, 44100 kHz,
mono and the analysis has been named "sound.pva". The crucial thing is the
passage of the pointer through  time. Looking at the manual entry for the
pvoc unit

ar      pvoc       ktimpnt, kfmod, ifilcod

ktimpnt is the k-rate pointer through the analysis file. You need to control
the speed at which the analysis is being read. A simple way of doing this is
using the line opcode as follows:

ktimpnt    line    0, p3, 5

This will read through the analysis file from start to finish (5 seconds)
over duration p3 (specified in the score). In other words, if you give the
value 10 to p3 in the score it will take 10 seconds to read through the 5
second file. That's timestretch.

Conversely, the pitch can be modified using the kfmod parameter. This
modifies the pitch by the specified ratio, which is also a krate variable.
In other words if you make kfmod 2, the sound will be output an octave
higher, 0.5 an octave lower and anything else for pitches other than the
octave. We shall use p4 in the score for pitch transposition.

So to implement this as a orchestra we get:
;***********
sr=44100
kr=4410
ksmps=10

instr    1
ktimpnt    line    0, p3, 1
asig      pvoc       ktimpnt, p4, "sound.pva"
out    asig
endin
;***********

The score may be something like:
;***********
i1    0    5    1; normal output ie. 5 secs at normal pitch
i1    5    10    1; normal pitch twice as long
i1    15    5    .5; normal duration octave lower
i1    20    2.5    .78 ; changed duration and changed pitch
e
;***********
Hope that helps, but remember...that's only the beginning. You don't have to
limit yourself to uniform timestretch or pitch shifts. You can access the
analysis arbitrarily to hack the sound up or whatever. Also, the related
opcodes give you much more control such as accessing individual spectral
components from the analysis or morphing between different analyses. Have
fun.

Richard Bowers

> Hello all.
> I am new to Csound,  and I was wondering if anyone could help me with
pvoc.
> I've gone through the tutorials, and all of them have tooted just fine.
If
> anyone has an .orc/sco that reads in a file and changes its length or
pitch,
> it would be greatly appreciated! (I've gotten to the point of analyzing a
> soundfile on my own, now i just need some hints on what to do next.)
>
> I am running windows 95 on a 200Mhz PII with 64 Mg of ram, CSound ver 3.58
>
> Thanks in advance,
>
> Bob Dornberger
> bob@pantu-tanosimi.com
>
> --
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>

--