maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   [Announce] USB hostmode beta release (https://talk.maemo.org/showthread.php?t=65232)

Estel 2012-03-14 23:16

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by pigeond (Post 1179265)
However, before that, you need the alsa midi drivers. I had to compile them myself since they don't come with the n900 kernel packages. I'm using 2.6.28.10-power49 (power kernel).

Could You consider submitting modules in question to kernel-power team? It would be nice to have them included in KP.

Quote:

Originally Posted by fpp
Would you happen to know what driver(s) would be needed to make the N900 output digital sound through its USB port in host mode, just like a desktop Linux does when connected to an external DAC ?...

USB networking + pulseaudio? Or do You mean some "client mode" DAC, that require certain format sent and is not configurable (so no USB networking for it)?

/Estel

pali 2012-03-15 09:05

Re: [Announce] USB hostmode beta release
 
For audio output from N900 is NOT host mode needed. Instead g_nokia or g_file_storage, you can load g_audio module. It is USB audio gadget, which do what you want (it acts as usb sound card). You also need to configure pulseaudio for that support and compile kernel with g_audio module...

Oblomow 2012-03-15 15:57

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by pali (Post 1179743)
For audio output from N900 is NOT host mode needed. Instead g_nokia or g_file_storage, you can load g_audio module. It is USB audio gadget, which do what you want (it acts as usb sound card). You also need to configure pulseaudio for that support and compile kernel with g_audio module...

While this is amazing on it's own, I think fpps question was related to the use of external usb audio devices with the n900 (e.g. usb speakers). This was discussed before for example in http://talk.maemo.org/showthread.php?t=71980, but AFAIK without reporting success.

I would be very interested in this, too, especially for usb audio recording, as I have a small mixing console which behaves like a standard usb audio device. This, together with audacity from easy debian, could turn the n900 in a nice portable digital harddisk recorder, which would be pretty cool :)

I have tried in the past a bit with the snd-usb-audio module, but without success. Anyone could give some hints? After modprobe snd-usb-audio, should it appear automatically in alsa or is there more work to do?

fpp 2012-03-15 20:56

Re: [Announce] USB hostmode beta release
 
@Estel : no, not USB networking, rather what you call "client DAC" -- see examples below

@pali : this is astounding. Does it really answer the question in the thread Oblomow pointed to ?
Meaning, sending out digital audio signal through N900's USB port to an external device ? Without USB
host support ?

@Oblomow : yes, that is the idea, although my use case is a little different.
My idea would be to re-purpose my N900 as an "audiophile-grade" portable music player. I would use its internal 32GB (+SD card) for MP3/FLAC storage, its CPU/touchscreen for the UI (probably Rockbox), but not its audio system (internal DAC and amplifier).

The challenge is to get the decoded digital audio stream out through the USB port, and feed that to a portable DAC+amp combo such as one of these :

http://www.fiio.com.cn/product/index...&MenuID=020301
http://www.fiio.com.cn/product/index...&MenuID=020301
http://www.ibasso.com/en/products/show.asp?ID=73
(there are many more :-)

These gizmos behave like external USB sound cards, so I'm pretty sure USB Host is needed. On a PC with Windows or Ubuntu, you just plug them in and the sound comes out...

Oblomow 2012-03-15 21:51

Re: [Announce] USB hostmode beta release
 
I was experimenting today a little bit and got one step further...
I was connecting the usb mixer (yamaha mw10c) to the n900 (with kp49), enabled host mode via h-e-n and entered "sudo modprobe snd-usb-audio" in a shell. Afterwards I started Audacity through Easy Debian's LXDE. Then in Edit->Preferences->Devices usb audio devices show up. The good news: recording seems to work, at least sometimes with sluggish performance, but I got something that sounds quite ok after exporting to a wave file and playing in another program. Which leads to the bad news: until now every attempt to play via usb leads to a frozen screen, beeping noise (like some binary garbarge) playing through the usb audio device and after some seconds a reboot. I haven't spent much time with this upto now, so there might just be something wrong with sample rate or format or whatever. Also Audacity is really slow when playing back through the default (n900) device, with lots of hiccups. But I will keep on trying, maybe I'll find some setting that actually works.

BTW, thanks to the authors of kernel-power and h-e-n for their great work!

Oblomow 2012-03-16 02:17

Re: [Announce] USB hostmode beta release
 
Ok, got replay running. Little howto (for kp49):

Packages installed: alsa-utils,mplayer (all on maemo, not Easy Debian). Tested with Yamaha MW10c USB mixer.

first, connect device (standard usb audio device), start h-e-n, enable fullspeed, Vbus boost on, enumerate. Then, start an x-term and load the kernel module (probably not necessary, seems to be loaded by default):

Code:

sudo modprobe snd-usb-audio
check if your new audio device has appeared:

Code:

cat /proc/asound/cards
cat /proc/asound/devices

playing music with mplayer:

Code:

mplayer FILE.mp3 -ao alsa:device=hw=1.0
Plays perfectly, but CPU load is higher (40-50% compared to 15% when playing with mplayer through the internal DAC)

recording with arecord 44.1khz 16-bit stereo wav:

Code:

arecord --device=hw:default,DEV=0 -f cd -t wav FILE.wav
(default is the name on my n900 for the usb device, check /proc/asound/cards if it's the same for you)
I got sometimes some overruns with arecord, maybe one can change the buffer size or something similar. Hope to get a workaround... apart from that it's nearly perfect.

Next step would be to reroute the standard output to the USB if someone's interested - should be possible with pulse-audio somehow, but I have no idea about that :)

Oh - and anyone's got an idea for a lightweight multi-track recorder?:D

fpp 2012-03-16 21:29

Re: [Announce] USB hostmode beta release
 
W-O-W !

Oblomow, this is just incredible. I've been asking about this here and there for weeks, and suddenly here you come and it just works ! :-)

Now I'm going to have to reflash my N900 and see if I can reproduce all this with my DAC...

Quote:

Next step would be to reroute the standard output to the USB if someone's interested - should be possible with pulse-audio somehow
Yes, that would probably be the last missing bit... so that we could use any audio player (like the Maemo Rockbox port) and not only mplayer.

I hope someone can chime in on how to do this...

Many thanks for sharing your results !

fpp 2012-03-18 15:51

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by Oblomow (Post 1180098)
Ok, got replay running. Little howto (for kp49):
Packages installed: alsa-utils,mplayer (all on maemo, not Easy Debian).

I can't seem to find "alsa-utils" in application manager, although it's supposed to be in maemo.org... Is it in some special repo ?...

EDIT : never mind, I tried with apt-get, and it seems I already have the latest version, although it doesn't show up in HAM...

fpp 2012-03-18 16:55

Re: [Announce] USB hostmode beta release
 
All right, status report :

To my great surprise, it worked perfectly at first try :-)
Thanks again Oblomow for the detailed instructions !

After installing kp49 and h-e-n, I connected the N900's usb output to my DAC's input.

After the three-step h-e-n setup the DAC's LED turned to green, and cat /proc/asound/cards showed a detailed description of it.

Then the magic command (mplayer FILE.mp3 -ao alsa:device=hw=1.0) played everything through the DAC, yay ! :-)

So now we have a definite proof of concept that it is doable.

What's left is about usability on a day-to-day, on-the-go basis :

* a script that automates h-e-n speed/VBus/enumerate

* redirection of the standard sound output to USB so that any music player can be used

* buy a new battery, because h-e-n seems to suck down fast, although the DAC has its own power :-)

Getting really close now, thanks to you !

fpp 2012-03-18 17:58

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by fpp (Post 1181114)
* redirection of the standard sound output to USB so that any music player can be used

From the Pulseaudio website it looks like this should be easily scriptable using the pacmd utility and the CLI syntax, something like :

Quote:

pacmd set-default-sink X
Unfortunately, pacmd does not seem to be in the Maemo version of pulseaudio, and the examples from the web site don't seem to work. As usual :-)


All times are GMT. The time now is 12:19.

vBulletin® Version 3.8.8