Introducing aloopd - the ALSA Loop Sound Server

Aka, who needs the stinking pulseaudio?




Motivation

All over many years, I only had one soundcard in my machines. I configured it once, and there it went. No further tweaking was ever needed. If I needed alternate sound output - just plug in a headphone to the headphone jack. Nothing else was needed, ALSA takes care of everything.

When laptops started to support HDMI output, a problem arose. The HDMI output in effect was a second soundcard; so all these new-fangled laptops now had two soundcards. It was not a problem in itself, except that the kernel had no idea which was was to be the "default". Often times, the HDMI output was chosen as the default soundcard (over the "more correct" analog output jack), and since the laptop HDMI's port was not connected to anything, the result is an absolute silence when the user tried to play some audio apps.

To address this problem, Kirk invented Multiple-Sound-Card-Wizard (MSWC) to allow the user to choose which soundcard he/she wanted to use as the default. This settings was persisted over reboots, so the user only had to configure it once. MSCW was quickly adopted by Puppy Linux world, and its derivatives still lives on until today.

In Fatdog, MSCW was replaced with "fatdog-default-soundcard.sh" (FDS) - which worked exactly like the original MSCW except that it had more options and more features (e.g. equaliser, pre-amp, stereoswap, etc).

And then came bluetooth speakers. The FDS was updated to support these as well, so audio apps could route the audio to these speakers too. Now, unlike the analog out/HDMI selection, which was usually set only once and then never touched again, with bluetooth speakers one might want to connect to it one day, and disconnect and use the internal speaker the other day.

FDS supported this - but, after each changes, the audio app had to be restarted. If you're watching a video you had to quit the video player, make the change using FDS, and re-started. A bit annoying, but not too bad you only had to do it once a day.

And then came USB soundcards. That's okay, we could still ignore that. And then come USB headphones. These are headphones whose cables are permanently soldered to USB soundcards, the only way to make them make sound, is to connect their USB connections to USB ports and then run FDS to set the configuration.

This now means that over the course of the day, one might want/need to change the "default" soundcard many times - perhaps to route over the internal soundcard, then to bluetooth speakers/headset, then to USB headphones, etc ... FDS still works, but if one has to restart the audio app everything this happens, it starts to get more and more annoying.

The solution to avoid re-starting the audio apps is to use a "audio router", a middleman that takes the output from an audio app, and then send it to the correct destination (internal soundcard, bluetooth speakers, USB devices, etc). These "audio routing" function is done by a "sound server", of which pulseaudio is the most well know notorious example, but there are others too (JACK for real-time audio, older/defunct ones like EsoundD/ESD, aRts, etc).

All these sound servers suffer from the same problem: the applications must be explicitly programmed to use them. Apps that uses PulseAudio have to use PulseAudio API and link with PulseAudio libraries, same for JACK, and all the others too. And therein lies the problem.
1) If you don't have these libraries at run-time, the app goes kaput.
2) Even if you do, in case the "sound server" cannot run properly at run-time, you won't hear any sound.

And PulseAudio, while being the most popular soundserver in this decade (due to it being pushed down the throat on many distributions, just like systemd is), isn't exactly the most stable or the easiest one to configure. If you need proof, just use your favourite search engine and see how many questions there are about "PulseAudio not working" ...

Anyway, as I said, in days past, I only had one soundcard, so the need to do all these was non-existent - if one only has one soundcard, what's really the need of having a middleman? So, I was never bothered about this for long while ...

Until now. Recently got a USB headphone. With a regular headphone, you plug in the jack to the hole, and it all works (the sound on the laptop was turned off and redirected to the headphone). This was by the way done by the __hardware__ (the audio codec chip), there is no "sound server" in the kernel that does this.

However, things aren't the same with USB audio. As I said above, it is effectively a different soundcard, so FDS needs to be called to configure the app to use it, and then the audio app has to be restarted ...

And thus is born the ALSA Loop Sound Server.




The ALSA Loop Sound Server

As it turns out, ALSA has already come with a sound server of sorts.
It's primitive compared to others, but for me, it does the job fine enough.

My objective is only one: I want to be able to switch sound output without having to shutdown and restart the audio apps. I can live with the interruption during the switching, I can live with the fact that different soundcards have different mixer (volume) control etc (although this apparently can be automated as well - I haven't tried it).

The ALSA Sound Server consist of two components: the kernel module component called snd-aloop (ALSA Loopback module), and the user-space program called "alsaloop". ALSA Loopback module basically acts are virtual soundcard and acts are a "pipe" - audio data goes from one part, and out into another. "alsaloop" acts like a pump - it read data from one card, and output it to another.

The entire setup is conceptually simple:
- use snd-aloop to create a virtual soundcard and make it as the default output.
- run alsaloop, which reads audio from this virtual soundcard, and push it out the actual soundcard.

So the audio routing becomes like this:
app --> loopback virtual soundcard --> alsaloop --> actual soundcard.

But what have we achieve with this middle-man setup? Well, the magic of this setup is that even if "alsaloop" is not running, the audio app will continue to blissfully send its output - except that of course you hear no sound.

To hear any sound, run the "alsaloop" pump, and if you want to switch output, just kill alsaloop and re-start it with different output. Presto!

This implementation is available on Fatdog64 812.

It is capable of switching audio seamlessly between internal soundcards and bluetooth speakers, without restarting the sound apps.




Beyond Fatdog64 812

After the release of Fatdog64 812, I worked a little bit more on the ALSA Sound Server and it is now capable of delivering __network__ audio, using a neat package called "trx" (available in the Fatdog repository).

It is now possible to send audio over the network, and receive audio from the network. Using multicast, it possible to send a single stream to multiple listeners at once.

All using only ALSA (and trx).

This implementation will be available on next release of Fatdog, whenever that will be. If you are keen to test, you can always get the "tip" version of Fatdog, which gets updated whenever there is an interesting feature (or update).



Posted on 9 Dec 2021, 16:15 - Categories: Fatdog64 Linux
No comments - Edit - Delete


Cowboy Bebop Netflix Live Action 2021

"The Abolition of Man" was a heavy read, and its consequences weighed even heavier on my mind, so I thought I'd take a break and do something fun, like watching something light and entertaining.

Netflix launched the live-action adaptation Cowboy Bebop series on November 19. That should be good, right? (despite many previous dire warnings ...)

If you don't know what Cowboy Bebop is, you probably don't want to read the rest of this long post anyway. But if you still want to know, it is an iconic anime from the turn of the previous millenium.

If you don't even know what anime is ... well, I think you should really leave now, unless you really want to go down the rabbit hole. But again, if you really want to know, "anime" is the Japanese word for "animation", that is, what we in the western worlds call as "animated movie", or "cartoon movies".

For the benefit of those who really don't know (who I am kidding ... if you get this far, you must be familiar with it, otherwise, why keep reading a very long post containing my silly opinion on a silly cartoon show. There are more important things to take care in the world ...), "Cowboy Bebop" is the story of a group of futuristic bounty hunters, living in the space ship called the "Bebop". ("cowboy" being the in-universe derogatory term for "bounty hunters", so the title could roughly be translated as "Bounty hunters who lived in a space-ship named the "Bebop"). There are five major characters - Spike Spiegel, Jet Black, Faye Valentine (the three are the "cowboys"), Ed (which is a girl), and Ein (which is a dog).

What's so interesting about bounty hunters anyway? Well, there is a reason why this show is iconic. You really have to watch and decide it for yourself. People have different tastes and preferences. Some people say it's iconic because it is the first anime that uses jazz music (but that's not true). Some people says because it's the animation quality (which isn't bad, but there are other anime that have good animation quality either), etc. I was skeptical before I watched myself more than a decade ago, but after I did, I agreed that this was overall a good show. (If you have Netflix, the anime version of the Cowboy Bebop is there too, all the 26 episodes of it. There is also a movie which isn't on Netflix, but you don't miss much if you don't watch it, although I think the opening song of the movie is cool.)

OVERVIEW
--------

Now, I'm here to talk about the live-action adaptation. Many youtubers and podcasters have commented on this, and usually I don't bother to comment on things that people have already commented - but I will make an exception here. I will have to emphasise that my opinion is my own; if they sound similar to what others have said, it's probably because we all share similar sentiment.

There is a meme that any Netflix adaptation ends up turning into trash. I don't know how true is that, I don't watch Netflix that much (there are more important things to do in life other than spending all of your free time watching other people's imagination), but I will say that in the case of Cowboy Bebop, they do a very bad job on it.

Season 1 was released with 10 episodes in it. I watched the first episode and my stomach churned. But I might be biased, so I gave it another chance and watched the second episode. It made me want to throw up, but, hey, third time's lucky right? After watching the third episode I think I have torturned myself enough. To top it off, I happened to watch a video clip of the last few minutes of the episode 10. When I watched it, I thought it was a joke made by someone who hated Netflix (or the show, or both). I went back to Netflix to check it ... lo and behold, that extremely tasteless cliffhanger __was__ there. It's so bad, even if you don't know anything the show, I __guarantee__ you that you will be turned off too).

A lot of the opinions so far have talked about the actors who played the adaptation, about the various race-swap and gender-swap (seems to be a feature of any movie in the last few years or sos). I don't want to talk about these, I think those points have been well rehearsed everywhere else. I don't necessarily agree or disgree with these opinions; but today that's not what I want to talk about.

I'm a writer, so my point is focused more on the story, the plot, and the characters.

To start off, this thing is supposedly a "live-action adaptation". It's not a reboot. It's not a remake. It's not re-imagination. It is an "adaptation". And yes, sure, adaptation means you have the freedom to change some of the details, insert new stories or previously unexplained back stories, etc. But it has to be consistent; at least, it has to be consistent with what have been established before (otherwise, it's really different show, isn't it?)

And lack of this consistency is why it sucks and sucks so badly.

THE CHARACTER
-------------

I will start with the bold conclusion that just by looking at the characters only, the live-adaptation of Cowboy Bebop is __not__ Cowboy Bebop. Or, equivalently, it is Cowboy Bebop in name-only. Yes, they have characters with the same name, these characters live in the same ship, the same universe, supposedly - but __everything else__ is different.

Let's start with Spike.

The anime Spike isn't the same as the live-action Spike. They don't share the same principles, they don't behave in the same way, they don't interact with others in the same way. They have different values, they care about different things.

There so many differences, but I will mention only one thing which is enough to spoil everything.
* The anime Spike is a man who doesn't care whether he lives for the next day or not.

* The live-action Spike pretends to not care whether he lives or not, but in reality, he really does __not__ want to die.

The difference seems subtle, it's not. The anime Spike is a man who has nothing else to lose. A lot of the (careless) actions in anime Spike can be attributed to his attitude to life; which couldn't be explained otherwise.

The live action Spike, however, is the opposite. He really cares about living and continue living. So why does he behaves so carelessly either? Because he's a hero? Because he's kind-hearted? Because he's arrogant? Because he's a jerk? Because he's just careless? Pick any reason you want - you will still find that this is not the anime Spike in the end.

How about Jet?

In the anime, Jet was like a big brother to Spike. He has his own share of bitter past, and like Spike, he had resigned to it and just live day by day. Being older, he is a tad wiser, and knowing Spike's past, he acted more than just a friend and a parter, he acted as a sort of surrogate big brother to Spike. Of course, he gets annoyed from time to time - but he didn't pick up fights or whiny for the sake of being whiny. He was trying to turn Spike into a better man.

The live-action Jet, however, was just a whiny partner. He was whiny, and complained too much, just for the sake of being whiny and irritating. I understand the writers' intention to intensify the "sarcastic banter" between the two, but I think they dialled it way way too much, to the point that Jet had become an annoying character. Really with the amount of animosity that Jet showed towards live-action Spike, I wonder why he didn't bother to kick him out altogether already (the "Bebop" ships belonged to him anyway).

I mean, I wonder why the live-action Jet took the live-action Spike as a partner to begin with. He didn't know Spike's past (Spike's lying to him, basically, that's just another one trait that differentiates anime Spike and live-action Spike), but still, if you're an ex-policement turned bounty hunter (with potentially lots of enemies), you __really__ want to check that your future live-in partner wouldn't want to slice your throat when you are sleeping, don't you? Sheesh.

As for Faye - I can't say much about Faye. I only saw her in the first episode, and she didn't get much airtime there. Not saying I like it, or agree with her acting or writing; but I've just not seen enough to make a decision.

But surprisingly, I have seen Vicious in the live-action, and too much of that, for that matter, in just 3 episodes.

In the anime, Vicious was not introduced until a bit later, and even then, when introducted, he was not introduced as anything special, other than being a person from Spike's murky past. Only much later it was revealed that in addition to being a highly skilled fighter, he is also a masterful strategist; ambitious and cold as a block of ice. It is easy to imagine that a person of this quality can rise through the rank to become a high ranking official of the mob. He was Spike's equal (or copy) in almost everything, except that Spike had left the dark side and he chose not to. That's why he was such a threatening archenemy: because they were equals.

The live-action Vicious is really a parody of the anime Vicious, really. Firstly, for a supposedly important archenemy, you reveal him in the first episode, with his names, his face and whatnot. That's a real grand entrance, boys and girls. First episode! Secondly, and most importantly, you will quickly learn that the most prized trait of this "grand enemy" is his nastiness. Other than that, he's somebody an easy-to-anger, greedy, careless, incompetent petty thug who likes to claim how "good" he is. He's so weak that Spike could easily kill him anytime he wanted. And then you make the entire season's plot to be the conflict between these two guys? Come on. I can't even reasonably think how the live-action Vicious earns his position in the mob.


THE PLOT
--------

And then we have the plot. The anime was a series, not a serial. You can watch any episodes in any order, apart from two parters and "deciding episodes" (where a member joined or left the Bebop), and not missing anything.

The live-action, however, made it obvious that it was a serial. You have to watch all of them, and __in order__, or you'll miss the plot, literally.

But that's not the point of contention. It's okay to "adapt" a series into a serial, provided that you do it right. Provided you can capture the spirit of the show. As I said above, you don't have to keep all of the original materials. You can keep some, and insert other new materials - as long as you remain consistent to what show is all about.

The main plot of the anime is how three broken people, people who have no hope for the future because of broken their past, continue to stay alive as they slowly learn to overcome their brokenness and learn to look forward to the future, because of the odd kind of friendship that formed in the shared events that they experience together.

The main plot of season 1 (based on what I've seen on the 3 episodes, and based on the one-sentence plot summary provided by Netflix itself), seems to be the on-going conflict between Spike and Vicious.

Of so many plots they could use, this one - for me at least - is the least interesting plot there is. The live-action shows Vicious as early as the first episodes, and it tracks what he does on almost every episode (at least on the episodes that I watched). At 3 episodes, I still haven't formed any bonding with the characters (Spike or Jet), and I couldn't care less about their supposedly "archenemy". Archenemies are only important once I've emotionally invested enough with the characters; but this certainly don't happen in episode 1, 2 or 3.

Okay, there is conflict between Spike and Vicious in the anime too, but it __isn't__ part of the main plot. The open conflict is only shown in two episodes - the episode which introduced Vicious, and an episode where the two have the final showdown. For the most part, they didn't care of each other, unless there was some shared interest (or accidentally crossed paths). Otherwise, Spike couldn't care less about Vicious, and Vicious wasn't obsessed about murdering Spike either. So why elevate this highly unimportant sub-plot to be the __highlight__ of the show?

I have enough of watching shows about two guys with personal conflict having a go with each other. It simply doesn't click for me; it's __not__ entertaining. Firstly, as I said, I don't care about the conflict if I don't care about the characters. Secondly, I don't have to watch movies for that; the newspaper writes about this kind of stuff everyday.


THE SHOW
--------

Then the show itself. Being a show about bounty hunting, there are bound to be fights, shootings, explosions, etc. But the anime make it clear that it was not an __action__ show. Every scene was there for a reason. Fightings, for example, is not there for the sake of showing the figthing, but also to show the (sometimes hard) choices that the character have to take during he fights (or not fight).

In the live-action, the fighting is there just for the sake of the fighting. Not saying the fighting scene is bad in itself, but it really felt like a generic fight scene without any emotion in it, no connection to the story (other than the sarcastic remarks - something which was used aesthetically in the anime, but way too much in the live-action it became so farcical and predictably boring). If I want to watch an action movie with a lot of fights, there are much better shows.

In the anime, the fighting is there to advance the plot. In the live-action, the fighting is there for the sake of showing off the fights.

And then the constant bickering between Spike and Jet. In the anime, they don't bicker. They argue, but not all the time. Most of the time they are in (silent) agreement. When there are serious problems, they don't just bicker. Things happen. Spike left Bebop temporarily because of a big argument with Jet. That's how adults behave.

In the live-action, they constantly bicker with each other. It's really unbearable listening to two grown-up men who are supposed to be friend and partners constantly being sarcastic to each other. As I said earlier, I find it extremely odd why Jet doesn't kick Spike out of his ship already; and how Spike could keep up with Jet's whining.

It feels funny on how they try to bring more "realism" into the live-action adaption, and tries to "explore" the "depth of the emotion" encountered by the characters by amplifying their edgy traits, but only succeeding to make the live-action character as a parody of the anime's version of them.

Oh, and one last thing (ending of Episode 1 - you can compare the live-action and anime version): In space, nobody can hear you when you scream. Or plead. Don't forget that.


CONCLUSION
----------

I am not the only one who complain about it. I watched the original Cowboy Bebop anime back in 2003 or 2004, and I have re-watched the series twice in the intervening years. On the last re-watch, my son watched with me as well.

We both watched the live-action; and we more or less came to the same conclusion. In fact, he told me that he specifically doesn't want to watch any further, as the live-action __ruins__ his experience. And my son is in the millenial generation, supposedly the target audience for this kind of show.

This show is Cowboy Bebop in name only; but otherwise it's not even close to the anime.

Enjoy the show if you like it, but for me, the show ends at episode 3. The whole thing just looks like and feels like a cheap comedy about bickering partners and a soul-less generic fighting action show. The spirit that makes "Cowboy Bebop" iconic is simply missing in the live-action adaptation. I would rather use my free time to do other things (or watch better shows, perhaps, a repeat of the Cowboy Bebop anime).

Posted on 23 Nov 2021, 11:51 - Categories: General
No comments - Edit - Delete


The Abolition of Man

I've just finished reading it, "The Abolition of Man", by C.S. Lewis. At about 81 pages (excluding the generous appendix and notes), it is a very worthwhile investment of your time.

If you think that "1984" is prophetic, wait until you read this book.

If you espouse the idea of The Great Filter - you might finally have a glimpse of what it could be.

Posted on 12 Nov 2021, 12:12 - Categories: General
No comments - Edit - Delete


Fatdog64 812 Final is released

The release candidate was released a little over 3 weeks ago. As the reports have dried up and and we have fixed all reported bugs, it's time to release Fatdog 812 Final.

There are two features in Final which wasn't there in RC (and thus, is considered experimental because it only received short testing time): Simple Bluetooth Manager, and ALSA Loop sound server.

There is nothing special about the overdue Bluetooth Manager, but I may write a little about the ALSA Loop sound server (aloopd) later.

Release notes here, announcement (and discussions) here.

Get it from the usual mirrors: ibiblio.org, uoc.gr, or nluug.nl.



Posted on 9 Nov 2021, 22:18 - Categories: Fatdog64 Linux
2 Comments - Edit - Delete


More apologies ...

If you apologise without admitting you're wrong, does it still count as apology?

If you apologise without promising you won't do it again, does it still count as apology?

If you apologise without reparations, does it still count as apology?

If you apologise on behalf of someone else, while that someone else clearly is neither sorry nor repentant, does your apology even have meaning?


Posted on 5 Nov 2021, 13:28 - Categories: General
No comments - Edit - Delete


Apologies, and donations

If you are forced to apologise, does it still count as an apology?

If you are forced to make a donation, does it still count as a donation?

If you are forced to be kind, does it mean that you are a kind person?

Is the action more important than the motive? Or is the motive more important than the action?


Posted on 5 Nov 2021, 13:23 - Categories: General
No comments - Edit - Delete


Fatdog64 812 RC is released

Yeap, still here. Still alive and kickin'.

Just dropping by to let you know something that you've probably already known: that is Fatdog64 812 RC has been released.

Release notes here, announcement (and discussions) here.

Get it from the usual mirrors: ibiblio.org, uoc.gr, or nluug.nl.

Unfortunately we lost AARNET for the Australian folks.

Posted on 17 Oct 2021, 00:58 - Categories: Fatdog64 Linux
No comments - Edit - Delete


Empty shells

I have been playing video games recently and are struck on how good games has progressed since the days I played Lemmings and Doom.

What struck me was mainly how good the graphics look like, how life-like it has become; especially when the game protagonists are humans. Their faces are pretty and handsome, their bodies are perfectly proportional and toned, their movements are graceful.

No doubt, this is due to the talented artists that created meticulously them, from draft drawings, 3D modelling, skinning and texturing, and motion capture; it is also the attestation of the immense computing power of modern GPUs. When combined with talented voice actors, the imagery is complete - we are, definitely, in the uncanny valley.

However, no matter how real these characters look like, I cannot drown a tiny voice in my head that keeps saying that what I see is all there is. There is no depth. There is no substance. All I see is literally skin-deep. Underneath the skin of that pretty girl or handsome man, there is nothing. They are hollow. Literally. They are just million of triangles covered by textures; voiced by someone else with stories which aren't their own. They are just empty shells.

But sadly, there are people - real-life people - who are real-life versions of these empty shells. They do have flesh and bone, and will bleed if hurt; but otherwise, what you see of them, is all there is. There is no depth. There is no soul. They speak with with other people's voices and their life are other people's stories. There is nothing else beyond what the eyes can see or the ears can hear or the hands can touch.

Beware that you don't fall for these empty shells. For beneath their skin, there is only nothingness that awaits you.

Even more important, is to beware that you don't become empty shells yourself. Focusing on the outside, but forgetting the most important part of yourself - what's inside.

For when that happens, you become nothing.

Posted on 9 Mar 2021, 23:55 - Categories: General
No comments - Edit - Delete


Ants in a terrarium

Imagine ants in a terrarium.

They are born there, they grow up there, they go about their daily life, and they die there too.

Lets say that there are multiple queens, each commanding multiple her own colonies of ants. Every ant will scavenge for food for its colonies, but they also fight for territories, and sometimes attempt dominion over other colonies. Generations of ants are born, alive, and die over time.

The ants think their problems are important, their possessions are important. Their territories are important, their dominion of other colonies are important. They think that they are important.

But they are just ants living in a terrarium.

---

(Originally contemplated on Feb 2006)

Posted on 10 Jan 2021, 01:58 - Categories: General
No comments - Edit - Delete


Christmas wishes 2020

Any bad things I did, I did it because of my own failings, so please forgive me.
Any good things I did, I could only do it because God has helped me, so to God all the glory.

Merry Christmas everyone.

Posted on 26 Dec 2020, 00:31 - Categories: General
No comments - Edit - Delete


Pages: [1] [2] [3] [4] [5] [6] ...