Csound Csound-dev Csound-tekno Search About

Re: batch processing / rendering CSDs using Python

Date2007-10-24 11:46
FromVictor Lazzarini
SubjectRe: batch processing / rendering CSDs using Python
Csound.Perform() performs a whole score and
then returns. It's not like csoundPerformThread(),
because it does not spawn a separate thread.

> Could you test if your setup works * without the loop* ?
> e.g.
>
> import csnd
> import os
> csound = csnd.CppSound()
> def mainline():
>    csound.setPythonMessageCallback()
>    csdfile = open('filename,'r')
>    csd = csdfile.read()
>    csdfile.close()
>    csound.setCSD(csd)
>    csound.exportForPerformance()
>    csound.perform()
>    return
>
> I haven't tested the code above. Is it complete, or do you
> have other things happening at the same time. Maybe you
> could supply a simple test.csd, and I could try to test it
> here. You set up and run csound a little differently than
> I do, and I can't determine if there's anything wrong just
> by looking. Is the csound.perform() call equvalent to:
> performanceThread = csnd.CsoundPerformanceThread(csound)
> performanceThread.Play()
> ?
>
> I'm not sure, but when you want to batch process several
> csd files, you should maybe do :
> csound.Reset()
> csound.Cleanup()
> in between each csd.
>
> best,
> Oeyvind
>
>
> 2007/10/24, Tim Mortimer :
> >
> > thanks Jonathon - but that didn't work
> >
> > I think somehow i need to defer the loop iteration until
> > the conclusion of the csdfile rendering / playback so
> > some sort of scheduling or something might be in order
> >
> > so, err yeah.
> >
> > Oeyvind, if you read this & finish your debugging
> > exercise anytime soon i'd love 5 minutes of your time.
> >
> > Michael G - well, never responds to any of these types
> > of python / csnd queries of mine it seems.
> >
> > That's fine. I'll keep asking anyway. If these abortive
> > threads of mine prove to be nothing other than a catalog
> > of things i couldn't do with csnd, it will still
> hopefully be of some value to someone in the future on
> > that basis alone.....
> >
> > Im afraid when i open csnd.py looking for greater
> > insight i don't see much that resembles my "python for
> > idiots / dummies / pygmies / giants / antelopes ...."
> book(s)..... >
> >
> > Jonathan Murphy-2 wrote:
> > >
> > > I'm not a python person, but on the perhaps spurious
> > > assumption that a for loop is a for loop, it looks to
> > > me like csd will no longer be valid when you pass it
> > > to csound. If the rest of your code is ok, maybe
> something like this, closing the file when you're done
> > with it: >
> > >     for filename in dirlist:
> > >         csdfile = open('aaa CSDs 2 render/'+filename
> > >         ,'r') csd = csdfile.read()
> > >         csound.setCSD(csd)
> > >         csound.exportForPerformance()
> > >         csound.perform()
> > >         csdfile.close()
> > >
> > > Hope this helps,
> > > Jonathan.
> > >
> > > Tim Mortimer  writes:
> > >
> > >
> > >
> > >
> >
> > --
> > View this message in context:
>
http://www.nabble.com/batch-processing---rendering-CSDs-using-Python-tf4675931.html#a13382201
> > Sent from the Csound - General mailing list archive at
> Nabble.com. >
> > --
> > Send bugs reports to this list.
> > To unsubscribe, send email to
> csound-unsubscribe@lists.bath.ac.uk >
> --
> Send bugs reports to this list.
> To unsubscribe, send email to
> csound-unsubscribe@lists.bath.ac.uk