Simple cheap USB Microphone / Soundcard

The https://www.microchipdirect.com/product/ZL38063LDG1 does seem reasonably priced and how it compares to the Xmos chip in the respeaker or my Anker powerconf I dunno but not all that impressed with the Xmos chip or even Google or Amazon units when 3rd party TV or media is the predominant noise.

A small run would just produce a costly product for very little gain but if someone like Raspberry uses its economies of scale that would be a different matter.
I guess if Raspberry gets to a stage of providing a cost effective AI accelerator then its likely we will see something like the ZL38063LDG1.

If we where to make something as a community I wouldn’t advocate any beamformer or the current infrastructure rhasppy uses as all that would remain is the py of the language that is programmed.

Rather than try the impossible with far field beamformers it is getting at a cost level with ESP32 boards to create near field multiple distributed mics.
The ESP32-A1S has a built in codec (the one in the pi 4 mic hat) that could interface directional electrets.

http://www.ai-thinker.com/Uploads/file/20190715/20190715141756_57655.pdf

Its capable of running a KWS that runs locally but provides KWS hit score so that a central HAL(2001) type rhasspy can choose the best mic for a single ASR session.
Opensource has been copying the commercial product we see and not providing solutions to rival commercial infrastructure.
You can provide a central system with GPU with multiple room mics to service a room and if the system is also the audio server then we can provide EC for all problematic domestic noise.

But a lesser stage would be to provide a Rhasspy sound bar that the TV can provide audio pass through and then you have solved the problem of 3rd party media as you bring it to the system and it is no longer 3rd party.

Here is a Pi 2 mic hat.

Near
https://drive.google.com/open?id=1w6qK8BYCd-gtfwXP4eh6dfyflELzZ0yM
Far @ 3m.
https://drive.google.com/open?id=119ifVznzy57AT-LkkQ9a_Ev5q6nNnxkh

I actually had this up and running and thought I would post.

I tried with the hardware ALC & Noise gate and it just didn’t seem right so turned it off set the gain of the 2mic to 34(9db)

Added this to /etc/voicecard/asound_2mic.conf

# The IPC key of dmix or dsnoop plugin must be unique
# If 555555 or 666666 is used by other processes, use another one


# use samplerate to resample as speexdsp resample is bad
defaults.pcm.rate_converter "samplerate"

pcm.!default {
    type asym
    playback.pcm "playback"
    capture.pcm "capture"
}

pcm.playback {
    type plug
    slave.pcm "dmixed"
}

pcm.capture {
    type plug
    slave.pcm "array"
}

pcm.dmixed {
    type dmix
    slave.pcm "hw:seeed2micvoicec"
    ipc_key 555555
}

pcm.array {
    type dsnoop
    slave {
        pcm "hw:seeed2micvoicec"
        channels 2
    }
    ipc_key 666666
}

pcm.agc {
 type speex
 slave.pcm "sum"
 agc 1
 agc_level 4000
 denoise no
 dereverb no
}

pcm.sum {
 type plug
 slave {
   pcm "array"
   channels 2
   }
 route_policy sum
}

So its sums to mono then runs agc and recorded via.
arecord -D agc -r16000 -fS16_LE far.wav

I spent considerable time trying to sort the hardware ALC but just don’t have patience with that card any more.
Its software gain and the far @ 3.2m (if we are going to be exact) is far from impressive.

If there is anyone who is a fan of the Pi2mic maybe they can help out kibo with Recognize command with music

Hmm mine doesn’t sound like this:
https://drive.google.com/file/d/1x0jGJLIDa1Sa-AFRYHPE0aTfDNfaWYro/view?usp=sharing
This is the 2 mic hat recording a tv that is ca 4m away. It’s recorded with a sox record command with a compand effect with a transfer function that effectively acts as an agc. The tv is running at normal room level and there is no other effects. Sorry for the amount of base but we have a 2.1 system with a big subwoofer connected to the tv.

Edit here is another one with some talking by me and my girlfriend over the tv between 3 and 4 meters away from the mic and talking away from it:
https://drive.google.com/file/d/1gu3EqmqkDQVDIUmDRfBaHjFeJTKJ_vUL/view?usp=sharing

You need to record the exact same at the same volume at near & far as otherwise its impossible to tell what that should be like.
As we can only tell by comparing the 2 if they are the same source.
Maybe you should post the sox settings & commands you have as it is not likely to sound the same if you are using a different effect.

Do you not have a bluetooth speaker or something that you can move or move the rhasspy to record a prerecorded playback each time.
Also why are you using sox when this 2mic is supposedly so good with all functionality all in?

never said anything about agc

Because Im the developer of https://github.com/johanneskropf/node-red-contrib-sox-utils and this is what i use in combination with voice2json and as I find sox to be a great all around tool offering much more flexibility than arecord or parec. This was recorded straight from nodered. The compand is the only applied effect. Its pretty much the same as doing sox -t alsa plughw:1,0 -L -e signed-integer -c 1 -r 16000 -b 16 test.wav trim 0 60 compand 0.1,0.3 -40,-40,-20,-10,0,-10 -10 -60 from the commandline. The installation of the 2 mic pi hat is stock with no settings changed.

near (1.5 meters):
https://drive.google.com/file/d/146HSYi1_PYQInMD6CSC0V7RXvsj3jXJO/view?usp=sharing

far (4.5 meters):
https://drive.google.com/file/d/1bQPYgqjH-tyE1ItDhXZms-Q3uD4FsbAr/view?usp=sharing

With just default settings no alc, agc or anything with the default gain of 40 (12db)

Running near and far @3m.

Near
https://drive.google.com/open?id=1YRUMobeWg5LJ3W7s1cRYhR05j12AmEY_
Far
https://drive.google.com/open?id=1e8mh0whva8doO9WKRLX03THYVKXFx3vR

It really sounds to me like at least for the 2mic hat the speex agc is doing no favors and your better of without it.

Well that is a problem as have you seen the amplitude of the last far signal and that is only @ 3m.

The USB mic @3 meter looks like this.

Problem is without Speex AGC due to the ALC not seeming to working correctly on the 2 mic your signal is woefully low.

I ve been playing some more with the sox compand. Added a noise gate and will see how I go:

compand 0.1,0.2 -inf,-35.1,-inf,-35,-35,-25,-12,0,-12 -12 -60 0.1

Edit:
Also I think the sox compand transfer function agc is doing a better job than the speex when you look at the far example at 4.5 meters above.

I just posted above a respeaker not running AGC with the sox compand and the picture is there right above and its far field is truly awful.

sox -t alsa plughw:1,0 -L -e signed-integer -c 1 -r 16000 -b 16 test.wav trim 0 60 compand 0.1,0.3 -40,-40,-20,-10,0,-10 -10 -60

Here I have got my posh Max9814 boards that are 3.6v-12v supply with own regulator and jumpers to select A/R & gain.
Its being fed from the 5v rail this time and because once more I ripped the solder pad off the cheaper Max9814 boards trying to remove the electret I dug one these out as the mic connector is on jumper leads.
Apart from that essentially the same but this does let me try out an el cheapo 20p directional electret.

Its the same thing again but this time near-rear has the mic facing the opposite way as its directional.
far-rear has a much lesser effect because of room echo and dispersion of sound so much less hits the rear as it does in the near-far sample.
Also distance sensitivity is much less because again due to room echo and dispersion of sound much more hits the rear of the mic.

This is where a sound card and mic module really shines as its the only form of 3rd party noise suppression available to us without expensive beamforming.

https://drive.google.com/open?id=15fGs3rwbAAO3nI5RPLapGTKAv9x00MvP

https://drive.google.com/open?id=1wKbfUc7-qHCVYSQvVBBqD0xnLi7O9SBO

https://drive.google.com/open?id=1wUTH2DLO7O4OZZP_hFo_o4M0nsOxvcAd

https://drive.google.com/open?id=1nMi5EStkPOv5zZn5QejRvvpER3hD90je

Its placement and using directionality but as you can see it will attenuate noise from the rear.

There are better electrets than the el cheapo 20p china ones but struggled to source them prob would have to buy more than just a couple and need to try and find them again.

They exist like these out of a cheap £10 directional microphone.

I think I ll stay with the 2 mic pi hat and sox for now as building a nice compact satellite out of this with a button as an additional stt trigger, an amp, rgb leds, a speaker and no cables visible apart from the power cable really would be pain and not one I would want to have four times which is how many satellites I have right now. Soon it will be six. I can see this on my workbench for playing but not as something that would be accepted as a general solution in the household that everybody has to be happy with.
It would really be a tiny improvement for hours I’d have to spent to build it.
That’s the charme of the hat. Takes me 3 minutes to assemble another satellite.
But thanks for the noise gate inspiration, I think it will be a nice addition to my sox command.
And at least for me the 2mic works fine up too more than four meters set up like this.

If that is what your happy with the fair enough but when I tried the commands you forwarded for sox with a Pi2Mic with the default settings you said of 40(12db) gain far field was absolutely tragic.

But hey if your happy with that go for it.

That’s what my 4.5 m example above was recorded with.

I copied and pasted what you posted here and @ 3m it was tragic.


Was near and far with a Pi2Mix recorded with your sox command.
I will try it with more gain on the capture but you did say defaults.

PS can you play to a sink rather than a file with Sox?

I didn’t change anything in the settings or a mixer. Pretty much the only thing I did was install the seeed driver, sox and nodered.

Edit just confirmed default 40

Yes should be possible. It should support alsa or pulseaudio sinks as outputs.
You would probably have to add something pretty similar to the input argument:
-t alsa yoursink but you should better google that. You can also play to standard out when defining the format with the t argument: -t raw -.

You saw the volumes with those settings and they are far to quiet maybe not all wm8960 2mics are alike!?

Do you have a copy or one of the seeedstudio originals? Because I know I ve had bad clones before.

Copy I guess.

Maybe the mics on it are shit as it is.