aboutsummaryrefslogtreecommitdiff
path: root/site/udo/pvs_tools.udo
blob: 2fcbc8ad5c9debe7f6a365278b9df3218a3bb238 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef UDO_PVSTOOLS
#define UDO_PVSTOOLS ##
/*
	Phase vocoder tools

	This file is part of the SONICS UDO collection by Richard Knight 2024
		License: GPL-2.0-or-later
		http://1bpm.net

*/


opcode pvs_ifn2buffer, i, iiiii
	ifn, ifftsize, ioverlap, iwinsize, iwinshape xin
	ktimek timeinstk
	if (ktimek == 1) then
		ilen = ftlen(ifn) / ftsr(ifn)
		kcycles = ilen * kr
		kcount init 0
		while (kcount < kcycles) do
			apos lphasor 1
			ain table3 apos, ifn
			ffin pvsanal ain, ifftsize, ioverlap, iwinsize, iwinshape
			ibuf, ktime pvsbuffer ffin, ilen + (ifftsize / sr)
			kcount += 1
		od
		xout ibuf
	endif
endop

#end