Octave audiorecorder with macOS Monterey Version

I have been running Octave version( 6.2.0 Released April 16, 2021) On my computer, masOS Monterey Version 12.1(21c52)
and I have used a code recorder_tools through the octave and it should recognize my voice and react to it but nothing is happening, the signal is not moving on the figure.
thank you

Thank you for the report.

As the installation method of Octave on macOS is not unique, how was Octave installed on your macOS system (e.g. Homebrew)?

Can you post the code you use to record the voice?

recorder_tools.m (643 Bytes)

I have used this web for installation Octave.app Downloads | Octave.app

thank you

Sorry for the late reply, I do not have access to a MacBook every day.

Regarding Octave.app, I cannot say much. Maybe you can try to contact @apjanke or file a bug report at Issues · octave-app/octave-app · GitHub

I tested your script with an old MacBook from 2013 (macOS Big Sur 11.6.4) with Octave 6.4.0_2 installed via Homebrew https://brew.sh and your script works there (I only get one (N x 1) data time series).

Hi all!

@asmaa actually contacted me directly by email first, and I sent them here, because I wasn’t able to find anything Octave.app-specific about it. (Though I also wasn’t able to rule it out.)

Here’s some tweaked code to make debugging easier: recorder_tools_jankified.m (2.2 KB)

Tested on my Mac (10.14.6 Mojave, iMac Pro).

Under Octave.app 6.2, audiorecorder just returns an empty data set. (Octave.app hasn’t been able to build Octave 6.3 or 6.4 yet.)

>> recorder_tools_jankified
08:36:23.286 - Running recorder_tools_jankified under Octave 6.2.0 on x86_64-apple-darwin18.7.0, OS version 10.14.6
08:36:23.288 -   Octave root: /Applications/Octave-6.2.0.app/Contents/Resources/usr/Cellar/octave-octave-app@6.2.0/6.2.0
08:36:23.290 - Starting recording
08:36:23.295 - Recording done
08:36:23.296 - Gonna pause now
08:36:25.297 - Stopping recording
08:36:44.142 - Got data: size=[0 1], mean=NaN, stdev=
08:36:44.669 - Data was empty; cannot play back.
>>

Look at that 20 seconds it takes for the stop() call to run! And the fact that no data comes back.

And here’s what I get when running it under a “vanilla” Octave 6.4.0, installed using MacPorts, with no Octave.app involved:

>> recorder_tools_jankified
08:37:10.628 - Running recorder_tools_jankified under Octave 6.4.0 on x86_64-apple-darwin18.7.0, OS version 10.14.6
08:37:10.630 -   Octave root: /opt/local
08:37:10.632 - Starting recording
08:37:10.638 - Recording done
08:37:10.639 - Gonna pause now
08:37:12.644 - Stopping recording
08:37:12.782 - Got data: size=[15200 1], mean=0.000000, stdev=0.000000
08:37:13.222 - Data was a single column/channel; skipping second plot!
08:37:13.248 - Playing back recording
08:37:15.271 - Done playing back recording
>>

I’m not sure if record() is supposed to return right away, even when you specify a recording time?

I also get an Nx1 data time series. But it’s all zeros, even if I’m yelling at the microphone.

I think the Nx1 output is because it’s doing a mono (single-channel) recording, which is the default. If I try to specify multiple channels, or a non-default sample rate, record() errors out.

Here’s what audiodevinfo gives me:

>> audiodevinfo
ans =
  scalar structure containing the fields:
    input =
      scalar structure containing the fields:
        Name = iMac Pro Microphone (Core Audio)
        DriverVersion = Core Audio
        ID = 0
    output =
      scalar structure containing the fields:
        Name = iMac Pro Speakers (Core Audio)
        DriverVersion = Core Audio
        ID = 1
>>

I’ll try to also install Octave 6.2 via MacPorts to get a comparison, and also try this on a VM running a newer version of macOS, including with Homebrew, to remove some of the variables here. (Homebrew no longer supports macOS 10.14, which is still my main OS version.) That’ll take some time to set up, though.

Cheers,
Andrew

@apjanke Thanks for taking a look at this.

Running your script works for me too:

>> recorder_tools_jankified

11:45:16.778 - Running recorder_tools_jankified under Octave 6.4.0 on x86_64-apple-darwin20.6.0, OS version 11.6.4
11:45:16.797 -   Octave root: /usr/local/Cellar/octave/6.4.0_2
11:45:16.801 - Starting recording
11:45:17.458 - Recording done
11:45:17.462 - Gonna pause now
11:45:19.464 - Stopping recording
11:45:19.621 - Got data: size=[16000 1], mean=-0.002413, stdev=0.004458
11:45:19.828 - Data was a single column/channel; skipping second plot!
11:45:19.841 - Playing back recording
11:45:21.953 - Done playing back recording

>> audiodevinfo
ans =

  scalar structure containing the fields:

    input =

      scalar structure containing the fields:

        Name = Built-in Microphone (Core Audio)
        DriverVersion = Core Audio
        ID = 0

    output =

      scalar structure containing the fields:

        Name = Built-in Output (Core Audio)
        DriverVersion = Core Audio
        ID = 1

@asmaa does your system show different values?

Okay, so here’s another data point. I have a 2017 MacBook Pro which up until yesterday was running macOS 10.14. Last night, I upgraded it to macOS 12.2 Monterey, removed Homebrew and did a fresh reinstall, installed octave via Homebrew (getting octave 6.4.0, Homebrew octave package 6.4.0_2 (I think) installed from bottle.

Launched Octave from the command line in an iTerm2 session running zsh, with octave -q --gui. I ran the recorder_tools_jankified.m function attached here.

And I got this resulting output:

While running it, this permissions prompt popped up:

I chose “OK”. Let it run, yelled at it, got this output:

>> recorder_tools_jankified
03:26:02.581 - Running recorder_tools_jankified under Octave 6.4.0 on x86_64-apple-darwin20.6.0, OS version 12.2.1
03:26:02.588 -   Octave root: /usr/local/Cellar/octave/6.4.0_2
03:26:02.821 - Starting recording
03:26:13.729 - Recording done
03:26:13.732 - Gonna pause now
03:26:15.734 - Stopping recording
03:26:15.877 - Got data: size=[16000 1], mean=-0.003879, stdev=0.003988
03:26:16.480 - Data was a single column/channel; skipping second plot!
03:26:16.496 - Playing back recording
03:26:18.647 - Done playing back recording
>>

In a new figure window:

Looking good! Ish!

Maybe we’re looking at a permissions configuration issue of some sort here? The fact that the permissions prompt said “iTerm” and not "octave’ makes me think there may be a dependency on how octave is launched. Which may in fact be an interaction with Octave.app: that gets launched from Finder and whatever it calls, not from a shell session.

I will try to roll a 6.4.0 release of Octave.app in the near future (for recent macOS releases only) for comparison.

1 Like

I ran into a similar problem today. I have octave installed via Homebrew with a launcher app setup through the script editor (based on these instructions, Octave for macOS - Octave)

If my launcher script was this
do shell script "/usr/local/bin/octave --gui"
Trying to use audiorecorder would just return an empty buffer.

If I changed it to this

tell application "Terminal"
    do script "/usr/local/bin/octave --gui"
end tell

It worked fine.
@apjanke this probably corroborates your permissions theory

macOS 12.2.1
Octave 7.1.0