搜索
Table_bottom

标签云
Table_bottom

分类
Table_bottom

声明
文章若未特別註明,皆採用 知识共享许可协议 請自覺遵守
Table_bottom

鏈。。。
Table_bottom

存档
Table_bottom

匆匆过客
83618
Table_bottom

功能
Table_bottom

不知疾與無疾

我們先來說說這麼兩種人:第一種人,他們不願意去醫院看病,因爲他們可能本來覺得自己身體還不錯,如果去醫院檢查出來有病會讓他們很不舒服;第二種人,他們感到不舒服時對去醫院檢查並不排斥,並且遵守醫囑,更是還有一部分會定期去醫院做體檢。

第一種人,他們在去醫院檢查之後如果發現沒有病,就會反過來埋怨叫他檢查的人,因爲他覺得耽誤自己時間和浪費錢了;如果檢查出來有病(但並非不可醫治),同樣會去怪罪叫他去檢查的人,因爲他覺得自己本來好好的,如果不去檢查就不會發現有問題;如果檢查出來的病不可醫治,那麼他一般會一蹶不振,並且(雖然不說)在內心中怪罪叫他檢查的人,因爲他覺得自己現在要注意這個注意那個的很討厭。

第二種人,他們在去醫院檢查之後如果發現沒有病,則會感覺更加舒適,且並不會對叫他檢查的人有什麼怨言;如果檢查出來有病(但並非不可醫治),那麼會感謝叫他檢查的人,因爲他知道雖然現在需要有一些限制,但這樣自己可以好得更快,最終是對自己有益的;如果檢查出來的病不可醫治,那麼他依然會積極面對,因爲儘早發現纔能更好地對待自己的身體,遵循建議的話或許可以獲得更長的生命以及平均來講更高的生命質量。

 

這麼兩種人,在生活中應該能找到相應例子,想來諸位應該感觸頗深。一般而言,如果一個人有正常的取向,那麼他會努力去當第二種人而不是第一種人。

然而在計算機領域,這種認知似乎是顛倒的:人們普遍認爲,閉源軟件更“安全”——只因爲它的漏洞相對而言更難以發現。

 

好了我們來看看這些事情:

1. “閉源軟件的漏洞相對而言更難以發現”這句話是正確且毫無疑問的。但“更難”究竟是難多少,卻是一個難以考量的問題。至少我們可以確認一點:閉源並不是不可能被發現漏洞,否則Windows、IE等的漏洞不會被發現那麼多。

2. 人們對軟件的認知不同,於是決定了當發現某軟件的一個漏洞以後不同人會有不同的反應。一部分人認爲,軟件和硬件類似,只要獲得(安裝)了就不再變了,於是在他們的概念中,軟件的漏洞被發現得越少越好,軟件升級也只是讓他們厭煩的事情;另一部分人認爲,軟件和知識類似,擁有(安裝)了以後如果發現有問題是可以改進(升級)的,於是在他們的觀念中,軟件的漏洞發現與否並不是特別重要(或者說他們知道軟件漏洞的發現是必然的),而發現了一個漏洞以後自己的是否能及時得到升級(修復漏洞)纔是最重要的。

3. 發現軟件漏洞的人/團體在發現漏洞之後的做法也不盡相同,大致也可分爲兩類。第一類發現之後會去報告,然後軟件的“生產”方“可能”會花一些時間去修正這個問題,再花一些時候之後將問題的補丁放出;第二類發現之後自己利用漏洞而不去報告,於是漏洞直到有第一類人報告纔有可能會得到修復。

 

由如上諸點,加上開源閉源本身的特性,我們可以得到下面的推論:

1. 一般而言閉源軟件比開源軟件的漏洞更難被發現。

2. 被發現漏洞後,開源軟件有更大的可能性會更快得到修復。原因有三:

1. 會爲閉源軟件找漏洞的一般有兩類人,分別是開發者僱用的人和想找漏洞的人——其中第一種會上報且有希望修復最終(希望)不會造成危害,第二種有一部分不會上報從而可能造成危害;而開源軟件也會有這兩種人——只不過一般而言第一種會少一些,而第二種好人會更多一些,其原因一是開源軟件可以享有下面一條的好處,二是開源軟件“製造”者大多不是公司(公司的本質是追逐利益)。

2. 有一點是開源軟件所有而閉源軟件沒有的:充沛的同儕審查。同儕這裏指任何有興趣的開發者——由於我們可以相信世界上好人多,開發者也是好人多,所以這一部分人會有較高機率會去上報。而且由於源代碼公開,他們很有希望可以直接提出解決方案,而不用等待原始開發者自己再去還原產生環境、查找、修復。在這種睽睽衆目之下,軟件漏洞難以遁形,於是我們可以假設有1個惡意的想找漏洞的人,而有9個善意的想找漏洞的人,有極大的概率使得9個人中有人找到漏洞且修復,而那1個還沒有找到。

3. 開源軟件開發一般都是逐步增長的,即所謂“集市”模式(顯然閉源軟件無法採取這種模式)。這樣,在一個軟件還沒有特別多用戶羣的時候,它的許多基礎問題已經被解決。而且在用戶羣逐步增長的過程中,其新版本加入的內容也在不斷地被驗證確認,本身引入問題的可能性就低;而即使引入問題,由於有許多其他人可以檢查,遇到的問題也會較快地被解決,不用等到像閉源軟件普遍的已經產生大量用戶羣以後再發現、解決。

3. 閉源會給軟件編寫者一種虛假的支配安全感:軟件有錯誤也無所謂,反正除了我們沒人知道。於是在這種心理下,開發者更容易寫出質量較差的代碼,其中產生問題的可能性也更高。反觀開源這邊,因爲一切都是公開進行的,所以開發者一般都會對自己代碼質量有較高要求(不論是出於面子還是什麼),而且即使出現了質量不大高的代碼,其他有空的人也可以對它進行改進,避免小問題最終釀成大禍。

4. 除了被“入侵”這點以外,安全還有兩個層面:

1. 保證用戶的數據安全。閉源軟件由除了其開發者以外沒人能接觸到源代碼,所以如果其中有哪一部分可能會工作不正常而導致數據損壞,開發者只有兩個途徑知道:一是自我審查或者測試的時候發現;二是事情出現以後有用戶報告。如果等到用戶報告,那麼就太晚了。而開源軟件由於代碼公開,所以在審查代碼(無論是自己還是任一一個人)時被發現的可能性要高很多,而且更由於可以有大量的人參與討論,這類問題的修復速度也會比閉源軟件高。

2. 保證用戶本身的安全,尤其是保護用戶隱私。在這一點上,閉源軟件絲毫沒有可信度——看不到源代碼,你說你沒做手腳誰信啊;而開源軟件由於源代碼公開,所以用戶可以放心使用。(嚴格說來,如果一個公司想要在軟件上做些什麼不可告人的事,即使將源代碼公開也可以耍些手段,例如寫得極其晦澀難懂。然而即使真的晦澀難懂也不怕,開源保證了總有人可以依照其原理寫出清晰易懂的,而且用戶們可以不怎麼費勁地切換到新的上面。)

 

這裏還有一些人會有迷思,會認爲如果一個軟件本身就和安全相關,那麼就不應該開源。爲什麼呢?他們的理由是:不公開的東西看起來似乎更不容易被攻破。然而這實際上是對安全的誤解以及對權力的服從而產生的結論。

首先我們必須明確一件事:無論一個系統(加密方法)是否公開,它的安全性是固定的。公開與否改變的是它的問題/漏洞被發現的概率,而不是漏洞是否存在——就類似上面關於去醫院檢查的例子,去檢查能改變的只是你是否知道自己有病,而不能改變你是否病。

然後一種加密技術在被大規模使用以前,是需要有一個檢驗階段的。如果在檢驗階段發現較大漏洞,那麼該技術是顯然不可採用的。如果公開,則全世界有興趣的人都可以對它進行檢驗——甚至是原理上的檢驗——如果存在問題則很快會被發現,可以免造成更嚴重的影響。而如果不公開,則只有開發者(或許還有其委託的少量幾個人)知道其原理,而其他人無法知道,從而在檢驗階段少了很多被尋找到漏洞的可能性。我們知道所有加密方式都有破解方案的——不然怎麼解密——只是被發現的難度不同而已。於是當一個有漏洞的加密方案被大規模應用(例如軍事),而後有人發現其有漏洞於是自己使用,這時候造成的危害實在是不堪設想。

口說無憑,不過現代密碼學就是我的憑證。現代密碼學的基礎原理決定了:其上的加密算公開並不會導致加密效果減弱,反而因爲有大量的同儕評審,不好的算法可以儘早被發現被廢棄。例如多數人都見過卻不一定知道是什麼的AES、RSA算法等就都是現代密碼學產物,而它們(還有相關的其他東西)在計算機世界尤其是網絡世界幾乎是作爲基礎存在的。

 

所以最後一個迷思也被攻破了,那麼作爲正常人作爲用戶,我們是不是應該很明確答案了?

閉源不會爲自己帶來任何好處,而開源至少可以保證個人隱私。所以,爲什麼不從內心中選擇開源?

 

附:

從心中選擇開源不是說要立即把所有的東西都換成類似的開源軟件——當然這樣做很好,但總會遇到各種各樣問題——而是要有意識地去考慮:“某個軟件有沒有相同質量的開源代替物?某個軟件有沒有可能開源,至少讓它開放API以讓人們可以開發開源客戶端?某個開源軟件的設計爲什麼和我用的相同功能的另一個軟件差別那麼大,排除習慣因素,究竟哪個設計更好?”

Linux下的聲音質量

這主要是一篇翻譯,原帖在 https://www.linuxquestions.org/questions/linux-newbie-8/sound-quality-in-linux-610168/

該帖子比較老(2010年),其中所說的有些狀況現在已有了改變——當然是朝好的方面改變——但道理無誤。


發帖者說他對其朋友的一段話比較疑惑,所以發這麼一個帖子問問大家的意見。朋友的話是這麼回事:

he is not satisfied with the quality of sound in Linux(fedora7).

他對Linux (fedora 7)下的聲音質量不滿意。

All of u try this : play the same song simultaneously on a linux &
windows machine, u will notice difference in sound quality.

你們可以這樣試一下:同時在一臺Linux和一臺Windows機器上放同一首歌,(這樣)你們會注意到音質的不同。


While looking at the sound settings, he found that Fedora uses generic
ALSA sound drivers. He think that the quality is not good because the
drivers are generic, they are not specific.

當查看聲音設置時,他發現fedora使用通用的ALSA音頻驅動。他認爲這樣的質量不夠好,因爲這是通用驅動而非專用驅動。

下面數個樓層(1#到15#)主要話題是這麼幾個:“根據我的經驗來說並沒有什麼不同”;“在兩臺不一樣的機子上比較的結論並沒有什麼意義”;“認爲不同的請去做無偏見測試(blind test)然後再來說”;“‘聲音質量’是個很模糊的術語,請詳細描述”。

其中技術性較強的是:“ALSA上沒有什麼‘通用’(generic)驅動”;“有可能是設置的問題,你可以如何如何做一下試試”。

10-12#是兩個人在爭,其中10#的內容我沒看懂,期望哪位(如果有)幫忙解釋一下他在說什麼。

重頭戲在於14#及其在16#、18#回覆的內容:其中16#給出了這個問題最直白的答案,14#和18#也都很有意義。

16#是對15#的回覆;15#是對14#的回覆;18#是對17#的回覆。

這裏先翻譯一下16#以饗衆人,14#、15#、18#的翻譯隨後附上:

I totally agree with you on what you've said. There is no difference.

我完全同意你說的。它們之間沒有區別。

To make clear once and for all, people should keep in mind we're talking about **digital signals** here, processed in a lossless (PCM) manner. If there are no resamplings or any other effects applied to the PCM stream, any OS is pretty much the same!

爲了一勞永逸地說清楚這個問題,人們需要在腦中時刻牢記我們在討論數字信號——已處理成無損的(PCM)形式。如果沒有重採樣(resampling)或任何其他附加在PCM流中的特效的話,任何操作系統都是一樣好的!

It works just like this:

這個過程大概是這麼回事:

*You open the application that will play your songs.

你打開一個要播放你歌曲的程序。

*The application uses the appropriate demuxer (to deal with .mp3, .wma, .ogg, .m4a... extensions) to get the encoded stream (wma, mp3, aac, flac, ogg...).

這個程序使用合適的分離器(demuxer)(爲了處理.mp3、.wma、.ogg、.m4a等擴展)以得到編碼後的音頻流(wma、mp3、aac、flac、ogg等)。

*Then there is a decoder that will convert back the encoded stream into a PCM stream [the application could, then, make use of some DSPs to resample or up / downmix by itself].

然後這裏有個解碼器,它會將編碼好的流轉換回PCM流[應用程序可以——在此之後——使用一些數字信號處理技術(DSP)來自己進行重採樣或是up / downmix]。

*The PCM stream, most likely to be untouched by the application, is sent to your sound system.

該PCM流——一般情況下未被應用程序碰觸——被送到你的聲音系統。

Now, when it comes to the PCM stream and the sound system, things are just like this:

現在,輪到PCM流和聲音系統時,事情是這麼回事:

*If you have a sound server, like Pulse Audio, the PCM stream is sent to the Pulse server. Pulse up / downsamples the PCM stream if it is different of its own settings (you can change Pulse default sampling rate by editing the "/etc/pulse/daemon.conf" file, it also up / downmixes the PCM file if its told to,

如果你有一個音頻服務器(sound server)——如Pulse Audio——該PCM流會被送到Pulse服務器。Pulse會對該PCM流進行向上/向下採樣(up  /downsample)——如果它和Pulse自己的設置不同的話(你可以通過編輯/etc/pulse/daemon.conf文件來修改Pulse的默認採樣率,它也可以在被告知如此做時up / downmix該PCM文件)。

*and, at last, the processed (or maybe untouched) PCM stream is sent to ALSA system.

以及,最後一步,被處理過的(也可能是沒被碰觸的)PCM流被送到ALSA系統。

I'm not going to get into deeper details on how things work under Windows or OS X, for example, because things are almost the same with all of them. The point is: the **true** maximum audio quality is achieved but getting the PCM stream untouched to the sound card. That ANY operating system can do, including Linux.

我不打算深入如Windows或OS X中事情如何工作的細節,因爲事情在它們中幾乎是一樣的。重點在於:真正的最大聲音質量由(原文中是but,疑似by之訛誤)傳輸未碰觸的PCM流至聲卡中來達成。這是任何操作系統都可以做到的,包括Linux。

ALSA is able to do the resampling stuff on its own, but it's not as configurable as Pulse Audio. I myself like to set Pulse to 44,1 KHz sampling and S32_LE resolution all the time, except when I have to deal with 48 KHz audio samplings. I know for sure my sound card works only at 48, 96 or 192 KHz on Linux, but its audio processor (X-Fi) has an excellent resampler using advanced techniques. So, I prefer to always let the sound card to the processing.

ALSA可以自己進行重採樣工作,但沒有Pulse Audio那麼好的可配置性。我個人喜歡始終設置Pulse爲44.1KHz採樣率以及S32_LE分辨率(resolution)——除非當我需要處理48KHz音頻採樣時。我很確定我的聲卡在Linux下僅可以工作於48、96或192KHz,但它的音頻處理器(X-Fi)有極好的使用高級技術的重採樣器。所以,我傾向於始終讓聲卡自己來處理。

If you don't have such hardware capabilities, I guess you'd really want to consider taking a look at this website.

如果你沒有這樣的硬件條件,我猜你會想要看一下這個站點

Up and downmixing on Linux, anyway, is flat and 2 dimensional as I've said. I've already tried ALSA "vdownmix" plugin, it works but it's not yet as well implemented as Creative's own HRTF technology.

在Linux中,Up 及 downmixing始終是平(flat)的以及2維的——就像我說過的那樣{參見14#}。我已經試過ALSA “vdownmix”插件——它可以工作,但是尚未有創新自己的HRTF技術那樣實現完備。

Amarok has a built in equalizer that does its job, specially when set to "Rock" if I'm not wrong. aTunes also has its own equalizer but it sounds horrible and is not worth a try.

Amarok有它自己的均衡器來做這件事,尤其是當設置成“搖滾(Rock)”時——如果我沒記錯。aTunes也有它自己的均衡器,但聽起來極其可怕並且不值得一試。

So, quality is the same on every OS if you know how to set them up. Here I've left the tips of mine to help anyone who would occasionally be interested.

所以,在任何操作系統中,只要你知道如何設置,聲音質量都是一樣的。這裏我留下一些我自己的建議,以幫助任何可能有興趣的人。

> Preferably, don't do any resamplings.

> 最好不要做任何重採樣。
> Tell Pulse and / or ALSA to always use the highest definition for your sound card (mine is 24 bit, so I use the S32_LE instruction both under Pulse and ALSA).

> 告訴Pulse和/或ALSA總是使用你聲卡的最高精確度(我的是24位,所以我在Pulse和ALSA下均使用S32_LE指令)。
> Avoid multichannel if all you have is a pair of speakers or headphones, or try the not so well implemented "vdownmix" plugin for ALSA.

> 如果你僅有一對揚聲器(speaker)或者耳機(headphone),避免多聲道,或者使用ALSA中尚未完善的vdownmix插件。
> Try Amarok equalizer (probabily set to "Rock") to help improve a bit the perceived sound quality.

> 嘗試Amarok均衡器(很可能是設置爲“搖滾(Rock)”)以幫助增強一點感知到的聲音質量。

Best wishes to everyone here and to Linux in the hope that it continues to improve and to be a more and more appealing alternative to MS Windows or Apple OS X.

致祝願於這裏所有人,以及給Linux——期望它可以繼續改進並且成爲一個愈來愈吸引人的MS Windows或Apple OS X替代選擇。

14#:

I don't know precisely what problem you guys are talking about, anyway, I want to leave here the comment of mine on this subject.

我並不確切你們在討論什麼問題,不過不管怎麼說,我想在這留下我對這個主題的看法。

I own a Creative SoundBlaster X-Fi XtremeMusic. On Windows, Creative's drivers offer you technologies fully implemented in hardware like Crystalizer and CMSS-3D.

我有一個創新的聲霸卡X-Fi XtremeMusic。在Windows上,創新的驅動提供了全部由硬件完成的技術,如Crystalizer和CMSS-3D。


Crystalizer stands for a really dynamic equalizer which adjusts itself according to the quality of the sound the card is fed with. For example: if I'm playing a 96kbps MP3 file, with considerable loss of high frequencies, the card is able to play with its own equalizer, the one specifically called Crystalizer, so you can kind of restore the lost frequencies (that's the illusion you have).

Crystalizer代表一個真正動態的均衡器的,它可以根據卡片收到的音頻的質量進行自我調整。舉例子:如果我在播放一個96kbps的MP3文件——其中顯然會有高頻中的大量丟失——這個卡片可以用它自己的均衡器——那個叫Crystalizer的東西——來播放,所以可以在某種程度上恢復那些丟失的頻率(這是你會感受到的幻覺)。

CMSS-3D stands for a multi purpose surround sound mixer. For example: if you have a 5.1 home theater speakers setup and want to play a stereo sound, the CMSS-3D technology is able to identify instruments on the sound the card is fed with and dynamically distribute it through all the available speakers. It's a totally active design, that's why I say "dynamically". If on the other hand, all you have is a pair of speakers or headphones, the card is able to mix into stereo channels up to 8 surround sound channels with Creative's proprietary HRTF technology. It immerses you into your DVD / BD movies or 3D games.

CMSS-3D代表一個多用途的環繞聲混音器。舉個例子:如果你有一個5.1聲道的家庭劇場設備,並且你想放一個立體聲音頻,CMSS-3D技術可以分辨出卡片收到的音頻中的樂器並且(然後)由所有可用的音箱中動態地分發它。這是一個完全主動的設計——這就是我爲什麼說”動態“。如果說是另一種情況——你只有一對音箱或者耳機(headphone)——該卡可以利用創新的專有HRTF技術在立體聲的聲道中插入最多8個環繞聲聲道。它可以讓你沉浸入你的DVD/BD影片或者3D遊戲中。

That could all be implemented on Linux for sure IF there was any sort of interest from Creative's Linux driver people. Anyone knows for sure it'll never happen anymore, thus, we're left with a complete 2D and raw sound experience with Linux or any other OS except Windows with Creative's sound cards.

這些當然可以在Linux上實現——只要創新那寫Linux驅動的人有那麼幾分興趣。(然而)任何人都很確定這並不會發生,因此我們在Linux或任何其他非Windows的系統上使用創新的聲卡時,均被離棄在一個純2D和裸的聲音體驗中。

I often test new Linux distributions but can never stay with anyone of them because of the lack of such important technologies. I have 3 headsets, high fidelity ones (12 to 28 KHz frequency range and near 20 bit sound quality), and I very frequently watch 5.1 CH videos and play 5.1 CH games. I just couldn't live without CMSS-3D. Besides that, X-Fi Crystalizer is just so amazing I have no pleasure on listening to anything without it.

我經常測試新的Linux發行版,然而無法在其中任一上停留——因爲缺乏如此重要的技術。我有3個耳機(headset)——高保真的(12到28KHz的頻域以及接近20位的聲音質量)——並且我時常看5.1聲道影片和玩5.1聲道遊戲。我簡直無法離開CMSS-3D。另外,X-Fi Crystalizer也是那麼的令人驚奇以至於我在離開它聽任何東西時都覺得索然無味。

Linux, OS X and Windows do have almost no difference in sound quality. Up to XP, with such a good card as the X-Fi, Windows was the best out of the three. Having them all properly set up not to make any sort of resamplings, they're all the same. Each, of course, deal with latency a different way. I'm not quite familiar with other OS'es but at least Windows has WASAPI and works admirably with ASIO 2.0 and OpenAL (hardware accelerated, opposed to software rendered on Linux and OS X). These APIs are quite good on latency, specially ASIO. Anyway, without resampling and not taking into consideration latency, any OS should be the same.

Linux、OS X和Windows在聲音質量上真的幾乎沒有什麼區別。直到XP,在使用如此好的X-Fi卡片時,Windows是它們三個中表現最好的。把它們都設置好且不使用任何重採樣(resampling)之後,它們(的表現)都是完全一樣的。當然了,它們使用不同的方法對待延遲(latency)。我並不特別熟悉其他的操作系統,但是至少Windows有WASAPI並且在使用ASIO 2.0和OpenAL(硬件加速,和Linux及OS X上的軟件渲染相反)時表現極好。這些API在延遲上表現良好,尤其是ASIO。(當然)無論怎麼說,在不使用重採樣並且不考慮延遲時,任何操作系統的表現都應當是一樣的。

Now, when it comes to improvements implemented in hardware / driver, no doubt Windows wins (on Creative's side, specifically).

現在,當考慮到硬件或是驅動上實現的增強時,Windows贏得毫無疑問(僅限創新)。

I'll just keep using Linux once in a while with its 100% software rendered, mixed, resampled audio, quite flat and 2 dimensional.

我仍舊會時不時地使用Linux——100%軟件渲染、混音、重採樣音頻,特別平(flat)的以及2維的(聲音)。

For the best quality and user experience and full use of my hardware capabilities, I'll unfortunately have to stay with Windows.

爲了追求最好的質量以及用戶體驗,並且完全使用我的硬件規格,我很不幸地不得不留在Windows上。

By the way, have any of you ever realized that Linux just doesn't grow on the "hardware accelerated" industry? The most it gets is OpenGL. There are no solutions to fully decode in hardware video streams, like MPEG2 or H.264, or to mix audio streams from different sources, or to process MIDI, or EAX effects, or audio resempling, downmixing, or TCP offload, or whatever. Everything, except OpenGL is software implemented. I shame indeed!

順便說一下,你們是否意識到Linux並不長在”硬件加速“的產業上?它得到得最多是OpenGL。沒有任何的硬件解碼視頻流——例如MPEG2或者H.264——,或者合併不同源頭的音頻流,或者處理MIDI,或者EAX效果,或者音頻重採樣、downmixing,或者TCP offload,或者其他東西的方案。任何東西——除了OpenGL——都是軟件實現的。我實在感到恥辱。

15#:

Well, that is of course the whole issue. Most hardware manufacturers put all their efforts into developing drivers for Windows. Linux, if it is even considered at all, is an afterthought at best. The companies that fully support linux and open source their drivers (for example Ralink wireless cards) have hardware that works just as well in linux as it does in Windows.

說起來,這當然就是所有問題所在。大多數硬件製造商將它們的精力全都放在開發Windows驅動上。至於Linux——如果它被考慮了的話——最好的情況也是一個靠後之事。那些有完善Linux支持並且願意公開驅動源代碼的廠商(例如Ralink無線網卡)所產硬件在Linux和Windows上的表現一樣好。

For those who swear that sound is "better" in Windows, perhaps try a blind comparison. Install Windows and linux on the same computer. Have a friend boot either Windows or linux randomly and play some music. See if you can consistently tell whether Windows or linux is playing the music. You may be surprised at what you find. Even the (supposedly golden eared) high end audio reviewers at Stereophile magazine dare not do blind comparisons of audio hardware.

對於那些信誓旦旦說在Windows中聲音“更好”的人,你們應當嘗試一下無偏見比較(blind comparison)。在同一臺電腦上安裝Windows和Linux。讓一個朋友隨意啓動Windows或Linux並且播放同一首音樂。看看你能否始終如一地分辨出播放音樂的到底是Windows還是Linux。你或許會對你自己的發現感到驚訝。即使是那些Stereophile雜誌中(號稱金耳的)高端音頻評測者也不敢對音頻硬件做無偏見比較。

17#提出了這麼一個問題:“在播放音樂文件時候Windows上和Linux上效果一樣,但是在放DVD影片時候Windows中音量比Linux下大,不知道爲什麼。”

18#:

The "problem" you talk about exists on Windows too. We're actually talking about a Dolby Digital issue. It's not exactly a problem though, nothing that has got to be fixed. Dolby Digital has a lower audio range, output, volume, whatever they call it, meaning it sounds lower than other formats, like DTS (which happens to be better concerning audio quality).

你所說的這個“問題”在Windows上其實也有。我們在討論的其實是Dolby Digital的事情。它其實並不是個問題,所以也沒什麼可修復的。Dolby Digital有一個更小的聲音範圍/輸出/音量——不管怎麼叫它吧——,意味着在和其他格式——例如DTS(考慮到聲音品質時它恰好更好)——比較時它聽起來聲音更低。

Windows 7, for example, has a built-in Dolby Digital decoder. If you right-click the video screen (on Media Player) and go to "Enhancements" (I'm not sure that's what it's like on the English version of the software since I use the Br-Portuguese version) you can click "Dolby Digital settings" and it will give you three options for you to choose: "Normal", "Night" and "Cinema". If you choose "Normal" you're going to have a boost on low volumes and a decrease on the excessively high ones. If you choose "Night", you'll have the same softened output but a slight increase on the dialogs (I guess this one sounds better for onboard sound solutions). Now, if you choose "Cinema" mode, then you'll have the same exact output that the DVD was intended to have, called full dynamic. At times the sound will be low, and at times high, it'll vary dynamically. Most people won't like it if they don't have a good sound card, capable of high dynamics in audio, and a good speaker system or headphones too.

Windows 7——例子而已——有一個內建的Dolby Digital解碼器。如果你在視頻界面上右鍵(在Media Player中{即Windows Media Player,Windows自帶的播放器})並且轉到“增強(Enhancements)”(我不確定在英文版中它到底叫什麼,因爲我用的是巴西葡萄牙文(Br-Portuguese)版),這樣你可以點擊“Dolby Digital設置(Dolby Digital settings)”,然後它會給你三個可選項:“正常(Normal)”、“夜間(Night)”、“影院(Cinema)”。如果你選擇“正常”,你會在低音量時得到增強且在高音量時減弱;如果你選擇“夜間”,你會得到相同的柔化了的(softened)輸出但在對話中得到輕微增強(我猜這會在板載(onboard)聲音解決方案{集成聲卡?}中聽起來更好一些);現在,如果你選擇“影院”模式,你會得到同該DVD被預期得到的效果完全一樣的輸出——這被稱爲全動態(full dynamics)。有時聲音會低,有時會高——它會動態變化。多數人並不喜歡它,因爲(if)他們沒有一塊好聲卡——適用於音頻中的高動態——以及好的揚聲器(speaker)系統或耳機(headphone)。

I don't know which Dolby Digital decoder you've chosen under Windows XP, since it doesn't have a built-in one, I'd recommend, by the way, AC3Filter, it's one of the bests out there. Anyway, it seems your decoder under Windows is set to something like the "Night" mode, giving you pretty much the same (high enough) volume experience throughout the whole video.

我不知道你在Windows XP中選的是哪個Dolby Digital解碼器,因爲它沒有內建的——順便一提,我建議AC3Filter,它是上佳之選中的一個。不管怎麼說吧,看起來你在Windows所用的解碼器被設置爲類似於“夜間”模式——給你在看整個視頻時以還原很好(pretty much the same)(足夠高)的聲音體驗。

Linux, on the other hand, doesn't have the same configurability of Windows 7 and other decoders like AC3Filter, and instead of choosing the "Night" mode equivalent as does your Windows XP decoder, it chooses the "Cinema" mode for quality purposes. As I've said, preferably, the encoded, compressed sound should be decoded and sent to your audio system **untouched**. If you have your system sound output set to stereo there is surely some processing done with the decoded DVD audio in order to fit it to 2CH outputs. Anyway, the Linux decoder tries to convert the compressed audio stream to PCM **as it is**, with the same output volume as is in the DVD. As said, too, Dolby Digital has lower volume if compared to other compression formats, like DTS, MP3, etc.. Thus, you have the impression that Linux sounds worse, which isn't true. Actually, it sounds better since it doesn't play with audio volume.

然而另一方面,Linux沒有如同Windows 7或者其他解碼器如AC3Filter之列的配置能力,並且它沒有像你的Windows XP解碼器那樣選擇“夜間”模式的等價物,而是出於質量考慮選擇“影院”模式。像我說過的那樣,較好情況下,該編碼、壓縮了的聲音應當被解碼並且原封不動地送往聲音系統。如果你將你系統的聲音輸出設置爲立體聲,其中顯然會有一些處理過程施加在解碼後的DVD音頻上——爲了使其適用於雙聲道(2CH)輸出。不管怎麼說吧,Linux解碼器會試着將壓縮過的聲音無差別地(as it is)轉換到PCM——同DVD中一模一樣的輸出音量。依然如前所述,Dolby Digital和其他格式——如DTS、MP3等——比起來音量更低。因此,你產生Linux聲音更差的感覺——其實並不正確。實際上,它聽起來更好,因爲它沒有調戲(play with)音量。

I don't know any solution to this but trying to increase both the PCM and Master volumes under ALSA Mixer (type on terminal "alsamix").

我並不知道該事情的解決方案——除了在ALSA Mixer(在終端中輸入“alsamix”{至少現在arch上應當爲alsamixer})中嘗試調高PCM和Master的音量。

I myself can't stand watching DVD's or any multichannel audio under Linux. Firstly because it has no advanced audio downmixing with well implemented HRTF techniques, as Creative's CMSS-3D. Secondly, it has no hardware accelerated MPEG-2 decoding. There are good [paid] choices for Windows out there, but for Linux the best you're gonna have is VLC which has plenty of choices for deinterlacing. Anyway, none of them have come even near to the quality of my hardware dedicated decoding under Windows. My ATI Radeon HD 3850 deinterlaces using vector adaptive algorithm with "pulldown" detection, that makes my DVD's look gorgeous! Let alone if I had a better card, like the 4000 series, with upscaling techniques!!! I like most Linux Mint and Ubuntu. I have made extensive tests with Mint 10 RC and Ubuntu 10.10. I can say that Totem DVD player, or Gnome Mplayer look just like Apple's DVD player on Mac OS X. Sound for me is not an issue on DVD's because of my better sound card.

我自己無法忍受在Linux下播放任何DVD或是多聲道音頻。首先,因爲它沒有任何使用實現良好的HRTF技術——例如創新的CMSS-3D——的高級音頻downmixing。其次,它沒有硬件加速的MPEG-2解碼。Windows上有許多良好的[付費]選擇,但是在Linux上你能得到的最好一種應當是VLC——它擁有大量的deinterlacing選擇。不管怎麼說,它們中沒有任何一個表現得哪怕是接近我在Windows下的硬件專用解碼。我的ATI Radeon HD 3850 deinterlaces使用帶有“pulldown”檢測的vector adaptive算法,它能讓我的DVD看起來絢爛奪目!更不用說假如我有一個更好的卡片——例如4000系列——擁有upscaling技術會如何了!我最喜歡Linux Mint和Ubuntu。我對Mint 10 RC和Ubuntu 10.10進行了多方面的測試。我可以說Totem DVD播放器或者Gnome Mplayer看起來就像Mac OS X上蘋果的DVD播放器一樣。歸功於我良好的聲卡,DVD的聲音對我來說並不是個問題。

 

習LXC遇諸

爲了解決某些問題(後來發現不可),這兩天看了看coolshell中LXC的“教程”[1][2],在運行“示例”之時發現有些執行結果和原文中所說並不一樣,遂上網查之,有得解,有未得解。

(本文作於9.26日)

继续阅读

解決device not accepting address *, error -*

豫:實際上這裏提出的做法並不可稱爲“解決”,因爲沒有找到具體原因,而只有解決方案。

最近手上的Kingston DTR30 32G U盤(屬USB閃存設備)出了問題,在試圖查壞塊時候意外發現了另一個問題(已驗證和U盤無關):

  • 插入U盤之後檢測到USB設備(lsusb),但是不出現對應的塊設備(lsblk);
  • 查看dmesg,輸出中有多行如下內容:
    usb 1-1.2: new high-speed USB device number 92 using ehci-pci
    usb 1-1.2: device descriptor read/64, error -110
    usb 1-1.2: new high-speed USB device number 93 using ehci-pci
    usb 1-1.2: device not accepting address 93, error -110
    
  • 之後信息反復(並不一定和上面完全相同),其中設備號不斷上升;
  • 多次之後變成:
    unable to enumerate USB device

其中的設備號完全可以是其他值,錯誤號也可以是其他值,例如下面的:

usb 1-1.4: new high-speed USB device number 103 using ehci-pci
usb 1-1.4: device not accepting address 103, error -71
usb 1-1-port4: unable to enumerate USB device
usb 1-1.4: new high-speed USB device number 104 using ehci-pci
usb 1-1.4: device descriptor read/all, error -71
usb 1-1.4: new high-speed USB device number 105 using ehci-pci
usb 1-1.4: device descriptor read/64, error -71

在網上搜索多時,總共找到兩個相關內容,分別如下:

  1. 過熱之說(網址1 網址2
    • 其中說道:“這極爲可能是硬件問題(failure)而不是驅動或者內核bug。USB有‘電流過載(over-current)保護’,會在接口電量消耗過大時觸發。”
    • 解決方案是:“拔下所有USB設備,關閉電源,等一兩分鐘。然後接回所有設備並啓動系統。”
  2. 驅動bug之說(網址
    • 該論壇主題中,許多人遇到了這樣的問題;
    • 2樓(Rocket2DMn)提出了一個解決方案:
      sudo rmmod ehci_hcd
      並說該問題有時候會發生在USB2.0設備上,但他也不清楚究竟是如何觸發的;
    • 再下面9樓(jhoderd)提出卸載ehci驅動模塊會導致無法使用高速USB,他也很糾結這個問題。

對於我碰到的問題,分別(是的我碰到了好幾次)嘗試上面兩個方案的結果如下:

  1. 分爲兩個階段,貌似管用
    1. 關機,睡覺起來之後再開,當時沒有再遇到問題;
    2. 開了一段時間以後(電腦服役五年了且散熱不好,最近濟南氣溫也比較高)溫度又昇上去(九十度),想起來再試,再次出現問題。
  2. 和論壇主題中說的解決方案有一定出入
    1. 卸載ehci_hcd模塊時候提示被ehci_pci模塊依賴,無法卸載;
    2. 同時卸載ehci_pci、ehci_hcd模塊之後所有(?)USB設備均不可使用;
    3. 重新裝載ehci_pci之後均再次工作,且未再出現問題。

在尋找問題過程中,還有過其他猜想,但經嘗試發現當可排除。猜想、原因及嘗試方案(結局均爲“問題依舊”,故不再贅述)如下:

  1. USB接口問題
    • 原因:電腦服役多年,且已知某接口可能接觸不良
    • 方案:更換到其他接口上(共3個USB2.0、1個eSATA/USB)
  2. USB接口供電/休眠問題
    • 原因:開機自動啓動powertop進行調節,其中包括USB接口自動休眠
    • 方案:關閉所有相關項目的自動調節功能
  3. 內核bug
    • 原因:出現該問題前兩天剛剛把內核更新到4.1.2
    • 方案:使用3.14.48(arch官方源中的linux-lts)內核

雖然就目前來看,問題得到解決,但是由於不清楚具體問題何在,難保日後不會再碰到。

如哪位知道具體問題何在,煩勞周知,多謝!