0

I am using a Focusrite Scarlett 18i20 audio interface, where I need to use at least 4 of its inputs to record the impulse response. I am running on a Windows 10 PC, using python (anaconda) and sounddevice.

When I use sounddevice.query_devices(), it lists the device as "1 Focusrite USB (Focusrite USB Au, MME (2 in, 0 out)".

My problem is that the device in fact has 8 analogue input channels, and I need at least 4 of them. The same is true for the outputs, it sees 2 but it should be 8. How can I make sounddevice recognize them? Is this a driver problem?

devices in matlab and sounddevice

  • Can you please post the full list of devices? – Matthias Jul 08 '19 at 07:08
  • Yes, see the image in the link I added to the main post or here: https://i.stack.imgur.com/NzIdR.png – Håvard Arnestad Jul 19 '19 at 12:04
  • 1
    Did you install the `sounddevice` module with `conda`? If yes, you should try to deinstall it and install it with `pip`. – Matthias Jul 19 '19 at 17:34
  • Thanks! I reinstalled with pip and it now shows me the device with the correct number of inputs and outputs. Hopefully it will work nicely from here, thanks again! – Håvard Arnestad Jul 22 '19 at 12:15
  • I think it would be great to have an answer which explains this issue. I've just been puzzling about why my sounddevice module only shows me the MME API (and incidentally 2 inputs/outputs instead of what I believe should be 8). I also installed sounddevice with conda, but both it and PortAudio appear to be the correct version so I guess I'm wondering what it is about the conda vs. pip installation that is having an impact. Thanks in advance :-D (Question probably aimed at @Matthias :)) – Neilski May 24 '20 at 16:17
  • 1
    @Neilski The problem is that the PortAudio package on `conda-forge` doesn't have ASIO support, see https://github.com/conda-forge/portaudio-feedstock/issues/9. See also https://github.com/spatialaudio/python-sounddevice/issues/229. – Matthias May 24 '20 at 19:13
  • @Matthias - many thanks! I had a bit of a struggle getting it fixed but having removed portaudio and sounddevice (with conda) and then installed sounddevice again with pip, it's now working perfectly. I see that sounddevice has its own portaudio lib. (Along the way I learned that "python3 -m pip " doesn't work at all, but leave out the '3' and it's all good... LOL.) One odd thing which betrays my huge ignorance of anything to do with conda: Anaconda Navigator is saying that sounddevice isn't installed, so I guess conda doesn't know what pip did. Probly not an issue tho? – Neilski May 24 '20 at 21:28

1 Answers1

0

Since there is plenty of audio drivers on Windows 10 that can run between your Scarlett and Python, you have to chose the more appropriate (ASIO works well on windows, you can download it here).

Once downloaded and installed, sounddevice.query_devices() should return several strings containing Scarlett, each one with a different driver.

Then you just have to initiate your stream and select all your channels (mine is 6i6 so only 6 channels) :

    def run(self):
        try:
          with sd.Stream(callback=self.read_stream, {'device': "Focusrite USB ASIO", 'channels': 6}, samplerate=44100):
                    sd.sleep(2147483647)
        except ValueError:
            print("Focusrite disconnected")
  • The ASIO4ALL link is helpful, but according to the device list in the question, this is already installed. The problem is that the PortAudio DLL has to have support for ASIO compiled in. See the comments below the question. – Matthias May 24 '20 at 19:16