introlab / odas

ODAS: Open embeddeD Audition System
MIT License
800 stars 254 forks source link

Running odas_web and a python script at the same time #130

Open viduraakalanka opened 6 years ago

viduraakalanka commented 6 years ago

Hi, currently i am using odas_web with my Respeaker mic array v2.0. I want to know whether we can run odas_web and at the same time another program which uses the mic array (i.e. python script). If so, how can we implement it?

FrancoisGrondin commented 6 years ago

Hmmm you mean two devices that use the ALSA driver? Technically you'll need to have a script that gets the input from the device, and then pipes it to two pipes, one that goes to odas, the other to your python script.

dianalow commented 4 years ago

I'm also facing this issue. I got some clues reading scotthasse's solution for the Delta audio card

and tried to configure my /etc/asound.conf to this:

pcm.multi_capture{
    type dsnoop
    ipc_key 1024
    slave {
        pcm "hw:1,0"
        channels 6
    }
}

pcm.dmixed {
    type dmix
    ipc_key 1025
    ipc_key_add_uid 0
    slave.pcm "hw:0,0"
}

pcm.duplex {
    type asym
    playback.pcm "dmixed"
    capture.pcm "multi_capture"
}

# Instruct ALSA to use pcm.duplex as the default device
pcm.!default {
    type plug
    slave.pcm "duplex"
}
ctl.!default {
    type hw
    card 0
}

I tested the configuration to see if it works: arecord -Dplug:multi_capture -f S16_LE -c 6 test.wav and it does.

I then modified my odas config to this:

raw: 
{

    fS = 16000;
    hopSize = 128;
    nBits = 16;
    nChannels = 6; 

    # Input with raw signal from microphones
    interface: {
        type = "soundcard_name";
        devicename = "multi_capture";  #EDITED : previously I made the mistake of device_name
    }

}

but when I ran odaslive, I encountered this error: Cannot find path "raw.interface.devicename" in config file

Am I using the soundcard_name field incorrectly?

dianalow commented 4 years ago

My bad - it is "devicename" instead of "device_name".

I've managed to launch both odaslive and arecord concurrently. Haven't had any luck with my python script but it could be how my script is written.

Hopefully this helps in the solution somehow!