Package: maxosc
MaxOsc is a package designed to conveniently call python code from MaxMSP over OSC. It's a wrapper of thepython-oscpackage with a built-in parser.The python code should be run independently of Max (in a terminal or similar) and can be used in conjuncture with the set of Max abstractions availablehereor directly through theCNMAT externalsfor OSC (also available through the Max package manager).Project StatusDevelopment of this project is largely stalled. Minor fixes will be released when necessary.The project is stable but documentation is limited.Minimal ExampleRun the following code in a separate terminal. Note thatMaxOsc.run()will instantiate ablocking OSC server, hence no code below that point will ever be executed.frommaxoscimportMaxOscclassFlipper(MaxOsc):def__init__(self):super().__init__()self.run()defflip(self,a1:int,a2:int):returna2,a1defflip_list(self,a:[int]):returnlist(reversed(a))if__name__=='__main__':Flipper()If thepyosc abstractionsare available in your path, the following Max patcher can be used:Show Max patcher<pre><code>
----------begin_max5_patcher----------
432.3ocwU9saBBCEF+Z3onoWyL.BLcWs2ikESEqtZv1l1hhw369n+AmNItlg
QuvZ5omxW+w2oGNDF.myZvRH3MvGfffCgAAlP5.At4AvMnlxJjzjFjh2wluF
FYWRgaTlv78LY4nJhTsSf3cKSq2vpUUXkYuItnjElsz9XdI40tTs4o1yw1SC
DB9zsDGoJ+hPWMSfKU1UGmlNJNBLMWONISOpibZKsBSnmzUG6XXndHZfXJHT
E3cNiWyAI8iYbOXV.+SVRiiMHkb+gYCVJQqvWQSBHELFjAx82uxGjeUXPLO+
1Hl978q3a3WIYOQ+xamZ5+ynbvYMpzoixeTFko+wxZZIXYEgOS2IoeVytl0a
zDI5redTfl39Kt3w0R4Rx8F5hgCsyrcPOI2elMY.qHze+wCiJ53W9hPxpEkc
mutF+feDZAVpHTjhvnmkjKmdeW6sP4dHTx8PIeHR+gfAKTgOBEeGDZpGBcMP
1ZCDmuEKjtjMRzdcXMSnmNIxLkPsSMsufB7VRW91HHQaEqpsbsVXNVvlhLnc
qrEXAsl3pKagqURyUMJps6IGY4vbiL7X32.J7svT
-----------end_max5_patcher-----------
</code></pre>Elaborate ExamplePython Code:frommaxoscimportMaxOscclassInstrument:def__init__(self,name:str,midi_range:(int,int),supported_techniques:[str],concert_pitch:float,transposing:bool):self.name:str=nameself.midi_range:(int,int)=midi_rangeself.supported_techniques:[str]=supported_techniquesself.concert_pitch:float=concert_pitchself.transposing:bool=transposingdefmax_getter(self):returnself.name,self.midi_range,self.supported_techniques,self.concert_pitch,self.transposingclassInstrumentBank(MaxOsc):def__init__(self):super().__init__()self.instruments:[Instrument]=[]self.run()defadd_instrument(self,name:str,midi_range:(int,int),supported_techniques:[str],concert_pitch:float=440.0,transposing:bool=False):instrument=Instrument(name,midi_range,supported_techniques,concert_pitch,transposing)self.instruments.append(instrument)print(f"Added instrument '{name}' with range={midi_range}, techniques={supported_techniques}, "f"concert pitch={concert_pitch}and transposing={transposing}.")defget_instruments(self):return[instr.max_getter()forinstrinself.instruments]if__name__=='__main__':InstrumentBank()Max Code:Show Max patcher----------begin_max5_patcher----------
1581.3ocyZF0bahCDG+YmOE6vKocFWeHDfgNSd35C2SW6K2My8PhmLXrrM4v
HJRjX2N86dWIgcH01Dpwl1YRLFYEzt+j1c+K470qFXMkulIrf2C2BCF70qFL
P2jpgAU2OvZUz53zHgtaVw7UqXYRqglOSxVK0s+wxTYx6dhWLCDxhjrEBPf8
Cjb3iQqgmRRSgoLHOpPvlAQBcqhMqlxSEPxH1HXFubZJC9bIWFIS3Yvpnh+W
.uQTN8AVr9IEuLJaA6si1N5oIYrXdYl1DbqZLqbEuTlxjZC1tp0jYZyjO8g2
E5s8uOORFuDs06KvAvPA5X+Q1CApuq5BwOPcw2djML44meR11GOQ012t5J0K
C6HB+DOigTfIxtVBr0IBIjjo3zH3+1Ce2g1QZ5cVWB9PZfOiscqyGGR+wmOv
4ornLAxn8IztOr4Uc1.u.HW.nED1.z777pCMZOtn5CafYr4QXz4PHiIjHFRQ
tI1wl4oQRIKCa+okrr53aD7OLFFEtdIKMGlifaEufgDGe6JSHJ9ihsn2BlFE
cEiia.ijPZcLNdb+Fa9dnTvTAd36UAdwQBEMPhIRjIOxd6AccZqc8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