quicky2000 / tartini

A trial to make Tartini (The real time music analysis tool ) to evolve. Original code is located in http://miracle.otago.ac.nz/tartini/download.html
Other
8 stars 4 forks source link

Can't play or record audio on Mac #33

Closed mself closed 4 years ago

mself commented 4 years ago

I am unable to play files or record audio on the Mac.

None of the built-in audio devices appear in the selection list in the settings dialog and the following errors are in the logs:

2020-04-24 07:48:35.196594-0700 tartini[81473:973336] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600000215600> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2020-04-24 07:48:35.230740-0700 tartini[81473:973336]  HALC_ShellDriverPlugIn::Open: Can't get a pointer to the Open routine
2020-04-24 07:48:35.231248-0700 tartini[81473:973336]  HALC_ShellDriverPlugIn::Open: Can't get a pointer to the Open routine
2020-04-24 07:48:35.231710-0700 tartini[81473:973336]  HALC_ShellDriverPlugIn::Open: Can't get a pointer to the Open routine
2020-04-24 07:48:35.238028-0700 tartini[81473:973336]  HALC_ShellObject::GetPropertyData: call to the proxy failed, Error: 560226676 (!dat)
2020-04-24 07:48:35.238061-0700 tartini[81473:973336]  HALPlugIn::ObjectGetPropertyData: got an error from the plug-in routine, Error: 560226676 (!dat)

The same errors occur when trying to play a file.

When trying to record audio, an error dialog is shown and these additional errors are in the logs:

RtApi: no devices found for given stream parameters: 
    RtApiCore: No supported sample rates found for OS-X device (Apple Inc.: Built-in Microphone).
    RtApiCore: No supported sample rates found for OS-X device (Apple Inc.: Built-in Output).

Error initilizing sound

Note that the logs show the names of the built-in mic and speaker, but these names are not shown in the audio options in the settings dialog. (This is because the RtAudioDeviceInfo for these devices indicate that they both have 0 input and output channels.)

There are also a lot of compiler warnings in rtAudio.cpp about Mac APIs that were deprecated a very long time ago:

'AudioDeviceAddIOProc' is deprecated: first deprecated in macOS 10.5
'AudioDeviceRemoveIOProc' is deprecated: first deprecated in macOS 10.5
'AudioDeviceGetProperty' is deprecated: first deprecated in macOS 10.6
'AudioDeviceGetPropertyInfo' is deprecated: first deprecated in macOS 10.6
'AudioDeviceSetProperty' is deprecated: first deprecated in macOS 10.6
'AudioDeviceAddPropertyListener' is deprecated: first deprecated in macOS 10.6
'AudioHardwareGetProperty' is deprecated: first deprecated in macOS 10.6

Has anyone else gotten audio input/output to work on the Mac?

I'm thinking that porting from RtAudio 3.0.3 (~2005) up to 5.0.1 (~2019) is likely to be easier than trying to debug this.

quicky2000 commented 4 years ago

Has anyone else gotten audio input/output to work on the Mac?

I don't know, I`m a Linux user. I use Travis-ci to build on OSX to be sure it still compilable on MacOS but I don't know someone using it

I'm thinking that porting from RtAudio 3.0.3 (~2005) up to 5.0.1 (~2019) is likely to be easier than trying to debug this.

I agree, up to now it was working well on Linux so I didn't take time to look at a newer version of RtAudio

mself commented 4 years ago

I'm wondering if the garbled audio output on Mac is due to problems reading the WAV files in rather than playing them back. What do you see in the UI after loading the example.wav file? I've attached a screenshot of what I see on the Mac. Does this look the same?

Screenshot of example wav

mself commented 4 years ago

I haven't really been able to get Tartini to do anything yet, but I would have expected the Pitch Contour to show a series of steps up and down over the course of example.wav file as it goes up and down the scale.

mself commented 4 years ago

Aha! This code is so old that it assumed that all Macs are big endian! It was swapping the high and low bytes of each sample from the WAV file (no wonder it sounded garbled). I'm not sure when the last pre-Intel Mac was sold, but it's been a long time.

There are some #ifdefs in sound_stream.cpp that need to be fixed. I'll submit a PR.

Good news, the pitch analysis is now working and audio playback on the Mac is also working with the RtAudio 5.1 changes.

mself commented 4 years ago

This is more like what I was expecting when I started looking into Tartini!

Screenshot of example wav 2