I'm having a weird issue currently, which I'm not too sure how to resolve as of right now.

On my Raspberry Pi 1, there's a USB sound card connected, where I need the microphone input from (the pi is connected via GPIO to a 64x64 RGB Matrix). Since the matrix driver needs snd_bcm2835 to be disabled, and I also need the mic input for sound visualization, I want to use the USB sound card together with PortAudio (and C++ using portaudiocpp).

I use this code for initializing and enumerating the audio devices on the Pi:

void CAudio::Initialize()
    PaError err = Pa_Initialize();
    if (err != paNoError)
        CLogging::Log(LogAudio, Error, "Couldn't initialize audio interface! Error: %s", Pa_GetErrorText(err));

    const PaDeviceInfo* deviceInfo;
    int num = Pa_GetDeviceCount();
    CLogging::Log(LogAudio, Message, "Num %d", num);
    for (int i = 0; i < num; i++)
        deviceInfo = Pa_GetDeviceInfo(i);

        CLogging::Log(LogAudio, Message, "Device %s", deviceInfo->name);

    Initialized = true;

But unfortunately it's only logging "Num 0", so it doesn't enumerate my USB sound card. Output from aplay -l:

**** List of PLAYBACK Hardware Devices ****
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
   Subdevices: 1/1
   Subdevice #0: subdevice #0

What's happening here? Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.