Reply
Thread Tools
fpp's Avatar
Posts: 2,853 | Thanked: 954 times | Joined on Nov 2005
#1
After being (gently and politely) bounced from the "USB host mode" thread for wandering off-topic, I am creating this new topic to continue the discussion, and maybe gain a few more participants who might be interested but hadn't noticed it was going on :-)

Sorry, the first posts are a bit long because there is a lot to recap...

EDIT: updated post #4 to add mention of smplayer.
__________________
maemo blog

Last edited by fpp; 2012-11-03 at 18:00.
 
fpp's Avatar
Posts: 2,853 | Thanked: 954 times | Joined on Nov 2005
#2
RATIONALE :

1. Wait, isn't the N900 a portable music player already ?

Sure, it is. Just like any other modern mobile phone, tablet, and of course specialized digital audio players (DAP) like the iPod, iRiver, Cowon and other devices.

All DAPs or PMPs have the following components :
  • a battery :-)
  • storage: preferrably lots of it, as internal Flash and/or SD card, to store your digital music, generally in compressed form (as MP3 or FLAC files for example).
  • media player software to let the user interact with that collection of files
  • most often (but not always) a screen, to display information (playlists, tags etc.)
  • a user interface to command the software: hardware buttons and/or touch-screen
  • more software bits (called codecs) to decode the compressed format being played and turn it into an uncompressed digital stream (PCM). These codecs determine which files your DAP will be able to play (mp3, flac, alac, wma, etc.).

All these are needed just to select a file and play it.
Up to now, everything happened in digital format, just "bit-shuffling", and it doesn't really matter how it was done, as the resulting signal is always the same.

Now, for sound to actually come out in the real world, we need to "go analog", which means a few more components :
  • a digital-to-analog converter (DAC) : electronics (often just a chip) that turn the digital stream (zeroes and ones) into an analog signal (continuous waveform of varying frequencies - think sine waves)
  • an amplifier : more electronics to turn that weak analog signal into something powerful enough to move at least a pair of earphones
  • a jack socket and a volume control :-)

Note: when you play music through your computer, the exact same things happen, the DAC/amp part in this case being your computer's "sound card" (actually most often a chipset nowadays).


2. So, what is an "audiophile" portable music player then ?

If all you need is background music for running, riding a bike, bus or train, and generally shut out noise from the outside world, any device will do, quality-wise. What you will be looking for is size, weight, battery life, ease of use, ability to play your files, insulation, etc.

But if you have good-sounding Hifi equipment at home, and listen to your mobile player in the same quiet conditions, you will likely notice a huge difference in quality between the two.

If you want or need better, near-Hifi sound on the go (say, you spend a lot of time in hotels), bridging that gap means entering a new world, mostly made of costly compromises :-)


3. But what makes sound worse or better ?

Most of all, the "source", ie the contents of the file you're playing. If it's bad, no amount of technology will make it good... The original sound itself may be the cause (old recording, bad mixing etc.), but more often it comes from careless or excessive compression : a 128Kbps mp3 file will never sound as good as the original CD, no matter what. From here on we'll suppose we have a good source, like a clean rip of a CD in a lossless compression format such as FLAC.

Next in line is the DAC : digital-to-analog is where a lot of the stuff happens. It's surprising how much better a good DAC can make the same file sound, compared to run-of-the-mill chipsets found in your regular PC or laptop.

Then there is the amplification stage, which adds its own problems. Noise, hiss, non-linear frequency response, sound coloration, etc. Also, if you are using good headphones which happen to have high impedance (see below), it might yield good sound but simply not have enough juice (power) to drive them correctly...

Last of course are the earplugs/earphones/headphones : if you use tin cans in/on your ears, the best source+DAC+amp in the world is going to sound like a tin can :-)

Both ends (sources and *phones) are under your control. The real issue is having a choice of DACs and amps.


4. How does that work in practice ?

At home, rigging a HiFi setup that will get a nice, clean, clear sound out of your digital music is neither difficult nor overly expensive (if you're not an "extreme audiophile", that is :-).
Your files will generally be on a PC or laptop. This gives you the first six bullets in part (1) above : power, storage, media player, codecs, and UI. As long as everything stays digital this is just fine.

The main trick to better quality is to bypass the computer's built-in DAC/amplifier (the "sound card"), to extract the original digital signal and process it somewhere else. This is made very easy with USB, which all computers have.

There are lots of external DACs on the market, some standalone, some coupled with a headphone amp. They come in all shapes, sizes, and prices.
Just plug one into a USB port, and the system (Windows, Linux, OSX) will detect it and automatically redirect its digital sound output to it. That's all. Your music will then be converted to analog by the external DAC and amplified for your phones by the external amp.

Even entry-level DAC/amps make an incredible difference (with good sources and phones, of course).
The bottom line is that you get to choose each stage of the sound processing, mix and match, try out different things, upgrade this or that as you wish.


5. Why is the "portable" situation different from the rest ?


Well, the "P" in DAP/PMP stands for "portable", so that's what the market offers : the whole enchilada in one pocketable package. Yes, the tiny Sans Clip+ actually has all nine components described above, including screen and up to 40GB of memory, in less than 4 by 6 centimeters :-)

Again, most of the time that is perfectly fine. It is, however, an all-or-nothing proposition : when you switch from an iPod to a Cowon J3 to a Samsung Galaxy to anything else, you are forced to buy a new screen, new storage space, new UI and controls (with new bugs :-), etc.

And if you are willing to sacrifice some portability for better sound, it's even worse, because you have no choice of components. There are a few "audiophile-oriented" DAPs on the market with truly superior sound quality (and prices), but it's a niche market, catered to by small specialist outfits. The results sound great, but tend to have unacceptable downsides compared to mass-market products, especially for the price : limited memory and/or battery life, user-unfriendly and/or incredibly buggy interface, poor support being the main ones.

So the logical way out would be to use a run-of-the-mill device only for the digital part, like the PC, then extract the signal and feed it to the portable equivalent of our DAC/amp combo above... These do actually exist. Unfortunately, given the state of the mass-market devices, using them like this is most of the time impossible, or very difficult.

The first hurdle is that the mobile device must have a USB Host port, which is not common at all. Those few that do are mostly Android devices, but the current Linux kernel in Android does not have USB sound support like the PC version does. This may change in the future, but right now the situation is dismal...


6. Good old N900 to the rescue ?...

My N900 is old but in good working condition. I'm not using it as a phone anymore, so it's open to experiments :-)

Thinking about this stuff I realized it had great potential as a DAP : 32 GB of internal memory, plus SD card, a nice screen and UI, Linux-based and hackable, able to run a number of multimedia apps, etc. And also the same hurdles as the rest : a non-Host USB port, and a crippled kernel...

But one of the defining (and endearing) qualities of the Maemo community, since 2005, is that it doesn't take "No" for an answer. So I thought there might still be hope, and this project was born :-)
__________________
maemo blog

Last edited by fpp; 2012-03-26 at 20:40.
 

The Following 16 Users Say Thank You to fpp For This Useful Post:
fpp's Avatar
Posts: 2,853 | Thanked: 954 times | Joined on Nov 2005
#3
HISTORY :

The USB Host issue being the first hurdle, I headed to the relevant topic.

It just happens that my post is #1000, at the end of page 100 :-)

A few interested souls chimed in, and the discussion spans most of the next three pages...

We did outstay our welcome though, as the actual USB Host issue was solved almost immediately, but we still went on discussing the next (unrelated) hurdles such as ALSA and PulseAudio and media players... until joerg got understandably itchy :-)

So if you're curious about how things came about you can go read those few pages, but most of the results are summed up below...
__________________
maemo blog

Last edited by fpp; 2012-03-26 at 20:39.
 

The Following 7 Users Say Thank You to fpp For This Useful Post:
fpp's Avatar
Posts: 2,853 | Thanked: 954 times | Joined on Nov 2005
#4
THE RESULTS SO FAR :

Oblomow was the first to confirm that standard h-e-n procedure to activate USB Host was enough to support external sound devices (in his case, a recorder).

Installing h-e-n also means installing a custom Linux kernel (the Power Kernel also used for overclocking), which packs a lot of stuff that was missing in the stock Maemo distribution.
Activating host mode detects the external equipment and automatically creates the corresponding ALSA device. Streaming to/from this device is supported by the kernel.
So that's two major hurdles in one jump, without even trying :-)

Oblomow verified this by playing a sound file from the command line in xterm, using mplayer with the ALSA device as a parameter.

This proof of concept was a very manual process, but it was a great moment when the sound came out from the DAC/amp :-)

Using GUI media players (like Maemo's, or Rockbox) requires redirecting the default sound output (managed by PulseAudio) to the ALSA device above.
Sounds simple in principle, but unfortunately has proved intractable up to now :-)

Then kirillkk chimed in with another solution : use MOC (mocp), a full-featured media player that happens to run in text mode, in the xterm console.
The output device can be specified in its configuration file, so it's start and play...

kirillkk provided his own build of MOC for Maemo, with some useful hints on how to install it.
After a few fumbles I got it to work, it is truly very usable !
I do have a few questions for him when he comes back, though :-)

So thanks to them and the h-e-n team and the Power kernel hackers, we have something working that I thought was impossible just a fortnight ago...

What remains, mostly, is to make it fluid and user-friendly for day-to-day use.

EDIT: I forgot to add another solution that was suggested later on, thanks to Estel for remiding me about it.
smplayer is a full GUI for mplayer, available from the repositories, which is more user-friendly (lets you choose ALSA output from a list, amongst other things).
__________________
maemo blog

Last edited by fpp; 2012-11-03 at 17:58.
 

The Following 5 Users Say Thank You to fpp For This Useful Post:
fpp's Avatar
Posts: 2,853 | Thanked: 954 times | Joined on Nov 2005
#5
TODO :

(draft list)
  • either solve the PulseAudio mystery to have a choice of software, or invest in MOC customization and packaging
  • can MOC use the N900's rocker and camera keys ?
  • replace the three-step h-e-n activation in the GUI by the corresponding scripts
  • make an icon that launches these, then MOC (and unload on exit)
  • try out a cheap portable DAC/amp like the Fiio E7
  • buy a new battery :-)
__________________
maemo blog

Last edited by fpp; 2012-03-26 at 21:39.
 

The Following 5 Users Say Thank You to fpp For This Useful Post:
Posts: 892 | Thanked: 964 times | Joined on Feb 2011 @ Greece, Athens
#6
Nokia N91 , 5800XM (aka Tube) and N900 are the best mp3 players I ever owned.

Install the "100% volume patch" on the N900 and you have a faqing AWESOME portable music player.



*I recommend the use of Sennheiser
 
Estel's Avatar
Posts: 4,941 | Thanked: 8,234 times | Joined on Mar 2011
#7
Thanks for Your incredibly detailed introduction, fpp. My 2 cents, if You don't mind:

1. Using N900 as audiophile-grade portable media player - or, in more technical words, a player that throws out digital audio data and left further steps to external components - is very great and important thing, yet, it's only one side of a coin. Another awesome benefit, is that using this (polished, more casual use-friendly, that is) we are able to actually record things in audiophile quality - basically, if we connect full-fledged mixer (with USB client), our lightweight, portable N900 isn't any worse than desktop PC. For people creating bootlegs from concerts (shows), or other situations, where sound quality is very important, yet portable size is a must, it's incredible. We got features, that normally require expensive and/or heavy devices, still more limited than our N900.

As for this purpose, I see only one possible limitation - lately reported, still *unconfirmed* (for 100%) limit of USB hostmode bandwidth (see hostmode thread for details, it was mentioned almost just before audio output discussion started). In any case, it shouldn't affect stereo recording, yet something like full 5.1 records (via USB mixer) could get hurt.

It's still possible, that this issue is non-existent, or fixable (unfortunately, on kernel implementation side, which require quite narrow area of knowledge, USB/kernel :/ ).

2. Back to audio-output:

Originally Posted by fpp View Post
Using GUI media players (like Maemo's, or Rockbox) requires redirecting the default sound output (managed by PulseAudio) to the ALSA device above.
Sounds simple in principle, but unfortunately has proved intractable up to now :-)

Then kirillkk chimed in with another solution : use MOC (mocp), a full-featured media player that happens to run in text mode, in the xterm console.
The output device can be specified in its configuration file, so it's start and play...

kirillkk provided his own build of MOC for Maemo, with some useful hints on how to install it.
After a few fumbles I got it to work, it is truly very usable !
I do have a few questions for him when he comes back, though :-)
While I greatly appreciate sharing of MOC solution, it's still not what we're looking for. First of all, it runs solely on CPU (like Oblomow's proof-of-concept with mplayer), so it doesn't use hardware acceleration for decoding, thus eating battery power much more greatly (and limit multitasking with CPU-heavy things). Second, I'm pretty convinced, that our current pulseaudio problems are some sort of hiccup originating from Maemo version limitations - no one thought, that any Maemo user will need to redirect system sounds via USB.

I'm absolutely sure, that experienced linux user (guru?) would be able to find worfkaround and/or problem solution - help in that matter is greatly, greatly appreciated. For now, maybe it's possible to bypass issue using Easy Debian in pure Squeeze version? Sulu was able to make pulseaudio working there, and leetnoob - many months ago - succeed in getting hardware accelerated playback in Easy Debian, via totem player and "some files" (can't recall what exactly, yet it's somewhere in Easy Debian thread) replaced with Maemo counterparts.

Using chroot environment (like Easy Debian) still isn't 100% optimal solution, yet achieving it would be also great thing, usable for day-to-day basics.

/Estel
__________________
N900's aluminum backcover / body replacement
-
N900's HDMI-Out
-
Camera cover MOD
-
Measure battery's real capacity on-device
-
TrueCrypt 7.1 | ereswap | bnf
-
Hardware's mods research is costly. To support my work, please consider donating. Thank You!
 

The Following 4 Users Say Thank You to Estel For This Useful Post:
Posts: 538 | Thanked: 1,303 times | Joined on Jan 2011 @ Germany
#8
Originally Posted by fpp View Post
either solve the PulseAudio mystery to have a choice of software,
The output device of Alsa can be changed vias /etc/asound.conf. I don't know the pulseaudio equivalent but I know there is one since I read everywhere that asound.conf is not needed for pulseaudio since it brings its own configuration method (unfortunately I don't know the details).

Originally Posted by fpp View Post
or invest in MOC customization and packaging
can MOC use the N900's rocker and camera keys ?
Some time I played a bit with MOC and afaik the shortcut keys can be assigned freely. I read somewhere that the N900's volume keys produce some Fx keycodes. If that's true binding them to MOC shouldn't be a problem.
I have no idea about the camera key, though.
 

The Following 6 Users Say Thank You to sulu For This Useful Post:
Estel's Avatar
Posts: 4,941 | Thanked: 8,234 times | Joined on Mar 2011
#9
Originally Posted by sulu View Post
The output device of Alsa can be changed vias /etc/asound.conf. I don't know the pulseaudio equivalent but I know there is one since I read everywhere that asound.conf is not needed for pulseaudio since it brings its own configuration method (unfortunately I don't know the details).
The problem is, that while using proper pusleaudio method of redirecting whole sound to USB soundcard, device reboots instantly. I hope that more knowledgeable one can filter it, if it's:
a) wrong way of trying to achieve that with pulseaudio, and everything it's working, yet it's user error
b) kernel related issue (userland things shouldn't be able to crash device like that, right?)
c) something broken in Maemo's pulseaudio, that can be fixed.

That's why I suggested trying with Easy Debian's pulseaudio. Would do it myself, yet, unfortunately, I don't have USB DAC (I suppose that Creative Audigy 2ZS Video Editor = external USB 24 bit sound card/TV card combo with plentora of inputs and outputs doesn't count, as it, supposedly, lacks proper linux kernel modules...).

/Estel
__________________
N900's aluminum backcover / body replacement
-
N900's HDMI-Out
-
Camera cover MOD
-
Measure battery's real capacity on-device
-
TrueCrypt 7.1 | ereswap | bnf
-
Hardware's mods research is costly. To support my work, please consider donating. Thank You!

Last edited by Estel; 2012-03-26 at 23:13.
 

The Following User Says Thank You to Estel For This Useful Post:
joerg_rw's Avatar
Posts: 1,879 | Thanked: 10,019 times | Joined on Mar 2010 @ SOL 3
#10
some details you might find useful:
about powersaving of hw-accel: http://tuomas.kulve.fi/blog/2009/11/...on-ogg-vs-mp3/

factoid: all stock media apps use MAFW http://wiki.maemo.org/Documentation/...amework_(MAFW). MAFW has several drawbacks, e.g. no easy way to implement equalizer incl volume control (esp for external audiocard), no gapless playback.

PA and ALSA have a quite strange relationship, when you playback audio to normal PA, data flow is like this:
app -> (PA -- weird plugins - xprot-limiter) -> ALSA card driver
when using 'normal ALSA' (aka "default"):
ALSA -> PA-ALSA-compatibility-plugin -> (PA -- weird plugins - xprot-limiter) -> ALSA card driver HW:0,0

It should be simple to make PA use sth different than hw:0,0 for audio card playback, however that's possibly not what you actually want. It would redirect *everything* to the new audiocard

For automating H-E-N refer to blue_led's scripts in http://talk.maemo.org/showthread.php...60#post1133260 ff. please

just backround: gstreamer: http://tomch.com/wp/?p=116

cheers
jOERG
__________________
Maemo Community Council member [2012-10, 2013-05, 2013-11, 2014-06 terms]
Hildon Foundation Council inaugural member.
MCe.V. foundation member

EX Hildon Foundation approved
Maemo Administration Coordinator (stepped down due to bullying 2014-04-05)
aka "techstaff" - the guys who keep your infra running - Devotion to Duty http://xkcd.com/705/

IRC(freenode): DocScrutinizer*
First USB hostmode fanatic, father of H-E-N

Last edited by joerg_rw; 2012-03-28 at 06:34. Reason: added MAFW notes, fixed link
 

The Following 5 Users Say Thank You to joerg_rw For This Useful Post:
Reply

Thread Tools

 
Forum Jump


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