Csound Csound-dev Csound-tekno Search About

[Csnd] Python - Help! Creating a nestable "Pattern" class

Date2008-01-01 03:19
FromTim Mortimer
Subject[Csnd] Python - Help! Creating a nestable "Pattern" class
I have started trying to implementing a class in my "Parseval" environment
called Pattern

Patterns are initially defined in a purely "self-referential" way, & are
tagged accordingly as "motif", - they know to simply look "within
themselves" for their definition. (octaves, pitches, voicepaths, possibly a
short rhythm fragment...)

But my aim is to be able to construct more Patterns based upon one or more
existing Patterns, with the definition simply advising a list of changes & /
or concatonations, in order to

1) avoid consistantly duplicating data inherited from one pattern to the
next

2) enabled changes to a pattern lower in the heirarchy to be reflected in
those who inherit their information from it.

so one might see things (defined in a "Pattern Book" txt file) like this

>>>

* First, here is a brief durations legend:
t = tie note over (if same note available in same voice in next, else
release on next)
n = release on next
r = terminate note on release
. = rest

{note: this "conditional durations" format allows for "sequencing" of
Patterns in realtime & re-configurable ways - the Pattern is an
"abstraction" , & the voices within it can ultimately be realised by one or
more instruments}

# pat: type, 	name,	id

pat:	PC		A		i

	a	b	c	d			# Voices
	00	03	07	10			# pch's
	8	8	8	8			# octv
	n	n	n	n	0		# durations (& starttime at [-1])
	
	
pat: 	PC	B	i

	a	b	c	c	d
	00	03	05	06	10
	8	8	8	8	8
	t	t	n	.	n	0		# durations (& starttime at [-1])
	n	n	.	n	n	1/4		# durations (& starttime at [-1])

				
				
var:	PC	B	ii	(i) # (i) = based on B i above 

	Starts: 0, 1/8	
	
+:	PC	+AB	i

	A	i	0
	B	ii	1/4

EOF

>>>>

in the example above therefore, 

* Pattern A(i) & B(i) are defined
* var B(ii) adjust the "motif rhythm" slightly
* Pattern "+AB" concatonates requested versions of A & B

now, this could all build up to something quite complex!

but mainly i'm concerned about how to resolve the paths of this
"inheritance" to acquire all the necessary data to build the Pattern from
it's "nest of references". Particularly when something as innocuous looking
as

+:	+PatternOfDeath

	M	i	0
	
	b	16/1		# advance the global clock 16 "wholenotes"
	
	N	i	0
	
might in actuality need to concatenate from a history not just involving 2
separate patterns, but a complex heirarchy of inheritance maybe drawing on
15,16,17..... n other patterns.... (off the top of my head & as an example)

I've seen some Python tuition & examples talking about nodes & trees and
that sort of thing ("How to think like a computer scientist " for example)
but i'd be keen to adopt any considered "best practice" here sooner rather
than later - is this a classic/familiar model of implementation of a "basic
computing paradigm" at all? As essentially what i am constructing here is
pretty rhizomatic, albeit not entirely, as it has discernable "starting
points" - but traversal primarily needs to be "from the leaves" back down to
one (or more) of these "starting points" (ie back to those patterns tagged
as "motifs", from which ultimately all these further other patterns were
derived)

My hunch is this might be something like the PolyObject in Blue? (in that as
far as I might hazard a guess, the Separate Objects within the Poly are not
"duplicated", simply "pointed at", & the reference link can become fairly
lengthy....)

I guess the difference in my scenario is the whole "basically the same, but
different" mentality behind this.

The heirarchy in & of itself may appear potentially complex & unwieldly, but
you can:

* analyse the existing "Mosaic" of Patterns (summoned from one or more
"Pattern Books") for horizontal & vertical Pitch Set useage, interval
patterns etc... enabling "self similarity" to be explored & encouraged when
working from a basis of PC set useage ("the same, but different")

* sequence Patterns together (basically using the "+:" Pattern Concatenation
method in conjunction with the b statement as illustrated above...) to
create a realisable "piano reduced score" (or a late Feldman piano work ; )
.....)

* assign Patterns to MIDI keys, & string them together in "Real Time" to
effectively "jam out" a kind of "voiceled piano reduced score" as i
mentioned immediately above (& that is why, at the Pattern level of
abstraction, all durations take on conditional rather than absolute
values... a principle that is fairly universal throughout Parseval,
generally linking durations to things like next note, or bar markers, or
tie-ing to next note etc etc... with supplemental + or - adjustments to the
relative marker (eg "n-1/16")

These are all processes I had working(!) within my current basic "Pattern"
setup, but introducing the "historic-referentiality" has made me feel a bit
confused. (& my Modules are somewhat "gutted" at the moment as i endeavour
to explore the concept...)

the whole process addresses one of the fundamental aims I hoped to achieve
with my Parseval environment - the ability to catalogue & construct a piece
of music from "elements disembodied from time" that pertain to things like
pitch sets, rhythm patterns, & variations that can be expressed & called
again & again from them quickly & easily. 

All from a concisely notated set of definitions in .txt file - sequenceable
from simple .txts, parseable to multi-instrumental scores (MIDI or Csound),
or useable in realtime instrumental sketches to create "score recordings". 

phew! I'm really hoping for some valuable insight here. Parseval is
something of a "vast compositional flatland" i have created for myself at
the moment. this "extra - temporal dimension" achievable through
self-referential Pattern building is just what i need to bring the exercise
one very significant step further towards completion.

I would REALLY appreciate any thoughts or guidance as to how this.

So, to try & summarise: 

"How do I define an object, based on another object, but with changes to it,
& keep the new "object" simply as a record of what the "source" object was,
& what changes or additions to it were implemented (which may in turn refer
to another pattern based on another source, with it's changes implemented..
all the way back down the heirarchy to one or more "source" patterns (tagged
as "motif")...) & expore this nested definitions tree in reverse to compile
a "full" object based on the definitions simply when & if it is required?

The slightly curly aspect of course is that the Pattern object might be a
concatonation of 2 other objects... & that is when it starts getting really
complicated....

or do i just say "stuff it", & embark on a mass of duplication, with a
concatonated "history of evolution" for each new duplicate pattern created?

Help! Does anybody understand???

Help dig me out of this hole!


	
	
	


	


-- 
View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14564226.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-01-01 10:07
FromTim Mortimer
Subject[Csnd] Re: Python - Help! Creating a nestable "Pattern" class
I think i've worked out what needs to happen.

Patterns must only refer to data held away from themselves (by some sort of
index that looks up the master "dataset" for that pattern parameter.. like
pitch classes, or rhythms, or whatever...)

That way when a pattern is "deepcopied" all that comes along are a bunch of
index references...

concatonation of patterns just results in a pattern with a list of sucessive
indices/ exes (?)

new patterns check for existing matching entries for each parameter in the
already existant Datasets. If there is a match - the index of the existant
match is simply recorded. This way the system can become analytical as well
as generative (which is a welcome byproduct....)

any definition of alternate pattern variation just records that variation in
the appropriate "dataset", & logs the reference in the pattern to the new
index...

anyway, i'll give it a shot. Have i just "solved" the problem? (i made an
earlier post with some thoughts too but it seems to have dissapeared into
the ether. I apologise if it also shows up & i look even MORE like a
babbling buffoon..... )

If anyone had a particularly boring new years feel free to offer the
concept(s) some consideration (I stayed home glued to the computer &
desperately trying to work this through as far as possible....)



-- 
View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14565522.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-01-01 10:54
FromDavidWorrall
Subject[Csnd] Re: Re: Python - Help! Creating a nestable "Pattern" class
Hi Tim,
Not sure I understand the complexity of your problem. It is a string  
rewriting system? Does this describe it:
Use a bunch of methods to (rewrite, add to, delete from) a data  
string, that data string being either actual data or pointers to  
methods for rewriting, rearranging bits of the data string and then  
eventually decode string into some set of musical parmeters?

Hippy New Ear,

David
On 01/01/2008, at 9:07 PM, Tim Mortimer wrote:

>
> I think i've worked out what needs to happen.
>
> Patterns must only refer to data held away from themselves (by some  
> sort of
> index that looks up the master "dataset" for that pattern  
> parameter.. like
> pitch classes, or rhythms, or whatever...)
>
> That way when a pattern is "deepcopied" all that comes along are a  
> bunch of
> index references...
>
> concatonation of patterns just results in a pattern with a list of  
> sucessive
> indices/ exes (?)
>
> new patterns check for existing matching entries for each parameter  
> in the
> already existant Datasets. If there is a match - the index of the  
> existant
> match is simply recorded. This way the system can become analytical  
> as well
> as generative (which is a welcome byproduct....)
>
> any definition of alternate pattern variation just records that  
> variation in
> the appropriate "dataset", & logs the reference in the pattern to  
> the new
> index...
>
> anyway, i'll give it a shot. Have i just "solved" the problem? (i  
> made an
> earlier post with some thoughts too but it seems to have dissapeared  
> into
> the ether. I apologise if it also shows up & i look even MORE like a
> babbling buffoon..... )
>
> If anyone had a particularly boring new years feel free to offer the
> concept(s) some consideration (I stayed home glued to the computer &
> desperately trying to work this through as far as possible....)
>
>
>

_________________________________________________
experimental polymedia:	www.avatar.com.au
Sonic Communications Research Group,
University of Canberra:	 creative.canberra.edu.au/scrg/



Date2008-01-01 17:08
FromPanos Katergiathis
Subject[Csnd] Csound 5.07 on Ubuntu 7.10
Hello all

A person asked (a while ago) on the Ubuntu forums how would it be 
possible to install the latest Csound - that is, because the "properly" 
maintained package is way too old

So here is how, in case anyone is interested.

- Start by downloading the appropriate tar.gz file from 
http://csound.sourceforge.net

- Unpack it (on the desktop)

- Use Ubuntu's package manager in order to locate and install all 
packages that start with 'libfltk1.1'

- Open a console and enter the proper unpacked directory (the name of it 
should be 'linux_d32' (i use the d species...)

- Run the installer as ROOT. A graphic window will appear, where you 
should select (check) the 'Install in system files' option, as well as 
all the rest of the checkboxes. Then proceed. After a few seconds a 
second graphic window will appear mentioning something about the 
possibility of installing a bunch of optional libraries. Select ALL of 
them before re-pressing 'install'. Then the installation will be finished.

At this point, use the console (which should still be open) and type:

sudo ldconfig 

and then type

csound 

and you will get an error about a missing .so file.
This file actually exists in the /lib folder of the unpacked csound 
installer. So, type the following:

sudo cp ~/Desktop/linux_d32/lib/libcsound64.so.5.1 /usr/local/lib/ 
sudo cp ~/Desktop/linux_d32/lib/libcsound64.so /usr/local/lib/ 
sudo ln -s /usr/local/lib/libcsound64.so /usr/lib 
sudo ln -s /usr/local/lib/libcsound64.so.5.1 /usr/lib 
sudo ldconfig 

and then re-type : csound 

where you should get the following large error list before the 
(appropriate) error that you have not specified enough parameters in 
order for csound to run:
....

WARNING: could not open library '/usr/local/csound/librtjack.so' 
(libjack.so.0: cannot open shared object file: No such file or directory)
WARNING: could not open library '/usr/local/csound/libosc.so' 
(liblo.so.0: cannot open shared object file: No such file or directory)
virtual_keyboard real time MIDI plugin for Csound
WARNING: could not open library '/usr/local/csound/libfluidOpcodes.so' 
(libfluidsynth.so.1: cannot open shared object file: No such file or 
directory)
PortMIDI real time MIDI plugin for Csound
WARNING: could not open library '/usr/local/csound/librtpa.so' 
(libportaudio.so.2: cannot open shared object file: No such file or 
directory)
WARNING: could not open library '/usr/local/csound/libloris.so' 
(libfftw3.so.3: cannot open shared object file: No such file or directory)


....

Despite the frightening look, all this is only complaining about several 
missing libraries. Fortunately all of them are available via Ubuntu's 
package manager. So, open it again in order to locate and install the 
following packages:

fftw3 (all of them)
libjack0 (all of them)
liblo0 (all of them)
libfluidsynth1
libfluidsynth-dev

libportaudio-dev
libportaudio-doc

libportaudio2
libportaudiocpp0

Then, again, do the

sudo ldconfig 

and then re-run

csound 

where you will notice that all errors are gone.

So, here it is, a working csound installation on Ubuntu 7.10



Regards to all

Panos

Date2008-01-02 01:39
FromTim Mortimer
Subject[Csnd] Re: Re: Python - Help! Creating a nestable "Pattern" class
Thanks David,

My idea was to kind of "soft copy" an object (a "Pattern" object - with info
about start times, voices & voice leading, conditional duration info (tie
over where possible, play till next...) . 

all the data in the object (starts, durs, voiceleading etc) is held either
in a list, or a small dictionary (for voiceleading...)

So that the "soft copy" would know "all my info is the same as this already
existant pattern, but my rythm is varied to "xyz" " .... or "i am this
pattern joined to this pattern" or "i am this chord re-octivated"

So that a large amount of duplication could then be avoided. & a "motif
development history" could be compiled

I thought some sort of rhizomatic pointer system might then be able to back
fill all the "data links" with the required detail when it comes to
realisation of these patterns - basically compiling into a voiceled score, &
then the score is processed using the existing arm of Parseval that i'm
already using. (extra expressive dynamic markers added, what instruments to
use, cripple the odd symmetry etc etc...)

I think it might be a case of "nice idea in theory", but eventually to
"backtrack" through the data, sooner or later some pointer or other is going
to be needed.

My solution to date therefore is "every pattern is unique(deepcopy) of its
originator(s) but the data itself in the pattern (starttime lists, chord
pchs etc) is simply a pointer to the info held in a repository somewhere
outside of the pattern object.

This means if i copy a Pattern, & change it's rhythm reference, still only
one entry exists in the dataset to fill both patterns with the relevant oct,
pch, & voiceleading info....

I can't think of another way to do it. It's not as economical as any
"historical self-awareness" i might wish patterns to carry round with them,
but it's probably quicker & easier to calculate, & not as encumbering as
actually copying the data "note for note" into numerous pattern
duplications....

Let me know if you have any other thoughts or suggestions.... Thanks for
taking the trouble to give my dilemma some consideration.

I'm beginning to think i could have bolted my score & scripting syntax onto
AthenaCL as the engine somehow.... It still would have been a lot of work.
Possibly even more work. & Athena doesn't deal with "tied notes" or
"conditional durations" at all / have a "real time interactive"
component....

& I'm sure there will be some discoveries & unique features that will emerge
having done it all myself from the ground up. Looking at Athena's internals
initially left me a bit lost. Maybe now (after a few hundred hours of Python
flying time) it may not be so daunting... but i'm 80% of the way home here,
so on i shall trudge... even if i am re-inventing the odd wheel on the way.

After all, if i want to use some crazy generator to make up a rhythm
pattern, i can still use Athena to do that quite easily... but my idea about
"Algorithmic composition" is more along the lines of where i am taking
Parseval. i.e - a tool for the development, analysis, & self referentiality
of basic human musical ideas.

Making purses out of sow's ears basically.

Which gives the name "Parseval" another layer of appropriateness i think....
This kind of layered self referentiality & transformation is definately
something that informs what i am trying to do here. & The affirmations &
complexities of serendipity are definately welcomed in this view.

Anyway, back to the cricket....


Hi Tim,
Not sure I understand the complexity of your problem. It is a string  
rewriting system? Does this describe it:
Use a bunch of methods to (rewrite, add to, delete from) a data  
string, that data string being either actual data or pointers to  
methods for rewriting, rearranging bits of the data string and then  
eventually decode string into some set of musical parmeters?

Hippy New Ear,

David
On 01/01/2008, at 9:07 PM, Tim Mortimer wrote:

>
-- 
View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14572387.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-01-02 02:34
FromDavidWorrall
Subject[Csnd] Re: Re: Re: Python - Help! Creating a nestable "Pattern" class
Hi Tim,
The trouble with trying to describe something concretely is that your  
concrete is not the same as mine, so I may be off-song.
Imagine a string "Da Fa(Da, 3) Fb (Fa, 23, 10.1), Db, Fc(Fb, Db)...."
where Da, Db are data structures, Fa,Fb, Fc are  functions on these  
and themselves
so in order to (eventually) generate a musical sequence you scan along  
the string generating a musical structure, or a replacement of some  
part of the string.
Does that describe a workable process?

Aust. 2nd test, 1st innings: 3/119, 4/119 - India's on a hat-trick!

David

On 02/01/2008, at 12:39 PM, Tim Mortimer wrote:

>
> Thanks David,
>
> My idea was to kind of "soft copy" an object (a "Pattern" object -  
> with info
> about start times, voices & voice leading, conditional duration info  
> (tie
> over where possible, play till next...) .
>
> all the data in the object (starts, durs, voiceleading etc) is held  
> either
> in a list, or a small dictionary (for voiceleading...)
>
> So that the "soft copy" would know "all my info is the same as this  
> already
> existant pattern, but my rythm is varied to "xyz" " .... or "i am this
> pattern joined to this pattern" or "i am this chord re-octivated"
>
> So that a large amount of duplication could then be avoided. & a  
> "motif
> development history" could be compiled
>
> I thought some sort of rhizomatic pointer system might then be able  
> to back
> fill all the "data links" with the required detail when it comes to
> realisation of these patterns - basically compiling into a voiceled  
> score, &
> then the score is processed using the existing arm of Parseval that  
> i'm
> already using. (extra expressive dynamic markers added, what  
> instruments to
> use, cripple the odd symmetry etc etc...)
>
> I think it might be a case of "nice idea in theory", but eventually to
> "backtrack" through the data, sooner or later some pointer or other  
> is going
> to be needed.
>
> My solution to date therefore is "every pattern is unique(deepcopy)  
> of its
> originator(s) but the data itself in the pattern (starttime lists,  
> chord
> pchs etc) is simply a pointer to the info held in a repository  
> somewhere
> outside of the pattern object.
>
> This means if i copy a Pattern, & change it's rhythm reference,  
> still only
> one entry exists in the dataset to fill both patterns with the  
> relevant oct,
> pch, & voiceleading info....
>
> I can't think of another way to do it. It's not as economical as any
> "historical self-awareness" i might wish patterns to carry round  
> with them,
> but it's probably quicker & easier to calculate, & not as  
> encumbering as
> actually copying the data "note for note" into numerous pattern
> duplications....
>
> Let me know if you have any other thoughts or suggestions.... Thanks  
> for
> taking the trouble to give my dilemma some consideration.
>
> I'm beginning to think i could have bolted my score & scripting  
> syntax onto
> AthenaCL as the engine somehow.... It still would have been a lot of  
> work.
> Possibly even more work. & Athena doesn't deal with "tied notes" or
> "conditional durations" at all / have a "real time interactive"
> component....
>
> & I'm sure there will be some discoveries & unique features that  
> will emerge
> having done it all myself from the ground up. Looking at Athena's  
> internals
> initially left me a bit lost. Maybe now (after a few hundred hours  
> of Python
> flying time) it may not be so daunting... but i'm 80% of the way  
> home here,
> so on i shall trudge... even if i am re-inventing the odd wheel on  
> the way.
>
> After all, if i want to use some crazy generator to make up a rhythm
> pattern, i can still use Athena to do that quite easily... but my  
> idea about
> "Algorithmic composition" is more along the lines of where i am taking
> Parseval. i.e - a tool for the development, analysis, & self  
> referentiality
> of basic human musical ideas.
>
> Making purses out of sow's ears basically.
>
> Which gives the name "Parseval" another layer of appropriateness i  
> think....
> This kind of layered self referentiality & transformation is  
> definately
> something that informs what i am trying to do here. & The  
> affirmations &
> complexities of serendipity are definately welcomed in this view.
>
> Anyway, back to the cricket....
>
>
> Hi Tim,
> Not sure I understand the complexity of your problem. It is a string
> rewriting system? Does this describe it:
> Use a bunch of methods to (rewrite, add to, delete from) a data
> string, that data string being either actual data or pointers to
> methods for rewriting, rearranging bits of the data string and then
> eventually decode string into some set of musical parmeters?
>
> Hippy New Ear,
>
> David
> On 01/01/2008, at 9:07 PM, Tim Mortimer wrote:
>
>>
> -- 
> View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14572387.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"
>

_________________________________________________
experimental polymedia:	www.avatar.com.au
Sonic Communications Research Group,
University of Canberra:	 creative.canberra.edu.au/scrg/



Date2008-01-02 06:53
FromTim Mortimer
Subject[Csnd] Re: Re: Re: Python - Help! Creating a nestable "Pattern" class
Just quickly David i have been making notes & exploring ideas further this
afternoon, & i think what i'm talking about may relate to "pattern
matching", & the capacity in doing so to economise recording (or more
importantly avoiding repeat recording) of data on that basis... "i know
this, it's this" .... & so just recording a pointer to it... & in doing so,
reaffirming it's "motific" status from an analysis point of view....

i'm working on some examples. 

have to make a guest appearance at work tomorrow to earn my $17 an hour
answering emails. but will be in touch further once i have something.

yes im afraid your concrete still sounds a bit like souflee to me. &
probably vice versa. This is, of course, the main problem when you have to
simply work things out for yourself. Another suitably Parsevalian
reference....

So does what your saying relate to what i'm saying? i'll settle for a link
to some explanatory explanation....

gotta go pick up my mum from the airport. will be back later....




David Worrall wrote:
> 
> Hi Tim,
> The trouble with trying to describe something concretely is that your  
> concrete is not the same as mine, so I may be off-song.
> Imagine a string "Da Fa(Da, 3) Fb (Fa, 23, 10.1), Db, Fc(Fb, Db)...."
> where Da, Db are data structures, Fa,Fb, Fc are  functions on these  
> and themselves
> so in order to (eventually) generate a musical sequence you scan along  
> the string generating a musical structure, or a replacement of some  
> part of the string.
> Does that describe a workable process?
> 
> Aust. 2nd test, 1st innings: 3/119, 4/119 - India's on a hat-trick!
> 
> David
> 
> On 02/01/2008, at 12:39 PM, Tim Mortimer wrote:
> 
>>
>> Thanks David,
>>
>> My idea was to kind of "soft copy" an object (a "Pattern" object -  
>> with info
>> about start times, voices & voice leading, conditional duration info  
>> (tie
>> over where possible, play till next...) .
>>
>> all the data in the object (starts, durs, voiceleading etc) is held  
>> either
>> in a list, or a small dictionary (for voiceleading...)
>>
>> So that the "soft copy" would know "all my info is the same as this  
>> already
>> existant pattern, but my rythm is varied to "xyz" " .... or "i am this
>> pattern joined to this pattern" or "i am this chord re-octivated"
>>
>> So that a large amount of duplication could then be avoided. & a  
>> "motif
>> development history" could be compiled
>>
>> I thought some sort of rhizomatic pointer system might then be able  
>> to back
>> fill all the "data links" with the required detail when it comes to
>> realisation of these patterns - basically compiling into a voiceled  
>> score, &
>> then the score is processed using the existing arm of Parseval that  
>> i'm
>> already using. (extra expressive dynamic markers added, what  
>> instruments to
>> use, cripple the odd symmetry etc etc...)
>>
>> I think it might be a case of "nice idea in theory", but eventually to
>> "backtrack" through the data, sooner or later some pointer or other  
>> is going
>> to be needed.
>>
>> My solution to date therefore is "every pattern is unique(deepcopy)  
>> of its
>> originator(s) but the data itself in the pattern (starttime lists,  
>> chord
>> pchs etc) is simply a pointer to the info held in a repository  
>> somewhere
>> outside of the pattern object.
>>
>> This means if i copy a Pattern, & change it's rhythm reference,  
>> still only
>> one entry exists in the dataset to fill both patterns with the  
>> relevant oct,
>> pch, & voiceleading info....
>>
>> I can't think of another way to do it. It's not as economical as any
>> "historical self-awareness" i might wish patterns to carry round  
>> with them,
>> but it's probably quicker & easier to calculate, & not as  
>> encumbering as
>> actually copying the data "note for note" into numerous pattern
>> duplications....
>>
>> Let me know if you have any other thoughts or suggestions.... Thanks  
>> for
>> taking the trouble to give my dilemma some consideration.
>>
>> I'm beginning to think i could have bolted my score & scripting  
>> syntax onto
>> AthenaCL as the engine somehow.... It still would have been a lot of  
>> work.
>> Possibly even more work. & Athena doesn't deal with "tied notes" or
>> "conditional durations" at all / have a "real time interactive"
>> component....
>>
>> & I'm sure there will be some discoveries & unique features that  
>> will emerge
>> having done it all myself from the ground up. Looking at Athena's  
>> internals
>> initially left me a bit lost. Maybe now (after a few hundred hours  
>> of Python
>> flying time) it may not be so daunting... but i'm 80% of the way  
>> home here,
>> so on i shall trudge... even if i am re-inventing the odd wheel on  
>> the way.
>>
>> After all, if i want to use some crazy generator to make up a rhythm
>> pattern, i can still use Athena to do that quite easily... but my  
>> idea about
>> "Algorithmic composition" is more along the lines of where i am taking
>> Parseval. i.e - a tool for the development, analysis, & self  
>> referentiality
>> of basic human musical ideas.
>>
>> Making purses out of sow's ears basically.
>>
>> Which gives the name "Parseval" another layer of appropriateness i  
>> think....
>> This kind of layered self referentiality & transformation is  
>> definately
>> something that informs what i am trying to do here. & The  
>> affirmations &
>> complexities of serendipity are definately welcomed in this view.
>>
>> Anyway, back to the cricket....
>>
>>
>> Hi Tim,
>> Not sure I understand the complexity of your problem. It is a string
>> rewriting system? Does this describe it:
>> Use a bunch of methods to (rewrite, add to, delete from) a data
>> string, that data string being either actual data or pointers to
>> methods for rewriting, rearranging bits of the data string and then
>> eventually decode string into some set of musical parmeters?
>>
>> Hippy New Ear,
>>
>> David
>> On 01/01/2008, at 9:07 PM, Tim Mortimer wrote:
>>
>>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14572387.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
>> "unsubscribe csound"
>>
> 
> _________________________________________________
> experimental polymedia:	www.avatar.com.au
> Sonic Communications Research Group,
> University of Canberra:	 creative.canberra.edu.au/scrg/
> 
> 
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> 
> 

-- 
View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14574391.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-01-02 10:37
FromTim Mortimer
Subject[Csnd] Re: Re: Re: Python - Help! Creating a nestable "Pattern" class

Yes, I think this may be what im after.... as long as it works recursively
so that nested references can be resolved & inserted into the sequence
accordingly... 

but when you say "string" - i assume you mean just that ... "Hello World",
"ham & eggs", that sort of thing...

I started exploring some possibilies earlier today (with pen & paper..) &
this is the type of thing i came up with. (i'm also sketching out some class
structures as i go, which is helping eliminate some "trees from the wood" as
it were....)

For example, if working with "starttimes" (aka rhythms) the Patterns 

pattern1.starts = [0,500]
pattern2.starts = [0,750]
pattern3 = pattern1 + pattern2
pattern4 = pattern3*2

...will point to the "Starttimes Database" as follows...

pattern 1: starts = -1 
pattern 2: starts = -2
pattern 3: starts = -3 (being pattern1 + pattern2)
pattern 4: starts = -4 (defined as pattern3*2)

the "Starttimes Database" (as i have modelled it to date) therefore looks
like this

index: [derivation, value,  intervals]

-1: ["self",[0,500],[500]]
-2: ["self",[0,750],[750]]
-3: [[-1,-2],[0,500,1250],[500,750]]
-4: [[-3,-3],[0,500,1250,1750,2500],[500,750]]

if i go on & define some other Pattern with a Rhythm of [0,500] then it will
be recorded (after checking the relevant database) as follows:

pattern 5: starts = -1 

with no further entry in the database required

etc etc....

My origan query was something like "how do i / can i resolve the values
simply by recording the index values" i.e.

-3: [-1,-2]
-4: [-3,-3]

etc etc....

a lot of the pitch class stuff will probably be accessible from the existing
cannon of analysis, but i will also be tracking info above & beyond reducing
EVERYTHING to an unordered, normal, uninverted, untransposed forms (again
influenced by what feldman analysis i have read..... I heard an mp3 of an
interview where he said "i don't mind if someone analyses my work & finds it
conforms to a serial construction" - to be honest, it does seem like most of
the time he is half way there. He's like a serialist filtered through a
histogram. except the histogram was Feldman. & John was the Walrus. or was
it Paul? i forgot. but hey, it was the 60's....




David Worrall wrote:
> 
> Hi Tim,
> The trouble with trying to describe something concretely is that your  
> concrete is not the same as mine, so I may be off-song.
> Imagine a string "Da Fa(Da, 3) Fb (Fa, 23, 10.1), Db, Fc(Fb, Db)...."
> where Da, Db are data structures, Fa,Fb, Fc are  functions on these  
> and themselves
> so in order to (eventually) generate a musical sequence you scan along  
> the string generating a musical structure, or a replacement of some  
> part of the string.
> Does that describe a workable process?
> 
> Aust. 2nd test, 1st innings: 3/119, 4/119 - India's on a hat-trick!
> 
> David
> 
> On 02/01/2008, at 12:39 PM, Tim Mortimer wrote:
> 
> 

-- 
View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14576206.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-01-02 10:54
FromTim Mortimer
Subject[Csnd] Re: Re: Re: Python - Help! Creating a nestable "Pattern" class
effectively what is happening here is when a Pattern "Element" is not defined
upon anything else

-1: ["self",[0,500],[500]]

as the derivation of "self" kind of suggests, i am effectively asking this
"Generation A / motivic" Pattern to assert itself (while the Parseval
Session in question is running..) as a kind of Class in its own right....
(??)

As an analogy it seems to hold up. But to implement it in exactly these
terms would probably be tricky & or a bit extreme...

Everything in Python is after all just an object anyway, even Class
definitions, right?


Tim Mortimer wrote:
> 
> 
> Yes, I think this may be what im after.... as long as it works recursively
> so that nested references can be resolved & inserted into the sequence
> accordingly... 
> 
> but when you say "string" - i assume you mean just that ... "Hello World",
> "ham & eggs", that sort of thing...
> 
> I started exploring some possibilies earlier today (with pen & paper..) &
> this is the type of thing i came up with. (i'm also sketching out some
> class structures as i go, which is helping eliminate some "trees from the
> wood" as it were....)
> 
> For example, if working with "starttimes" (aka rhythms) the Patterns 
> 
> pattern1.starts = [0,500]
> pattern2.starts = [0,750]
> pattern3 = pattern1 + pattern2
> pattern4 = pattern3*2
> 
> ...will point to the "Starttimes Database" as follows...
> 
> pattern 1: starts = -1 
> pattern 2: starts = -2
> pattern 3: starts = -3 (being pattern1 + pattern2)
> pattern 4: starts = -4 (defined as pattern3*2)
> 
> the "Starttimes Database" (as i have modelled it to date) therefore looks
> like this
> 
> index: [derivation, value,  intervals]
> 
> -1: ["self",[0,500],[500]]
> -2: ["self",[0,750],[750]]
> -3: [[-1,-2],[0,500,1250],[500,750]]
> -4: [[-3,-3],[0,500,1250,1750,2500],[500,750]]
> 
> if i go on & define some other Pattern with a Rhythm of [0,500] then it
> will be recorded (after checking the relevant database) as follows:
> 
> pattern 5: starts = -1 
> 
> with no further entry in the database required
> 
> etc etc....
> 
> My origan query was something like "how do i / can i resolve the values
> simply by recording the index values" i.e.
> 
> -3: [-1,-2]
> -4: [-3,-3]
> 
> etc etc....
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14576413.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-01-03 11:03
FromDavidWorrall
Subject[Csnd] Re: Re: Re: Re: Python - Help! Creating a nestable "Pattern" class
Hi Tim,

Here's a simple example of two techniques I'd use if I was trying to  
implement what I think you're talking about.
It uses a combination of eval and pointer to tuple. The func string to  
be evaluated can be as complicated as you like - ie you can hold each  
component of a possible function to execute in a list and choose which  
ones you want to put together to evaluate some input.
None of this might be of use. In which case, neither am I. :-)

David
# drw 20080102 ------- example script for combining eval() and  
*(n1,n2...) -----------------------------
import random

def func1(n):
	return n+1

def funcNN(n):
	return n * n

funcRoots = ["1", "NN"]

ranges = [(3,5), (5,8), (8,13)]

def doit (funcs, howMany):
	funcOP = []
	while len (funcOP) < howMany:
		func = "func"+ random.choice( funcs) + "(" + str  
(random.randint(*random.choice(ranges))) + ")"
		print func
		funcOP += [eval (func)]
		print funcOP
	

doit ( funcRoots, 10)
# ------- end of example script for combining eval() and *(n1,n2...)  
-----------------------------



On 02/01/2008, at 9:37 PM, Tim Mortimer wrote:

>
>
> Yes, I think this may be what im after.... as long as it works  
> recursively
> so that nested references can be resolved & inserted into the sequence
> accordingly...
>
> but when you say "string" - i assume you mean just that ... "Hello  
> World",
> "ham & eggs", that sort of thing...
>
> I started exploring some possibilies earlier today (with pen &  
> paper..) &
> this is the type of thing i came up with. (i'm also sketching out  
> some class
> structures as i go, which is helping eliminate some "trees from the  
> wood" as
> it were....)
>
> For example, if working with "starttimes" (aka rhythms) the Patterns
>
> pattern1.starts = [0,500]
> pattern2.starts = [0,750]
> pattern3 = pattern1 + pattern2
> pattern4 = pattern3*2
>
> ...will point to the "Starttimes Database" as follows...
>
> pattern 1: starts = -1
> pattern 2: starts = -2
> pattern 3: starts = -3 (being pattern1 + pattern2)
> pattern 4: starts = -4 (defined as pattern3*2)
>
> the "Starttimes Database" (as i have modelled it to date) therefore  
> looks
> like this
>
> index: [derivation, value,  intervals]
>
> -1: ["self",[0,500],[500]]
> -2: ["self",[0,750],[750]]
> -3: [[-1,-2],[0,500,1250],[500,750]]
> -4: [[-3,-3],[0,500,1250,1750,2500],[500,750]]
>
> if i go on & define some other Pattern with a Rhythm of [0,500] then  
> it will
> be recorded (after checking the relevant database) as follows:
>
> pattern 5: starts = -1
>
> with no further entry in the database required
>
> etc etc....
>
> My origan query was something like "how do i / can i resolve the  
> values
> simply by recording the index values" i.e.
>
> -3: [-1,-2]
> -4: [-3,-3]
>
> etc etc....
>
> a lot of the pitch class stuff will probably be accessible from the  
> existing
> cannon of analysis, but i will also be tracking info above & beyond  
> reducing
> EVERYTHING to an unordered, normal, uninverted, untransposed forms  
> (again
> influenced by what feldman analysis i have read..... I heard an mp3  
> of an
> interview where he said "i don't mind if someone analyses my work &  
> finds it
> conforms to a serial construction" - to be honest, it does seem like  
> most of
> the time he is half way there. He's like a serialist filtered  
> through a
> histogram. except the histogram was Feldman. & John was the Walrus.  
> or was
> it Paul? i forgot. but hey, it was the 60's....
>
>
>
>
> David Worrall wrote:
>>
>> Hi Tim,
>> The trouble with trying to describe something concretely is that your
>> concrete is not the same as mine, so I may be off-song.
>> Imagine a string "Da Fa(Da, 3) Fb (Fa, 23, 10.1), Db, Fc(Fb, Db)...."
>> where Da, Db are data structures, Fa,Fb, Fc are  functions on these
>> and themselves
>> so in order to (eventually) generate a musical sequence you scan  
>> along
>> the string generating a musical structure, or a replacement of some
>> part of the string.
>> Does that describe a workable process?
>>
>> Aust. 2nd test, 1st innings: 3/119, 4/119 - India's on a hat-trick!
>>
>> David
>>
>> On 02/01/2008, at 12:39 PM, Tim Mortimer wrote:
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14576206.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"
>

_________________________________________________
experimental polymedia:	www.avatar.com.au
Sonic Communications Research Group,
University of Canberra:	 creative.canberra.edu.au/scrg/



Date2008-01-03 13:34
FromTim Mortimer
Subject[Csnd] Pattern Matching
I always suspected something like that was possible. & i've never used eval()
before. David you rock.

Can you also define variable names like that? by concatonating strings
somehow? creating a variable number of uniquely named objects for example?

I seem to do this type of thing a lot as well, which your example will
probably end

if linein [0] == "schmozzle":

    del linein[0]
    scmozzle(linein)


Can i ask you (& anyone still reading) about "pattern matching"? I know they
use "sonification" in mining & things like that don't they. aren't they
looking for "signatures" of things?

What about when they go trawling for dna sequences. aren't these the types
of processes / algorithms that i am attempting to mimic on a fraction of the
scale? (looking for a "string match" in a longer string essentially, but
with numeric values in a list.... hang on, bog standard 

if [list,list,list] in [list,list,list,list,list,schmist,fist]:

will probably do it... mmmm.....

anyway thanks David. Little things like this from yourself & Oeyvind &
Michael G in the past have always proved to be really valuable, & usually
shut me up for a good few weeks.....

in fact, one line Oeyvind sent me recently made me realise i may not need
the csound API at all!

 os.system('mf2t.exe %s.mid %s.txt'%(f,f))

havent tried it using " os.system('csound.exe %s.orc %s.sco'%(f,f)) " yet...



David Worrall wrote:
> 
> Hi Tim,
> 
> Here's a simple example of two techniques I'd use if I was trying to  
> implement what I think you're talking about.
> It uses a combination of eval and pointer to tuple. The func string to  
> be evaluated can be as complicated as you like - ie you can hold each  
> component of a possible function to execute in a list and choose which  
> ones you want to put together to evaluate some input.
> None of this might be of use. In which case, neither am I. :-)
> 
> David
> # drw 20080102 ------- example script for combining eval() and  
> *(n1,n2...) -----------------------------
> import random
> 
> def func1(n):
> 	return n+1
> 
> def funcNN(n):
> 	return n * n
> 
> funcRoots = ["1", "NN"]
> 
> ranges = [(3,5), (5,8), (8,13)]
> 
> def doit (funcs, howMany):
> 	funcOP = []
> 	while len (funcOP) < howMany:
> 		func = "func"+ random.choice( funcs) + "(" + str  
> (random.randint(*random.choice(ranges))) + ")"
> 		print func
> 		funcOP += [eval (func)]
> 		print funcOP
> 	
> 
> doit ( funcRoots, 10)
> # ------- end of example script for combining eval() and *(n1,n2...)  
> -----------------------------
> 
> 
> 
> On 02/01/2008, at 9:37 PM, Tim Mortimer wrote:
> 
>>
>>
>> Yes, I think this may be what im after.... as long as it works  
>> recursively
>> so that nested references can be resolved & inserted into the sequence
>> accordingly...
>>
>> but when you say "string" - i assume you mean just that ... "Hello  
>> World",
>> "ham & eggs", that sort of thing...
>>
>> I started exploring some possibilies earlier today (with pen &  
>> paper..) &
>> this is the type of thing i came up with. (i'm also sketching out  
>> some class
>> structures as i go, which is helping eliminate some "trees from the  
>> wood" as
>> it were....)
>>
>> For example, if working with "starttimes" (aka rhythms) the Patterns
>>
>> pattern1.starts = [0,500]
>> pattern2.starts = [0,750]
>> pattern3 = pattern1 + pattern2
>> pattern4 = pattern3*2
>>
>> ...will point to the "Starttimes Database" as follows...
>>
>> pattern 1: starts = -1
>> pattern 2: starts = -2
>> pattern 3: starts = -3 (being pattern1 + pattern2)
>> pattern 4: starts = -4 (defined as pattern3*2)
>>
>> the "Starttimes Database" (as i have modelled it to date) therefore  
>> looks
>> like this
>>
>> index: [derivation, value,  intervals]
>>
>> -1: ["self",[0,500],[500]]
>> -2: ["self",[0,750],[750]]
>> -3: [[-1,-2],[0,500,1250],[500,750]]
>> -4: [[-3,-3],[0,500,1250,1750,2500],[500,750]]
>>
>> if i go on & define some other Pattern with a Rhythm of [0,500] then  
>> it will
>> be recorded (after checking the relevant database) as follows:
>>
>> pattern 5: starts = -1
>>
>> with no further entry in the database required
>>
>> etc etc....
>>
>> My origan query was something like "how do i / can i resolve the  
>> values
>> simply by recording the index values" i.e.
>>
>> -3: [-1,-2]
>> -4: [-3,-3]
>>
>> etc etc....
>>
>> a lot of the pitch class stuff will probably be accessible from the  
>> existing
>> cannon of analysis, but i will also be tracking info above & beyond  
>> reducing
>> EVERYTHING to an unordered, normal, uninverted, untransposed forms  
>> (again
>> influenced by what feldman analysis i have read..... I heard an mp3  
>> of an
>> interview where he said "i don't mind if someone analyses my work &  
>> finds it
>> conforms to a serial construction" - to be honest, it does seem like  
>> most of
>> the time he is half way there. He's like a serialist filtered  
>> through a
>> histogram. except the histogram was Feldman. & John was the Walrus.  
>> or was
>> it Paul? i forgot. but hey, it was the 60's....
>>
>>
>>
>>
>> David Worrall wrote:
>>>
>>> Hi Tim,
>>> The trouble with trying to describe something concretely is that your
>>> concrete is not the same as mine, so I may be off-song.
>>> Imagine a string "Da Fa(Da, 3) Fb (Fa, 23, 10.1), Db, Fc(Fb, Db)...."
>>> where Da, Db are data structures, Fa,Fb, Fc are  functions on these
>>> and themselves
>>> so in order to (eventually) generate a musical sequence you scan  
>>> along
>>> the string generating a musical structure, or a replacement of some
>>> part of the string.
>>> Does that describe a workable process?
>>>
>>> Aust. 2nd test, 1st innings: 3/119, 4/119 - India's on a hat-trick!
>>>
>>> David
>>>
>>> On 02/01/2008, at 12:39 PM, Tim Mortimer wrote:
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14576206.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
>> "unsubscribe csound"
>>
> 
> _________________________________________________
> experimental polymedia:	www.avatar.com.au
> Sonic Communications Research Group,
> University of Canberra:	 creative.canberra.edu.au/scrg/
> 
> 
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> 
> 

-- 
View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14596950.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-01-03 13:43
FromTim Mortimer
Subject[Csnd] Re: Pattern Matching
But of course, matching only works if you know what you're looking for.

i suppose the "clever" bit is finding a string when you don't necessarily
know what that string is, or how long it might be.... just that it is
recurring?

this is getting pretty conjectural, granted. mail me offlist if the guilt of
staying on gets too much to handle ; ) 



Tim Mortimer wrote:
> 
> 
> 
> What about when they go trawling for dna sequences. aren't these the types
> of processes / algorithms that i am attempting to mimic on a fraction of
> the scale? (looking for a "string match" in a longer string essentially,
> but with numeric values in a list.... hang on, bog standard 
> 
> if [list,list,list] in [list,list,list,list,list,schmist,fist]:
> 
> 

-- 
View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14597188.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-01-05 06:29
FromTim Mortimer
Subject[Csnd] Re: Python - Help! Creating a nestable "Pattern" class
In terms of pattern matching existing patterns to further input, this method
below is kind of counter-productive..

but in terms of going "the other way around" & building patterns on
pre-existing motifs, this achieves what i was originally trying to achieve,
so i thought i may as well post it. (for David W if nobody else...)

(i will be exploring this further, to find the best balance between matching
"original input" to existing patterns vs. the capacity to "build upon the
known" as per the below - 2 sides of the coin as it were...)

& I'm not really sure if this is applicable to anything other than rhythms.
But i still reckon it's pretty cool.

So problem solved! At least by running this, anybody trying to understand
what i was getting at in the first place may get some more insight...

& David (or anybody) if you have anything more to say on pattern matching or
the capacity to define unique objects & variables by string concatonation as
you demonstrated for functions & the use of eval() i'd still be very
interested.


# ******Begin Python Code

dick = {}

dick[-1] = [0,500]
dick[-2] = [0,750]
dick[-3] = [-1,-2]
dick[-4] = [-3,-3]
dick[-5] = [-4,-3,-2,-1]

def deletedups(valin):

    valout = []

    for e in valin:
        if e not in valout:
            valout.append(e)

    return valout 

def readdick(index,firstcallflag):

    global dick
    value = dick[index]
    resflag = 0
    valout = []
    
    while resflag == 0:
        
        for e in value:

            if e < 0:

                e2 = readdick(e,0)
                for val in e2:
                    valout.append(val)

            else:
                
                valout.append(e)

        resflag = 1
        
        for val in valout:
            if val < 0:
                resflag = 0
                value = valout

    if firstcallflag == 1:
        
        # reconcile list for output
        accum = 0
        gaccum = 0
        
        for i in range(len(valout)):

            val = valout[i]
            #print val
            
            if val == 0:

                if i == 0:
                    continue

                gaccum += accum
                accum = 0
            
            else:

                accum += val
                valout[i] = val+gaccum

        valout = deletedups(valout)
    
    return valout

# ******

keys = dick.keys()
keys.sort()
keys.reverse()

print "\nPATTERN DICTIONARY DEMONSTRATION\n"
print "key: pattern\n"
for key in keys:
    pattern = dick[key]
    print "%s: %s" % (key,pattern)

for key in keys:
    print "\ncall pattern %s" % key
    val = readdick(key,1)
    print val

print "\nthat's how we roll!!\n"

-- 
View this message in context: http://www.nabble.com/Python---Help%21-Creating-a-nestable-%22Pattern%22-class-tp14564226p14630436.html
Sent from the Csound - General mailing list archive at Nabble.com.