jazz-soft/JZZ

JZZ().info().outputs returns empty list on macOS 13 Ventura ?

pierredewilde opened this issue · 13 comments

Tested macOS 10.15: OK return list of MIDI outputs

$ node -v
v19.1.0
$ node
> let JZZ = require('JZZ')
> JZZ().info().ver
'1.5.5'
> JZZ().info().outputs
[{...},{...},{...}]

Tested on macOS 13: NOK returns empty list

$ node -v
v19.1.0
$ node
> let JZZ = require('JZZ')
> JZZ().info().ver
'1.5.5'
> JZZ().info().outputs
[]

Thanks a lot for the notice! Will investigate...

await JZZ.requestMIDIAccess() does not return and waits indefinitely.

It looks like the latest I have is Monterey...
Can you try if https://github.com/jazz-soft/midi-test works properly?

I have installed midi-test and runs the following code:

let MT = require('midi-test');
let port = new MT.MidiDst('VIRTUAL MIDI Output');
port.receive = function(msg) { console.log('received:', msg); };
port.connect()

I then use SendMIDI from https://github.com/gbevin/SendMIDI to display list of MIDI outputs:

$ sendmidi list
...
VIRTUAL MIDI-Out
...

With JZZ, MIDI outputs list is empty:

$ node
> let JZZ = require('JZZ')
> console.log(JZZ().info().outputs)
[]

I have rebuilt the MacOS binary.
Please install jazz-midi v1.7.7 and let me know if it works properly on both MacOS 10 and 13.
You can also install midi-test and run npm test to see if JZZ can find the test ports.

Hi Sema,

Thank you for your support.

Unfortunately, it doesn't solve the issue on macOS 13 (it works on macOS 10).
Maybe I don't setup it correctly:

$ mkdir test
$ cd test
$ npm init
$ npm install jzz --save
$ node
Welcome to Node.js v19.2.0.
> let JZZ = require('JZZ')
> JZZ().info()
{
  name: 'JZZ.js',
  ver: '1.5.5',
  version: '1.5.5',
  inputs: [],
  outputs: [],
  engine: 'none',
  sysex: true
}

Here is the result of midi-test on macOS 13 (OK on macOS 10 with 5 passing):

$ npm install midi-test
$ cd node_modules/midi-test
$ npm install
$ npm test

> midi-test@1.2.3 test
> mocha



  MIDI messages
    1) jzz
    2) virtual-midi-in
    3) virtual-midi-out
    ✔ virtual-midi-in-busy
    ✔ virtual-midi-out-busy


  2 passing (15s)
  3 failing

  1) MIDI messages
       jzz:
     Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/pierre/Documents/apps/memotive/music/midi/test/node_modules/midi-test/test/mocha.js)
      at listOnTimeout (node:internal/timers:564:17)
      at process.processTimers (node:internal/timers:507:7)

  2) MIDI messages
       virtual-midi-in:
     Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/pierre/Documents/apps/memotive/music/midi/test/node_modules/midi-test/test/mocha.js)
      at listOnTimeout (node:internal/timers:564:17)
      at process.processTimers (node:internal/timers:507:7)

  3) MIDI messages
       virtual-midi-out:
     Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/pierre/Documents/apps/memotive/music/midi/test/node_modules/midi-test/test/mocha.js)
      at listOnTimeout (node:internal/timers:564:17)
      at process.processTimers (node:internal/timers:507:7)

In the first test, try to install new jazz-midi manually. JZZ still has the old dependency.
In the second test, try to increase the timeout.

If that does not help, try to rebuild jazz-midi on your computer:
clone https://github.com/jazz-soft/jazz-midi
go to node-gyp
run npm install
run npm test
If that helps we can copy your binary to the next release.

And, what processor does your Mac have?

I am running macOS 13 on new MacBookAir M2 (arm64).

I have successfully rebuilt jazz-midi following your instructions:

$ npm install

> jazz-midi-binary@0.0.0 install
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.0
gyp info using node@19.2.0 | darwin | arm64
gyp info find Python using Python version 3.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/pierre/Downloads/jazz-midi-master/node-gyp/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/pierre/Library/Caches/node-gyp/19.2.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/pierre/Library/Caches/node-gyp/19.2.0',
gyp info spawn args   '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/pierre/Library/Caches/node-gyp/19.2.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/pierre/Downloads/jazz-midi-master/node-gyp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/jazz/jazz-midi.o
  CXX(target) Release/obj.target/jazz/../midi/Midi.o
  CXX(target) Release/obj.target/jazz/../midi/MidiMacOSX.o
../../midi/MidiMacOSX.cpp:231:20: warning: comparison of integers of different signs: 'int' and 'ItemCount' (aka 'unsigned long') [-Wsign-compare]
    if (n < 0 || n > MIDIGetNumberOfDestinations()) return CurrentOutName();
                 ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../midi/MidiMacOSX.cpp:309:20: warning: comparison of integers of different signs: 'int' and 'ItemCount' (aka 'unsigned long') [-Wsign-compare]
    if (n < 0 || n >= MIDIGetNumberOfSources()) return CurrentInName();
                 ~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
  SOLINK_MODULE(target) Release/jazz.node
gyp info ok 

added 79 packages, and audited 80 packages in 7s

20 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


$ npm test

> jazz-midi-binary@0.0.0 test
> node test && mocha

jazz: {
  MIDI: [Function: MIDI],
  isJazz: true,
  version: '1.5.2',
  MidiInInfo: [Function: MidiInInfo],
  MidiInList: [Function: MidiInList],
  MidiOutInfo: [Function: MidiOutInfo],
  MidiOutList: [Function: MidiOutList],
  Support: [Function: Support],
  Time: [Function: Time]
}
midi: MIDI {}
System: darwin arm64
jazz.version: 1.5.2
midi.version: undefined
jazz.isJazz: true
midi.isJazz: undefined
jazz.MidiOutList(): [ 'Apple DLS Synth', 'MIDI', 'MIDI 2' ]
midi.MidiOutList(): [ 'Apple DLS Synth', 'MIDI', 'MIDI 2' ]
jazz.MidiInList(): [ 'MIDI', 'MIDI 2' ]
midi.MidiInList(): [ 'MIDI', 'MIDI 2' ]
jazz.Support(): [
  'ClearMidiIn',  'MidiInClose',
  'MidiInInfo',   'MidiInList',
  'MidiInOpen',   'MidiOut',
  'MidiOutClose', 'MidiOutInfo',
  'MidiOutList',  'MidiOutLong',
  'MidiOutOpen',  'MidiOutRaw',
  'Support',      'Time'
]
midi.Support(): [
  'ClearMidiIn',  'MidiInClose',
  'MidiInInfo',   'MidiInList',
  'MidiInOpen',   'MidiOut',
  'MidiOutClose', 'MidiOutInfo',
  'MidiOutList',  'MidiOutLong',
  'MidiOutOpen',  'MidiOutRaw',
  'Support',      'Time'
]
midi.out: true
midi.in: true
Out: 0 [ 'Apple DLS Synth', 'Apple', '1.0' ]
Out: 0 [ 'Apple DLS Synth', 'Apple', '1.0' ]
Out: 1 [ 'MIDI', 'Apple Inc.', '0.0' ]
Out: 1 [ 'MIDI', 'Apple Inc.', '0.0' ]
Out: 2 [ 'MIDI 2', 'Apple Inc.', '0.0' ]
Out: 2 [ 'MIDI 2', 'Apple Inc.', '0.0' ]
In: 0 [ 'MIDI', 'Apple Inc.', '0.0' ]
In: 0 [ 'MIDI', 'Apple Inc.', '0.0' ]
In: 1 [ 'MIDI 2', 'Apple Inc.', '0.0' ]
In: 1 [ 'MIDI 2', 'Apple Inc.', '0.0' ]
Testing: Apple DLS Synth - OK!
   Manufacturer: Apple
   version: 1.0
Testing: MIDI - OK!
   Manufacturer: Apple Inc.
   version: 0.0
Testing: MIDI 2 - OK!
   Manufacturer: Apple Inc.
   version: 0.0


Node: 19.2.0
process.platform: darwin
process.arch: arm64
jazz: {
  MIDI: [Function: MIDI],
  isJazz: true,
  version: '1.5.2',
  MidiInInfo: [Function: MidiInInfo],
  MidiInList: [Function: MidiInList],
  MidiOutInfo: [Function: MidiOutInfo],
  MidiOutList: [Function: MidiOutList],
  Support: [Function: Support],
  Time: [Function: Time]
}
midi: MIDI {}
MT: {
  MidiSrc: [Function: MidiSrc],
  MidiDst: [Function: MidiDst],
  version: '1.2.3'
}
  ✔ Info

  1 passing (7ms)

What do I need to do next to integrate with JZZ ?

Thank you for your support,
Pierre

Excellent!
The problem was that there was no arm64 build for MacOS.
That can be fixed:
Check what your process.arch returns.
Then look inside jazz-midi/node/index.js
You need to add a line:
else if(process.platform=="darwin"&&process.arch=="###") path+='macos###/jazz';
Then add a corresponding directory jazz-midi/node/bin/macos###
and copy jazz.node that you built from jazz-midi/node-gyp/build/Release to that new directory.
Commit it and create a pull request.
I will release a new version on npm

Thanks a lot!

process.platform: darwin
process.arch: arm64

I have edited jazz-midi/node/index.js as requested:

...
else if(process.platform=="darwin"&&process.arch=="arm64") path+='macosarm64/jazz';

and added a general throw error for further unsupported arch/platforms:

...
else throw `arch '${process.arch}' on platform '${process.platform}' is not supported`;

Not enough experience with pull requests so I have attached .zip file with edited jazz-midi/node/index.js and compiled file for darwin/arm64 arch jazz-midi/node/bin/macosarm64/jazz.node.

jazz-midi-node-arm64.zip

Thanks a lot!
Please try jazz-midi v1.7.8
If it works, I'll update the dependent packages.

jazz-midi v1.7.8 works as expected on macOS 13 with arm64 architecture.

Thanks for your great support, Sema.

I could not do it without your help.
Thanks a lot!