OpenWrt Forum Archive

Topic: USB audio input and ices

The content of this topic has been archived on 7 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have a bunch of questions:

I installed all usb audio ac97 and alsa packages And my VIA based USB audio adapter works.
It records with

arecord -vv test.wav

and

aplay test.wav

does play it back

However with a few glitches... 
Ii think it is a bit to heavy on the cpu how do i verify this?  What else can i do to make it record more smooth?

Then how do i stream it with ices.
The ices manual says

ices /etc/ices.xml

  but that file does not exist, is that supposed to be created manually?

What should i expect performance wise? What bitrates should be possible on MT6720 and AR9331 SoCs?

And where do i find the audio input? 
Is there a way to visualise the mic signal?

When I do

cat test.wav

then i can see the data that was recorded into that file

Is there a way to see a live audio signal in a similar  way?

Most usb audio project only cover mp3 playback but on audio capture and streaming on OpenWrt the info is a bit more limited.

The VIA USB audio adapter has a LED, when I plug this device into a Ubuntu machine the LED lights up, However in the OpenWrt device the LED stays OFF.  What is it that controls a LED on a USB device?

When I hotplug the VIA USB audio device then the MT7620 (NEXX) reboots, the AR9331 (AR150) seems to be fine with it.  When i use a USB hub on the MT7620 then the MT7620 does not reboot.
Is this a MT7620 bug,or a hardware issue?  It's not a real problem just an annoyance that i happened to notice.
Though if it is a bug then i will report it.

(Last edited by frietpan on 19 Nov 2015, 23:31)

If you want the best perfomance you should use as format the same raw pcm format that it use your usb audio card internally, I think there is a aplay option to see this hardware format.

My usb audio card only has one format, 48khz sampling rate and 16 bits depth, the play or record of any other format requires conversion by software (resampling audio can be a hard work for the cpu of a router).
The usb driver is very simple, it sends USB_ISOCHRONOUS packets with the samples in that audio pcm format.

My usb audio card is a cheap one, a blue "3d sound" usb dongle.

Thanks KAHN85,

Lets see if I understood that,   
Staying in the default samplerate means no  resampling is necessary and that saves on CPU load?
So i can then get full samplerate data that's nice, For recording this would be OK. Though if i want to stream the data (Using ICES) then the high samplerate will be an issue, Since it then needs to be encoded into OGG.
I'm still learning how to configure ICES, i have not figured it out yet.  And i don't know how much load it will be on a tiny MT7620 SoC.  I expect a few obstacles here. 

What i would like to achieve is a stable audio stream but at a bitrate that the MT7620 can handle.
And i try to figure out if there are options to reduce the cpuload.

The USB card i use is also a cheap audio dongle.  The chip is a VIA VT1620 and the specs in the datasheet surprised me, The thing is capable of doing 24bit / 192khz.
http://www.viatech.com/en/silicon/legacy/audio/vt1620a/
http://www.datasheet4u.com/datasheet-pd … ?id=918331
44.1khz seems to be the lowest supported bitrate

So it looks like using ices to encode it to OGG is a lot to ask for.

In aplay i can indeed find playback parameters
in arecord however i would expect record parameters, but in arecord i get a list of the same playback parameters...

If i understand the datasheet correct then the VT1620 only spits out RAW PCM data and i dont see if it is possible to reduce the samplerate to 22khz on the chip itself.  I have a few other SUB sound cards so i will also have a look at those soon.

It's not yet clear to me if OGG encoding is a viable option or not.  A mono stream @ low bitrate would be good enough. 

However these devices are capable of streaming webcams so i hope for the best for streaming audio.

Yes, software resampling is a intensive activity for a small router cpu.

Audio encoding is a cpu intensive activity too.

If the kind of audio you want to record is human voice you can use another audio codec like "speex".

Also, consider that one thing is chip specs and another thing is driver implementation.

You can view the data through usb with "usbmon" kernel module and tcpdump (network sniffer than it can be used to sniff usb too).
And you can code your own user-space driver implementation using libusb or usbfs directly.

The VIA chip also seems to have VOIP capabillities not clear yet what that means, i can't imagine that there is a compression codec in there, though that would be cool in this case.
Coding my own driver..., I don't have the coding skills to do this yet, i'm slowly learning the capabillities and limits of audio on these devices, so maybe in the future i can have a look at some more advanced stuff.

The discussion might have continued from here.