搜索
Table_bottom

标签云
Table_bottom

分类
Table_bottom

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

鏈。。。
Table_bottom

存档
Table_bottom

匆匆过客
83621
Table_bottom

功能
Table_bottom

長終端輸出“截屏”

今天偶然想把兩段終端輸出轉化成圖片發給別人(爲了保留顏色)。然而輸出特別長,一屏不足以顯示下來。於是想有沒有什麼方法可以讓我將終端的完整輸出截出來,畢竟手動一幅幅地裁剪太蠢了。

題目是聯想到一些Android設備上的所謂“長截屏”而取的,意義很是相似。

 

概要

由於沒有找到專門的工具,所以打算自己hack一個出來,故而事情分兩步:

  1. 將命令輸出存下來
  2. 將輸出轉化成圖片

然而在進行第二步的時候發現沒有工具可以一步到位,所以就通過HTML進行中轉。於是最終變成了三步:

  1. 將命令輸出存下來
  2. 將之前保存的輸出轉換成HTML
  3. 將HTML轉換成圖片

第一步:保存輸出

第一步可以直接重定向(加上強制彩色輸出),但我這種懶人使用了script命令。

script可以自動把我所有命令的輸出(帶提示行/prompt)都存下來,而且不用我再去一個個強制彩色輸出。而且啓動它以後會進入專門的環境,於是我可以首先在一個臨時目錄執行script,之後cd到我要執行命令的目錄,最後直接Ctrl+D以免弄亂我的正常目錄。

由於這許多優勢,我傾向於使用script,而不是採取輸出重定向的方案。

第二步:輸出轉HTML

第二步用ansi2html(AUR中有)將輸出轉換成HTML。由於是終端輸出,後面加上--bg=dark參數將背景設爲黑色會更合習慣;由於我的終端模擬器用的配色方案是Tango(我覺得比xterm-256color好看),所以還要加上--palette=tango。最終的命令就是這樣:

ansi2html --bg=dark --palette=tango < typescript > typescript.html

(理論上管道直接到ansi2html的輸入是可行的,但需要手動強制彩色輸出,畢竟多數軟件還是會探測輸出是否是終端的。)

然後可以先找你的瀏覽器看一下輸出是否符合你的預期(主要是配色方案這部分),確定後就可以進行下一步了。

第三步:HTML轉圖片

把HTML轉爲圖片的工具很多,我選了CutyCapt(依然是AUR上有)這麼一個傢伙,畢竟它滿足我目前的所有功能需求,而且用QtWebKit所以體積很小(我本來就有幾乎全套的Qt)。

對於我們的需求,其基本用法是:

CutyCapt --url=http://www.example.org/ --out=localfile.png

然而其默認的字號太小,怎麼看怎麼不舒服,所以我加了200%的縮放--zoom-factor=2。由於全都是文字,所以又加上僅縮放文字的開關--zoom-text-only=on(並沒有什麼卯月系列)。所以最終命令就成了:

CutyCapt --url=file://`pwd`/typescript.html --out=output.png --zoom-factor=2 --zoom-text-only=on

 

大功告成。(並沒有)

 

 

 

 

 

 

之後還需要手動使用圖片處理軟件(剪裁就可以了,所以gwenview足矣)將多餘部分去除。這樣就大功告成,可以拿去浪了。(其實還是有點小問題)

 

 

 

 

 

 

 

懸而未解

  • 經對比發現,輸出中的高亮並不正確,而且似乎沒有加粗。
  • powerline的輸出無法正確呈現。

 

遷移到awesome 4

前兩天隨手全局刷了一下更新,結果一不留神awesome提示我的配置文件有問題。檢查之下,發現awesome已經到了4了,所以立即意識到配置文件又改了。然而由於當時較爲忙碌,就又downgrade回了3.5,直到週末纔重新更上4並折騰配置,到今天算是初有所成。

 

由於我的配置沒有魔改,所以遷移起來還是比較簡單的。遷移前毫無疑問地,首要事情就是備份自己原來的配置文件;同時可以去看看官方說明文檔。

官方文檔分爲兩個,一個是“簡明遷移文檔”(然而官方自己都說這個只能保證你的配置能用,新功能就別想了),另一個是新的特性文檔。遷移文檔我看了一下就扔下了,然後對着新特性研究了一大半(然而還是沒看完)。

簡而言之呢,在我修改的時候,涉及到的新特性有這麼幾個:

  1. 增加了快捷鍵功能顯示界面(modekey+s)
    • 這個功能實際上是爲每個快捷鍵定義增加了一個可選參數,在其中寫上說明以及分組
    • 正確使用需要手動在快捷鍵設置的函數定義後增加這個參數,比葫蘆畫瓢即可
  2. 又重新增加了declarative layout(聲明式佈局?),同時默認配置中的頂部面板(panel)佈局改爲使用declarative layout
  3. 對象的屬性可以直接賦值(想來是有了鉤子/監聽器),而不必再使用set_xxx()
  4. screen現在是動態的(以前不是?)而且是個對象,並且遍歷所有屏幕建議使用awful.screen.connect_for_each_screen(function(s)
  5. 許多舊的api列爲deprecated,並將在日後逐步刪除
  6. 默認爲每個normal(通常?)和dialog(對話框)窗口加上標題欄

由於我之前也沒用什麼奇怪的庫(僅用了awesome-freedesktop和vicious),所以整個過程其實不難:將原來的配置文件($HOME/.config/awesome/rc.lua)備份一下,將新的配置文件/etc/xdg/awesome/rc.lua複製過去,然後開始vimdiff。

  • 一部分設置的位置變了,但內容沒變,所以保留原始狀態不變
  • menu的項目改成原來的
  • tasklist右鍵的默認動作單獨提了出來,不知道具體爲了什麼,但我將它留在原地
  • widget配置方式改成declarative的
    • 糅合panel配置,都放到專門的panels.lua中(因爲我搞了倆panel,上面一個、左邊一個)
  • 爲自己的快捷鍵增加說明
  • 調整窗口默認規則
  • 把normal窗口的默認標題欄去掉

嗯,基本就是這些了吧。剩下的那些邊邊角角的情況都是比葫蘆畫瓢即可。

 

讓我感到比較奇妙的是awesome 4增加的這倆東西:

  1. 新的widget
    • 尤其是其中的piechart和arcchart,感覺可以用來更好地顯示資源佔用了(我原來是用的vicious的文本)
  2. shape api
    • 其中有圓角的支持

然而由於我功力不夠,沒能摸索出來如何更好地使用這些東西……而直接搜索也沒搜到有用的信息(因爲太新了?)。所以接下來一段時間就要摸索這個咯(當然,有時間的話)……

Arch下XPS 13 9343的触摸板多指动作

昨天偶然意識到需要經常“後退”和“前進”,而又懶得用兩隻手去按鍵盤快捷鍵,於是想到觸摸板多指動作。

我的鼠標是羅技的M345,滾輪可以向左右傾斜而觸發後退和前進動作,而且不需要額外設置就可以用,於是感覺應該是有專門的通用事件來處理它,故而試圖尋找觸摸板觸發該事件的方法。

 

由於觸摸板雙指滾動已被佔用,而且知道自己觸摸板可以識別三指(點按),於是鎖定目標在三指滑動。然而synaptics驅動中似乎並沒有該功能,故而前去尋找,終於找到mtrack

該倉庫原本由BlueDragonX維護,後來擱置,於是p2rkw接手並且在持續維護。

 

AUR中有該包(xf86-input-mtrack-git指向的是p2rkw維護的),直接裝之(和xf86-input-synaptics衝突,pacman會提示卸載)。安裝後會自己放置配置文件到/usr/share/X11/xorg.conf.d/10-mtrack.conf,理論上應該可以自動切換觸摸板所用“驅動”(InputClass配置的Driver項)到其上。

然而我之前手動設置了觸摸板的一些配置(在/etc/X11/xorg.conf.d/下),所以還需要改該文件。不過在修改配置之前,首先要確認mtrack到底啓用了沒有,所以我就把我的配置文件中Driver項從synaptics改成了mtrack。

xf86-input-mtrack-git的安裝腳本會提示“可能需要把自己加到input組中”——貌似由於X不再以root運行,所以需要讓自己在input組中以便mtrack可以正確配置觸摸板。

由於X只有在啓動時會讀取配置文件,所以只好忍痛將所有程序都關掉然後重啓X。然而啓動後發現無論用xev怎麼測,三指的動作死活無法觸發(默認配置中,三指上下左右分別對應按鍵8、9、10、11)。於是懷疑是不是mtrack根本沒有啓用。而由於xf86-input-libinput現在被xorg-server依賴,所以沒辦法從源頭上排除(刪掉所有其他和觸摸板相關的東西,如果觸摸板還能工作,說明mtrack在處理它)。故而前去查詢X的日誌(用DM來管理的話在/var/log/Xorg.0.log,startx的話在$HOME/.local/share/xorg/Xorg.0.log),發現mtrack被載入了,然而有這麼幾句:

[     4.741] (EE) mtrack: cannot configure device
[     4.741] (EE) Couldn't init device "我的觸摸板名稱"
[     4.741] (II) UnloadModule: "mtrack"
搜索了很久,然而始終沒有找到對我有用的信息(都是macbook云云)。而網上一些人說道即使有cannot configure device這句,mtrack的配置依然會生效(然而他們及其後的人也說過只要把用戶加到input組中就不會再有這個消息了,可是我這還是有)。後來偶然重新去看日誌,發現上面還有
[     4.741] (WW) Touchpad has minimal capabilities. Some features will be unavailable.
然而也沒有什麼有效信息,只是讓我確認了我的觸摸板功能不夠全……於是繼續搜索了一大圈,最後意識到好像是閾值設置得太高了(SwipeDistance默認是700)……另外,所有有效的“Option”都會打出到日誌中。
 
最後在把閾值設置低一些(我設置的220)以後,通過xev成功監聽到了三指動作的觸發……(然而四指的無論如何都無法觸發,不知是硬件問題還是什麼)
它的配置文件中Scroll*代表雙指划動動作,Swipe*代表三指划動動作,Swipe4*代表四指划動動作;另外還有似乎並沒有通用行爲只是觸發按鍵的:Scale*代表的雙指縮放、Rotate*代表的雙指旋轉。
 
再然後就是配置它以使得符合我的需求。我需要的是左右划動觸發後退和前進,而上下暫時沒有需求。於是通過xev監聽我鼠標滾輪左右的事件,發現是按鈕8和9,而mtrack默認配置和我的需求不同,於是在配置文件中修改之。爲了保留原有的並不知道有什麼用的按鍵10和11,故而選擇交換上下和左右的動作。最終這部分是這樣的:
        Option "SwipeDistance" "220"
        Option "SwipeClickTime" "120"
        Option "SwipeSensitivity" "0"
        Option "SwipeUpButton" "10"
        Option "SwipeDownButton" "11"
        Option "SwipeLeftButton" "8"
        Option "SwipeRightButton" "9"

 

然而在改完了之後,忽然發現xf86-input-mtrack倉庫中的example有(且僅有)XPS 9333的配置文件……雖然是前代,但很多地方還是很有參考借鑑意義的……於是最終將它的配置文件抄過來稍加修改……

 

不過話說回來,example中有許多我是看不懂的(畢竟對X的配置理解不深刻),尤其是那堆重複寫Swipe和Swipe4動作的部分。哪位理解的話希望可以指點一下。

 

另外還見到了兩個其他相關軟件,然而我都沒有試:一個叫touchegg的似乎是截獲觸摸板動作然後改轉發其他動作的軟件;另一個叫easystroke的似乎是手勢識別軟件。

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的聲音對我來說並不是個問題。