music.Being¶
- class music.Being[source]¶
Bases:
objectA configurable sequence walker that renders notes.
Attributes are assigned from outside as well as within: the examples set
perms,domain,curseqand the parameter sequences directly before callingwalkorrender. They are declared here so that surface is discoverable rather than implicit.Examples
>>> being = Being() >>> being.f_ = [220, 330, 440] >>> being.d_ = [0.3, 0.3, 0.3] >>> being.render(3, "being.wav")
Methods
__init__()addSeq(sequence)Add sequence to the Being.
freeze()Freeze the Being.
howl()Produce a howling sound.
mkArray()Make array.
render(nn[, fn])Render notes of the Being.
setPar([par])Set parameter to be developed in walks and stays.
setPerms(perms)Set permutations.
setSize(ss)Set the size.
Start the Being.
stay(n[, method])Stay for a certain number of notes.
walk(n[, method])Walk a certain number of steps.
Attributes
- walk(n, method='straight')[source]¶
Walk a certain number of steps.
- Parameters:
- Returns:
NoneThe steps are appended to the sequence named by
curseq.
- Raises:
ValueErrorIf
methodis not one of the three above.IndexErrorIf
'straight'walks past the end of the grid. Walking is the method that moves the ground, and this one does not wrap:stayand'perm-walk'both do, so this is the odd one of the three. It is left as it is because changing it would change what an existing caller gets; a walk that must not run out needs a grid long enough, orstay.
Notes
``’perm-walk’`` is a reconstruction. The original was lost with the code this class succeeded, and the method raised
NotImplementedErrorrather than guess. What is here is the one reading the name and its neighbours support: it isstay()withmethod='perm'– the same cycle throughperms, applied to a window of the grid – except that the window advances byseqsizefor each permutation and the pointer ends where it walked to. Staying and walking differ by whether the ground moves; nothing else about the two methods differs either.Unlike
stay(), it never readsdomain: a fixed domain is what staying means, so honouring it here would make the walk a stay. The window wraps around the end of the grid rather than running off it.
- setPar(par='f')[source]¶
Set parameter to be developed in walks and stays.
- Parameters:
- par
str Parameter to be set. Only ‘f’ is implemented, and it requires fgrid and fpointer to have been assigned by the caller, as perms, domain and curseq are.
- par
- Returns:
- Raises:
ValueErrorIf par is anything but ‘f’. It used to be a silent no-op.