007 PortAudio error: Invalid device

I’m getting a Port Audio error using 007 on Ubuntu Lucid when running any of the sound examples:

[tt]OF: OF_LOG_ERROR: PortAudio error: Invalid device[/tt]

Also, ofSoundStreamListDevices() dosen’t seem to do anything.

It seems PortAudio can’t read any devices as both Pa_GetDefaultInputDevice and Pa_GetDefaultOutputDevice return -1 aka paNoDevice in ofPAStream::setup and thus Pa_OpenStream fails. Passing in a Device ID seems to do nothing.

Also, running pasuspender to pause pulseaudio makes no difference. The only thing I can think of is that the OF apps ae linking to the older version of portaudio installed on the system and not the newer one included with OF. However, installed apps that use portaudio such as espeak work fine.

Same error here, running on Linux Mint (Julia) with openframeworks v007

Edit: got it to work (responds veeeery slowly) by changing the config.make . I used these lines

# use this to add system libraries for example:  
# USER_LIBS = -lpango  
USER_LIBS = -lportaudio  

I previously installed the latest portaudio version but I don’t know if that is needed…

Edit2: When choosing the ‘Release’ target the output is very responsive!

mmh, the portaudio library that comes with the system, at least in ubuntu seems to be totally different (like api different) to the downloadable one from ross bencina… it shouldn’t even link if it was using that one…

Anyway RtAudio is still there. From my tests portaudio works better but if it is problematic you can go back to rtAudio changing some define in ofConstants.h

Hmm. Tried it on another PC, installed Ubuntu 11.04 and OF007, and had the same problem: PortAudio Invalid Device.
Switching to RTAudio solved this problem;

  • Open the Codeblocks project in of_preRelease_v007_linux/libs/openFrameworksCompiled/project
  • Change line 220+ to:
	#ifdef TARGET_LINUX  

  • Compile the OpenFrameworks Project (Debug and Release Target!)
  • Compile my own code

I do wonder why I’m having this problem with 007 on 2 PC’s, and others seem to get it working without problems…

OT: Next problem is getting a second soundcard to work

I think I’m getting this problem too. (Ubuntu 11.04 - ofPreRelease_v007_linux)

I’ve tried setting:


at lines 229 and 230 of OfConstants.h
and recompiling libOpenFrameWorks

But when I compile and run audioInputExample I still get this error:

Cannot connect to server socket err = No such file or directory  
Cannot connect to server socket  
jack server is not running or cannot be started  
OF: OF_LOG_ERROR: PortAudio error: Invalid device  

I think my sound setup in linux is mangled (for a change)
I have installed pd, etc
I think I’ve tried installing jack (although I’ve never actually seen it work)

I’m surprised that OF still seems to be looking for portaudio, though.

I think my only recourse is a clean install of Ubuntu. 11.10 is just out anyway :wink:


try opening the workspace instead of the cbp of the project. cleaning and recompiling again. If you’ve changed the constant in ofConstants it shouldn’t be using portaudio

Arturo, Thanks for the quick reply, that fixed it.

I had no idea that opening the .cbp wasn’t fully opening the project!

Or is it that it doesn’t fully clean the dependencies like this?

I definately recompiled the library from within the openFrameWorksCompiled project.

yes it doesn’t clean the dependencies. If you recompiled the openFrameworksCompiled project it should also work but sometimes the dependencies doesn’t recognize that the compiled library has changed

I’ve now got a situation where RtAudio works, but it only launches succesfully about 20% of the time. the 4 times out of 5 it segfaults at the audio callback testApp::audioIn …still kinda useable but I wonder has anyone seen behaviour like this?

you probably have something wrong in your code. call ofStreamSetup as the last call in setup when everything else is initialized. RtAudio works in it’s own thread so if you call it before initializing arrays that you are going to use in the audio callback you can get a segfault cause the memory is not initialized yet when audioIn/Out are called

Correct! Thank you again!