# 2.6 Groups ## Introduction Sometimes it is useful to apply effects to multiple Player objects at once. That is where the Group object comes in! `Group(*players)` Create a group object, which can be treated like a simple Player object. Effects can be applied like so: ``` python # Soften several Players at once Group(p1, p2, p3).amp = 0.25 ``` Groups can be assigned to a variable to be used repeatedly ``` python my_group = Group(p1, p2, p3) my_group.amp = 1/2 my_group.hpf = 500 ``` ## Methods ### `.stop()` Stops all of the Players in the group. ``` python Group(p1, p2, p3).stop() ``` ### `.solo()` Mutes all other Players i.e. only the Players in the Group can be heard. ``` python Group(p1, p2, p3).solo() ``` ### `.only()` Stops all Players not in the group ``` python Group(p1, p2, p3).only() ``` ## Default Groups There already exist several Group objects in FoxDot for certain sets of Player Objects based on the variable name, ending with the suffix '_all'. So for each character, e.g. `a`, there is a group called `a_all` that contains `a1`, `a2`, `a3`, ..., `a9`. So if you organise your players by variable name, it is easy to apply effects or stop them all at once: ``` python d1 >> play("x-o-") d2 >> play(" * * *") p1 >> pads([0, 4, -2, 3], dur=4) p2 >> pluck([0, 1, 3, 4], dur=1/4) # Apply a filter p_all.hpf = 500 # Stop only the Players beginning with 'd' d_all.stop() ``` You can access a Group of all the currently active Players by using the `Master()` function, which returns a Group object. ``` python d1 >> play("x-o-") p1 >> pluck([0, 2, 4, 2]) # Applies the filter to all Players Master().hpf = 500 # Stop everything Master().stop() ```