jwdj / EasyABC

EasyABC
GNU General Public License v2.0
90 stars 36 forks source link

MIDI support on macOS 10.15 Catalina #20

Open Dyddye opened 4 years ago

Dyddye commented 4 years ago

It looks like playing MIDI isn't working on macOS 10.15 (Catalina) anymore. Everything was fine until macOS 10.14. I think, the problem is, that QuickTime itself doesn't support MIDI anymore, which is set as default backend for WxMediaPlayer. At least I couldn't open any MIDI file with QuickTime, but with VLC for example. I made some local tests with pygame.mixer, which were sucessful.

You have to create a MIDI device on macOS according to this guide: https://stackoverflow.com/a/49543687

Then you can use pygame like this:

import pygame.midi as pypm
import pygame.mixer
pypm.init()
pygame.mixer.init()
pygame.mixer.load("PATH_TO_MIDI")
pygame.mixer.play()
pygame.mixer.stop()

Maybe you can create another backend out of this.

To fix the errors to show the MIDI settings dialog, I had to change:

diff --git a/easy_abc.py b/easy_abc.py
index cf979f8..98200b9 100644
--- a/easy_abc.py
+++ b/easy_abc.py
@@ -2724,11 +2724,11 @@ class MidiSettingsFrame(wx.Dialog):
         outputDevices = [_('None')]
         outputDeviceIDs = [None]
         if 'pypm' in globals():
-            n = pypm.CountDevices()
+            n = pypm.get_count()
         else:
             n = 0
         for i in range(n):
-            interface, name, input, output, opened = pypm.GetDeviceInfo(i)
+            interface, name, input, output, opened = pypm.get_device_info(i)
             if input:
                 inputDevices.append(name)
                 inputDeviceIDs.append(i)

macOS 10.15 Catalina Python 2.7.17 pygame 1.9.6

jwdj commented 4 years ago

Hello Dyddye,

We are switching to libFluidSynth 2 as sound generating engine. It is also cross platform. It works on Windows now, but I need some help getting it to work on Linux and macOS. Thank you for showing the pygame alternative. It might be useful if FluidSynth is not available/working on macOS.

Jan Wybren

On 6-1-2020 17:46, Dyddye wrote:

It looks like playing MIDI isn't working on macOS 10.15 (Catalina) anymore. Everything was fine until macOS 10.14. I think, the problem is, that QuickTime itself doesn't support MIDI anymore, which is set as default backend for WxMediaPlayer. At least I couldn't open any MIDI file with QuickTime, but with VLC for example. I made some local tests with pygame.mixer, which were sucessful.

You have to create a MIDI device on macOS according to this guide: https://stackoverflow.com/a/49543687

Then you can use pygame like this:

|import pygame.midi as pypm import pygame.mixer pypm.init() pygame.mixer.init() pygame.mixer.load("PATH_TO_MIDI") pygame.mixer.play() pygame.mixer.stop() |

Maybe you can create another backend out of this.

To fix the errors to show the MIDI settings dialog, I had to change:

|diff --git a/easy_abc.py b/easy_abc.py index cf979f8..98200b9 100644 --- a/easy_abc.py +++ b/easyabc.py @@ -2724,11 +2724,11 @@ class MidiSettingsFrame(wx.Dialog): outputDevices = [('None')] outputDeviceIDs = [None] if 'pypm' in globals(): - n = pypm.CountDevices() + n = pypm.get_count() else: n = 0 for i in range(n): - interface, name, input, output, opened = pypm.GetDeviceInfo(i) + interface, name, input, output, opened = pypm.get_device_info(i) if input: inputDevices.append(name) inputDeviceIDs.append(i) |

macOS 10.15 Catalina Python 2.7.17 pygame 1.9.6

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jwdj/EasyABC/issues/20?email_source=notifications&email_token=AC22EZACP7NGGJAPH6BMIO3Q4NN7TA5CNFSM4KDG4E72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IEIUNYA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC22EZFX4KYVQPK2PLJFBADQ4NN7TANCNFSM4KDG4E7Q.

n9yty commented 4 years ago

I am trying to look into seeing if I can help with this, but can not find a copy of the pythonmidi package. The link in the readme is not working, is there another source?

aberg001 commented 4 years ago

I also would like to help with a working Catalina version, if possible.

aupfred commented 3 years ago

Hi, For info, I had some issue with fluidynth on my Mac. With Pygame I could not make the tempo slider taken into account while playing and was difficult to set up also the progress bar. So I tried another mechanism that could work also on other platforms however only tested on Catalina so I've activated only on Mac. This is available here: https://github.com/aupfred/EasyABC/tree/playback-mac-mplay And I've been using the following: https://github.com/jheinen/mplay