Re: [Sndobj-devel] (no subject)
Status: Abandoned
Brought to you by:
veplaini
From: sonify <so...@av...> - 2007-01-26 23:11:14
|
Before extending sndobj with math functions, it would be as well to test how much more efficient (if at all) this would be to using Numpy, which itself is a linked library written in C and pretty fast, especially for matrix algebra. David On 27/01/2007, at 5:29 AM, Victor Lazzarini wrote: > > > At 18:03 26/01/2007, you wrote: >> victor, >> would there be any particular utility in having a series of SndObj >> that performed math like functions. I am thinking in particular for >> use with python or lisp scripting since they might not be as much use >> in c++. > > Probably useful, if it would speed up calculation. These can be > done in Python OK, but probably less efficiently > >> for instance >> >> class Asin : public SndObj{ >> public: >> >> Asin(SndObj* input, int vecsize=DEF_VECSIZE, float sr=DEF_SR); >> ~Asin(); >> >> short DoProcess(); >> >> }; >> >> Asin::Asin(SndObj* input, int vecsize, float sr): >> SndObj(input, vecsize, sr) { >> } >> >> Asin::~Asin() { >> } >> >> short Asin::DoProcess(){ >> if(!m_error){ >> if(m_input){ >> for(m_vecpos = 0; m_vecpos < m_vecsize; m_vecpos++){ >> if(m_enable) >> m_output[m_vecpos] = asinf(m_input->Output(m_vecpos)); >> else m_output[m_vecpos] = 0.f; >> } >> return 1; >> } else { >> m_error=3; >> return 0; >> } >> } >> else return 0; >> } >> >> might not be the best way to do this in some situations but in others >> it might be necessary. >> >> >> in particular, and excuse my ignorance about python (i am starting to >> learn it, btw), but do SndObj operators get imported in some way? for >> instance would the '+' below be valid in python? >> >> line = Interp(0, 10000, 0.05) >> osc = Oscili(tab, pitch, 0, None, line + .2) > > I don't think that would work in Python. It would not work in > C++ either (you have to keep adding values every control > period). > > However, I never tried the overloaded ops in Python. > > >> for the cffi bindings it is not and really needs some type of Add >> sndobj: >> >> class Add : public SndObj{ >> public: >> >> Add(SndObj* input1, SndObj* input2, int vecsize=DEF_VECSIZE, >> float sr=DEF_SR); >> Add(float input1, SndObj* input2, int vecsize=DEF_VECSIZE, float >> sr=DEF_SR); >> Add(SndObj* input1, float input1, int vecsize=DEF_VECSIZE, float >> sr=DEF_SR); >> ~Add(); >> >> short DoProcess(); >> >> }; >> >> then could be used >> >> (setf line (new_interp 0 10000 .05)) >> (setf osc (new_oscili tab pitch 0 nil (new_add line osc))) >> >> >> i have a bunch of these defined in a basic way - would they be useful >> or merely included just for the benefit of lisp. if the latter than >> maybe i could but them as separate code that SWIG would wrap? > > We can think about it. I'll check what can and can't be done in > Python. > > At the moment, it's the Intel Mac bug that is making me worry. I > really > can't see what the issue is. But then again I only hear reports. > > All the best > > Victor Lazzarini > Music Technology Laboratory > Music Department > National University of Ireland, Maynooth > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Sndobj-devel mailing list > Snd...@li... > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > _________________________________________________ experimental polymedia: www.avatar.com.au Sonic Communications Research Group, University of Canberra: www.canberra.edu.au/vc-forum/scrg vip=Verbal Interactivity Project |