The transform method just calls the function on every item in the pattern, or transforms it again if it’s a nested pattern. Maybe I could add a few short-hand transformations like:
P[0, 1, 1, 0].invert().int()
Can I ask why you need it to be an integer value btw? If you are playing notes, they should be treated the same, no?
It’s purely cosmetic. I needed to show the relationship between a binary sequence and it’s inversion and wanted to make the output look as clear as possible. I started an Algorave Club on my campus and it’s made up of a lot of people who either a) know music but don’t know how to code or b) know how to code but don’t know music theory. So I’m working on a jupyter notebook project that functions as both a music theory and programming lesson using the FoxDot library.
Ah I see. The problem is that Python 3 will automatically convert values to float after a division (which occurs in in the .invert() method) so it will always return floating point values. Even something like print(1 / 1) will return 1.0. I think I will add some methods like .int(), .str() etc that will convert all of the values.