Hi @jan ,
For a FluidPitch and FluidBufPitch example, check out (also in the helpfiles!):
Use the pitch and confidence descriptions to control some filtered noise.
code::
// load some audio
~scratchy = Buffer.read(s,FluidFilesPath("Tremblay-ASWINE-ScratchySynth-M.wav"));
// synth to do the analysis and drive the BPF
(
{
var src = PlayBuf.ar(~scratchy.numChannels,~scratchy,BufRateScale.ir(~scratchy),loop:1);
var sig, freq, conf, windowSize = 1024;
var latency = windowSize / SampleRate.ir;
# freq, conf = FluidPitch.kr(src,windowSize:windowSize);
freq = freq.lag(0.03);
sig = BPF.ar(PinkNoise.ar(1),freq.clip(1,20000),0.1,conf);
[DelayN.ar(src,latency,latency),sig];
}.play;
)
::
This file has been truncated. show original
code::
(
// load a sound file
~scratchy = Buffer.read(s,FluidFilesPath("Tremblay-ASWINE-ScratchySynth-M.wav"));
// and a buffer to write the FluidBufPitch features into
~pitch_features_buf = Buffer.new(s);
// specify some params for the analysis (these are the defaults, but we'll specify them here so we can use them later)
~windowSize = 1024;
~hopSize = 512;
)
(
// run the analysis
FluidBufPitch.processBlocking(s,~scratchy,features:~pitch_features_buf,windowSize:~windowSize,hopSize:~hopSize);
~pitch_features_buf.loadToFloatArray(action:{
arg fa;
~pitch_features_array = fa.clump(~pitch_features_buf.numChannels);
This file has been truncated. show original
Regarding partials, there currently doesn’t exist an object that provides that information directly (the frequency values and what not). Sines does that kind of analysis and then has the resynthesis bundled in.
To get the frequency values and their amplitudes, check out Nick Collins TopNFreqs: https://composerprogrammer.com/code/TopNFreq.zip
I use it and think it sounds pretty nice!