Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getLineIn() not working on Big Sur with Processing 3 and Minim 2.2.2 #114

Open
paulcanning opened this issue Mar 21, 2021 · 7 comments
Open

Comments

@paulcanning
Copy link

As per the title.

Installed Processing 3 and Minim 2.2.2, and tried the following code

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

Minim minim;
AudioInput in;

void setup() {
  minim = new Minim(this);
  in = minim.getLineIn();
  in.enableMonitoring();
}

void draw() {
  for(int i = 0; i < in.bufferSize() - 1; i++)
  {
    line( i, 50 + in.left.get(i)*50, i+1, 50 + in.left.get(i+1)*50 );
    line( i, 150 + in.right.get(i)*50, i+1, 150 + in.right.get(i+1)*50 );
  }
}

And nothing happens.

@ddf
Copy link
Owner

ddf commented Mar 29, 2021

Most likely related to something changing in Big Sur's handling of audio things, might require a Java update, not sure. I can't test Big Sur on my ancient Macbook unfortunately. You could try adding a minim.debugOn() before calling getLineIn() and see what's reported in the console.

@ddf
Copy link
Owner

ddf commented Mar 29, 2021

Would also recommend searching the Processing forum to see if other folks have had trouble with audio on Big Sur and if they were able to fix it.

@paulcanning
Copy link
Author

The debug line gave me:

==== JavaSound Minim Debug ====
==== TargetDataLine buffer size is 16384
==== TargetDataLine format is PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian
==== TargetDataLine info is interface TargetDataLine supporting 14 audio formats, and buffers of at least 32 bytes

=== Minim Debug ===
=== byteBufferSize is 4096

==== JavaSound Minim Debug ====
==== SourceDataLine is class com.sun.media.sound.DirectAudioDevice$DirectSDL
==== Buffer size is 16384 bytes.
==== Format is PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian.

=== Minim Debug ===
=== Likely buffer underrun in AudioOutput.

@ddf
Copy link
Owner

ddf commented Mar 30, 2021

Well, that looks like it's successfully getting an input, but it may not be the one you are expecting. I'd recommend running the setInputMixer example in the Advanced folder of the Minim examples and see what you get onscreen for buttons. You can click on a button to attempt to open that input.

@paulcanning
Copy link
Author

I did as you asked with the example, and got this message when clicking the button for the onboard mic:

==== JavaSound Minim Error ====
==== Error acquiring TargetDataLine: Line unsupported: interface TargetDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian

=== Minim Error ===
=== Minim.getLineIn: attempt failed, could not secure an AudioInput.

@ddf
Copy link
Owner

ddf commented Mar 30, 2021

Ok, so it could be that the onboard mic doesn't support the default format. I'd recommend checking your system settings to see how audio for the mic is configured (ie sample rate, bit-depth) and then modify setInputMIxer to use the version of getLineIn that takes format arguments and provide those values. For example minim.getLineIn(Minim.MONO, 1024, 48000, 24) would try to acquire a mono input with a buffer size of 1024 that has a sample rate of 48kHz and a bit-depth of 24.

@justincouch
Copy link

I was getting this same error and was able to correct it with the arguments @ddf mentioned above with a slight modification. The built in Macbook Pro microphone is mono, but only works with a bit depth of 8 or 16.
in = minim.getLineIn(Minim.MONO, 1024, 44100, 16); worked for me.
With the caveat that I just upgraded to Processing 4 because of P3D issues. So my setup is:
MacBook Pro (16-inch, 2019)
MacOS Monterey
Processing 4.0b5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants