Visualisation of musical instrumentation via Raspberry Pi from a Sibelius/MusicXML file via Python/Music21
- Python
- MusicXML
- Music21
- JSON
- Raspberry Pi
- RPi.GPIO/PWM
- Export MusicXML from Sibelius via Dolet plugin
- convert.py with Python and Music21
- timed.py on Raspberry Pi with RPi.GPIO PWM
- Play performance audio as the LEDs perform (3 seconds after lights out)
Red, Green, Blue LEDs with standard series resistors on Raspberry Pi pins 7, 11, 15
- Should parse MusicXML for tempo (but keep base units in JSON as quarter lengths for nicest resolution). How can we visualise the differences between music as written and as performed ("My Day of Carnage" tempo was marked as 80 but performance works out at 84).
- Could account for musical dynamics (need to parse more parts of the MusicXML with Music21). The code counts instruments and notes/rhythm within each beat and visualises this as LED intensity.
- Chris Glasgow @scottishmusic
- Gavin Leake @galvanist
- Gillian Easson @GillianEasson
- Flux Laser Studio @fluxlaserstudio
- Oliver Searle of @scottishmusic
- Team Sync @synchq
- The Whisky Bond @WhiskyBond
- Chris Scott @chrisdonia http://www.flickr.com/photos/chrisdonia/sets/72157634618539409/
- Export MusicXML from Sibelius via Dolet plugin
- convert.py with Python and Music21
- Import MusicXML file into Python via Music21 (some files with percussion elements are not supported)
- Parse the tree/structure for note elements (be sure to exclude rests)
- Get the duration (in quarter lengths) and offset (again in quarter lengths) into structure
- Save structure to JSON
- timed.py on Raspberry Pi with RPi.GPIO PWM
- Load JSON
- Group tracks into sections (defined in _conf.json)
- For each beat save number of instruments and notes
- Save maximum number of previous per section for any beat in track (used to fade/scale LED)
- Figure wait time (in seconds) from tempo
- Test LEDs (on/off/fade, like a orchestra would warming up pre performance)
- Fade the LEDs and pause after each beat as appropriate
- Play performance audio as the LEDs perform (3 seconds after lights out)