thatkeith wrote: ↑Sun Oct 31, 2021 6:06 pm
What I really want to do is be able to play a simulation of whatever chord is being picked out, and I presume midi would be the best way to do that. I've looked at PaulDaMacMan's rather excellent LCB midi tools and got the sample .mid files to play in the demo stack. But what I'd really like to do is play specific notes on the fly, based on what's clicked.
Sorry I missed this (two years ago).
Kieth, if you're still around, there's a few of different way to go about doing this:
Use the excellent public-domain library MakeSMF / PlayPMD from UDI, which was written originally for SuperCard, MetaCard, HyperCard. It can generate a standard MIDI file from an extended form of a 'playSentence' (HyperTalk 'abc' music notation) string.
You can then pass that file to whatever MIDI player you'd like. PlayPMD was originally setup to use QuickTime's 'Music Instruments' playback, but you can use one of the MIDI extension modules in my repo or other methods:
1. The FluidSynth wrapper library, can play MIDI files or real-time note messages that you pass directly to it. This is the only cross platform solution I've worked on.
2. Apple's AVMIDIPlayer (available for Mac or iOS) which uses a Software Synth much like QuickTime's built in player and by default will use the same (1990s, low quality) Roland SoundCanvas sample bank that was included with QT v2.5 which is now buried Innside CoreAudio.framework. You can pass the path of your own sound font file to use instead. This one only plays MIDI files, no real-time messages (although in most cases MakeSMF is fast enough to generate MIDI files at near-realtime speed). This is the most simple of these Extensions.
3. Apple's AVAUSamplerInstrument wrapper lib (available for Mac or iOS) which uses a Soft Synth similar to AVMIDPlayer above, but can NOT play MIDI files, it can only respond to realtime messages.
4. On macOS you could also use my CoreMIDI wrapper library to send MIDI out from your stack scripts to your DAW (GarageBand, Ableton Live, etc.) to do the Playback/Recording.
5. On macOS you could also use my AVMIDIInstrument wrapper, this only responds to realtime messages, but can use most AudioUnit Plugins for playback (like Analog Synth emulations instead of using sampler instruments).
6. On Windows you can use MCI (Media Control Interface) to playback MIDI with Windows built in player. Which by default uses a simple Roland sound bank very similar to Apple's.
7. On Android I've used the mobile player to play MIDI files
IF your Android device included MIDI/soundbank (most do, even my Sony Android TV does).
8. On desktop platforms you could also pass the MIDI file to a command-line app for playback, something like WildMIDI for example.