Audacity Fails with the Pa_GetStreamHostApiType Error.

EDIT – Look for a better way to do this at the end of the post.

I was just running some PortAudio programs, when I saw that the maximum and the average amplitude reported by the recording were both 0.00. This meant that my microphone was not working and I immediately tried to start Audacity to test whether that was the case, since it gives a beautiful wave form for the recording in real time.

Running Audacity using GUI on Ubuntu 12.04 LTS, it failed to start and I tried restarting it a couple of times. Then, I went to the terminal and tried to start Audacity from there, at which point, it failed with the error:

audacity: symbol lookup error: audacity: undefined symbol: Pa_GetStreamHostApiType

Seeing the undefined symbol, Pa_GetStreamHostApiType, I knew that my PortAudio installation had messed something up.

So, to see the shared library dependencies of Audacity, I did:

ldd /usr/bin/audacity | grep portaudio

and sure enough, the dependency was pointing to /usr/local/lib.

So, the solution was to remove the libportaudio files from the /usr/local/lib, by doing:

rm -rf /usr/local/lib/libportaudio*
ldconfig

And, then I tried running Audacity and it finally started!

Another way to get your Audacity installation up and running without deleting shared libraries would be to give Audacity an extra directory to look for the libportaudio.so.* files. This is done using the LD_LIBRARY_PATH variable. Here’s a blog post explaining why LD_LIBRARY_PATH is bad.

Start Audacity using the following command then:

LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/ audacity

If anyone cares, the reason why I wasn’t getting any input through the microphone was that somehow the Microphone had gotten muted inside the Sound Settings of Ubuntu!

I had to set it back to Unamplified and the microphones were back to life again!

Input Volume; Unamplified

4 thoughts on “Audacity Fails with the Pa_GetStreamHostApiType Error.

  1. Random Human says:

    Randomly deleting shared libraries is dangerous! Always take a backup and/or know how to fix your system if something goes wrong.

    From what I get, the system installed newer versions of the libraries in some other directory, but left the old ones as it is. If that’s the case, report it or file a bug (whatever is appropriate for Ubuntu).

    • I did take a back up of the libportaudio* files in /usr/local/lib.

      Audacity installs its own version of PortAudio, but somehow got linked to my earlier installation of PortAudio instead of its own.

      • Random Human says:

        Regardless of the fact that the PortAudio package is separately installed from Audacity or not, it should remove the previous version. The program should be up and running after installation without this system level fiddling.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s