;; I'm trying to connect extempore to Ardour7 like I have done with Ableton Live
;; Following on from Ben’s portmidi.xtm example.
;; And also from Duncan's comments:
;;
https://groups.google.com/g/extemporelang/c/9cQqmflEdpY/m/QfaAssH7BgAJ;; and here:
;;
https://groups.google.com/g/extemporelang/c/9cQqmflEdpY/m/neW7PPyaBgAJ;; Sending Midi from extempore to a Midi Track in Ardour
;; This works fine on Ableton Live but has problems on Ardour 7
(sys:load "libs/external/portmidi.xtm")
(pm_initialize)
;; In "Audio MIDI Set-Up" app I have added a port named
;; "Extempore Bus". See Transfer MIDI information between apps in Audio MIDI
;; Setup on Mac in the Audio MIDI Set-Up help.
;; In Ardour7 Preferences Settings Midi panel, set the MIDI Control Surface to 'IAC Driver (Extempore BUS)'
(pm_print_devices)
;; I see this printed:
; -- MIDI output devices --
; device id 3 : <PmDeviceInfo: interface=CoreMIDI name=IAC Driver Extempore BUS I/O?:O>
; so I use id 3 to send MIDI to Ardour7 from extempore
;; Create an output stream called *midi2ardour7* to device 3
(define *midi2ardour7* (pm_create_output_stream 3))
;; In Ardour7 I have set a Midi track with an instrument.
;; I have "General Midi Synth" instrument set to get MIDI from "IAC driver (Extempore Bus)" Ch 1.
;; Set Monitor to In and audio to Master.
;; In extempore channel count is zero-based so I set the channel to 0
;; time stream pitch velocity duration channel
(play-midi-note (now) *midi2ardour7* (random 40 62) (random 40 80) (* 1.3 44100) 0)
;; Now on the FIRST occasion I evaluate the line above I get a sound from the speaker output.
;; As expected.
;; But re-evaluating that same line again get no response.
;; No sound no flash in Ardour - nothing!
;; Quitting out of VSCode and restarting extempore gives me ONE more successful beep.
;; But that's all.
;; Running the same program to send Midi to LIVE sounds out a random note each time the line above is re-evaluated.
;; Does anyone have any clues what’s going on?