Skip to content

Adjusting and documenting the Player.map method#291

Open
taconi wants to merge 1 commit intoQirky:masterfrom
taconi:player-map
Open

Adjusting and documenting the Player.map method#291
taconi wants to merge 1 commit intoQirky:masterfrom
taconi:player-map

Conversation

@taconi
Copy link

@taconi taconi commented Nov 27, 2025

Examples

map another player

d1 >> play(PwRand(['-', 'o'], [80, 20]))
b1 >> dbass(dur=1/2).map(d1, oct={'-': 5, 'o': 6})

or itself

s1 >> space(P[:7:2]).map(oct={0: var([6, 5])})

play by char

d2 >> play('{xX}').map(sample={'x': 2, 'V': var([2,4], [3,1])})

loop by pshift

l1 >> loop('foxdot', pshift=PWalk(2,3)).map(rate={0: 2}, lpf={3: 5000, 0: 1000}, hpf={-3: 800})

synth by degree

s1 >> space(P[:7]).map(root={0: P(4,5), 3: P^P[:10:3]})

or define which attr should be used with k=

k1 >> saw(tremolo=PSine(4)).map(root={0.0: 1, -1.0: -2}, k='tremolo')

define the default value (default: 0) with d=

d1 >> play('xs:h', dur=1)
v1 >> donk(pan=PWhite(-1, 1))
v1.map(d1, degree={':': P(var([-2,4],8),0,2), 'h': P*(-2,-4,0,1)}, d=var(P[:2]))

the value of d= can be a function that will receive the current value and should return the new value

f1 >> space(dur=1/2).degrade(.1).map(v1, degree={}, d=lambda val: 6 if (val >= 3) else 4)

in addition to d=, the mapping keys can also be a function that will receive the current value and return True or False

f2 >> swell(dur=2).map(v1, degree={lambda val: val >= 3: 6})

values can also receive functions and, like the functions for d=,
will receive the current value and should return the new value

f3 >> dirt(cut=.25, dur=PDur(3,8)).map(v1, degree={bool: lambda val: 3 if val > 8 else 9})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant