[Clam-devel] improving SMSHarmonizer and another issue's

Hernán Ordiales h at ordia.com.ar
Mon Jul 2 23:15:43 PDT 2007


(warning: very long mail)

hi, some initial thoughts (i think tomorrow i'll send the first patch
about this to be checked):

My idea is to add many voices (for example 4) to this processing. Each
one with one InControl to pitch and another one for gain, so what do
you think is the best way to instantiate and manage many of them?

I didn't want to instantiate 8 InControls by hand (yep i'm a bit lazy)
so i tried with static arrays and std:.vectors but seems that them not
instantiate very well.

Then I resigned myself and i instantiate each one by hand, but i tried
to manage them with a vector (STL like) in this way:

[snip]
		std::vector<InControl*> mVoices;
		InControl mVoice1Factor; ///< Voice 1 pitch transposition factor
		InControl mVoice2Factor; ///< Voice 2 pitch transposition factor
		InControl mVoice3Factor; ///< Voice 3 pitch transposition factor
		InControl mVoice4Factor; ///< Voice 4 pitch transposition factor

[snip] (constructor)
			mVoice1Factor("Voice 1", this),
			mVoice2Factor("Voice 2", this),
			mVoice3Factor("Voice 3", this),
			mVoice4Factor("Voice 4", this),
[snip]
			mVoices.push_back(&mVoice1Factor);
			mVoices.push_back(&mVoice2Factor);
			mVoices.push_back(&mVoice3Factor);
			mVoices.push_back(&mVoice4Factor);

but then, when i wanted to iterate over them, for example in this way
(inside ConcreteConfigure):
for (std::vector<InControl*>::const_iterator mVoiceIt=mVoices.begin();
mVoiceIt!=mVoices.end();mVoiceIt++)
{
	(*mVoiceIt)->SetBounds(0.,12.);
	(*mVoiceIt)->DoControl(1.);
}

of course is compiling and working, but has no effect (InControls not bounded)

btw, are you open to introduce for example this macro:
#define foreach(m_itname,m_container) \
        for( typeof(m_container.begin()) m_itname=m_container.begin() ; \
        m_itname!=m_container.end() ; \
        m_itname++ )

then, the above code could be replaced for a more understandable
foreach( mVoiceIt, mVoices )
{
	(*mVoiceIt)->SetBounds(0.,12.);
	(*mVoiceIt)->DoControl(1.);
}


another issue, what do you think is the best approach to add peaks and
spectrum for each voice? i mean after pitchshifting them with an
embedded SMSPitchShift transformation with something like:

	TData amount = mVoice1Factor.GetLastValue();
	TData gain = mVoice1Gain.GetLastValue();
	mPitchShift.GetInControl("PitchSteps").DoControl(amount);
	mPitchShift.Do( inPeaks,
			inFund,
			inSpectrum,
			mtmpSpectralPeaks,
			mtmpFundamental,
			mtmpSpectrum);

put all it in a temporary frame?

cheers, (and thanks if you reach here!)
-- 
Hernán
http://h.ordia.com.ar
GnuPG: 0xEE8A3FE9




More information about the clam-devel mailing list