<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>True EDGE &#187; Multimedia</title>
	<atom:link href="http://blogs.gnome.org/happyaron/category/multimedia/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.gnome.org/happyaron</link>
	<description>Hacker builds things.</description>
	<lastBuildDate>Fri, 27 May 2011 15:19:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>		<item>
		<title>在 Ubuntu 上换用 OSS4 声音系统</title>
		<link>http://blogs.gnome.org/happyaron/2011/02/12/ubuntu-oss4-sound/</link>
		<comments>http://blogs.gnome.org/happyaron/2011/02/12/ubuntu-oss4-sound/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 10:17:26 +0000</pubDate>
		<dc:creator>Aron</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Multimedia]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/happyaron/?p=399</guid>
		<description><![CDATA[首先介绍下背景，Linux 音频系统非常不完全简史：  1. OSS3 是 Linux 内核中比较老的声音系统，目前已逐渐废弃  2. OSS4 开发的时候是闭源软件，所以 2002 年 ALSA 被用来替代 OSS3 作为 Linux 内核中的声音构架  3. 2007 年的时候 4Front Technologies 发布了 GPL 版本的 OSS4，此时 ALSA 已成气候 关于 ALSA，OSS4，PulseAudio 和 Jack 一知半解版介绍（Esd 等就此省略一万字）：  1. ALSA 目前是 Linux 内核上标准的音频框架，但是仅支持 Linux 系统，没有软件混响。对各种设备的支持非常全面。  2. OSS4 由于错过时机而没能成为官方内核的一部分，但是它的跨平台性远好于 ALSA，支持 Windows、BSD 和许多 UNIX，其 API 据说也更适合开发。OSS4 有实时、低延时的特性，支持软件混响，所有操作在内核层实现。但是对 USB 设备的支持明显薄弱许多。  3. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>首先介绍下背景，Linux 音频系统非常不完全简史：</strong></p>
<li> 1. OSS3 是 Linux 内核中比较老的声音系统，目前已逐渐废弃</li>
<li> 2. OSS4 开发的时候是闭源软件，所以 2002 年 ALSA 被用来替代 OSS3 作为 Linux 内核中的声音构架</li>
<li> 3. 2007 年的时候 4Front Technologies 发布了 GPL 版本的 OSS4，此时 ALSA 已成气候</li>
<p><strong>关于 ALSA，OSS4，PulseAudio 和 Jack 一知半解版介绍（Esd 等就此省略一万字）：</strong></p>
<li> 1. ALSA 目前是 Linux 内核上标准的音频框架，但是仅支持 Linux 系统，没有软件混响。对各种设备的支持非常全面。</li>
<li> 2. OSS4 由于错过时机而没能成为官方内核的一部分，但是它的跨平台性远好于 ALSA，支持 Windows、BSD 和许多 UNIX，其 API 据说也更适合开发。OSS4 有实时、低延时的特性，支持软件混响，所有操作在内核层实现。但是对 USB 设备的支持明显薄弱许多。</li>
<li> 3. PulseAudio 是为 POSIX 兼容环境设计的一个声音代理程序，内置软件混响。PulseAudio 可以将程序对声音系统的请求代理到 ALSA、OSS 等多种后端，甚至可以通过网络传输这些讯息。</li>
<li>4. Jack 是一个专业级的声音服务系统，跨平台性强，其表现对内核的实时性要求较 PulseAudio 高一些，在一般的操作系统上 Jack 没有前者流行。</li>
<p>Ubuntu 默认使用 ALSA 作为底层声音驱动，程序则与 PulseAudio 交互，这是一个很不错的方案。然而作者偶尔会遇到 ALSA 被独占其他软件无法发声的问题，才随着 #ubuntu-cn 上的 OSS4 热潮赶了把时髦。</p>
<p><strong>换 OSS4 是要折腾的，折腾就是有风险的，以下为折腾的理由：</strong></p>
<li>1. 默认的 ALSA 在你的电脑上不能正常工作</li>
<li>2. 纯粹喜欢 OSS4，不喜欢 ALSA</li>
<li>3. 想要跟风折腾</li>
<p><strong>换 OSS4 的具体好处：</strong><br />
1. 某些情况下音质更好<br />
2. 低延迟，低 CPU 占用<br />
3. 自带软件混响<br />
4. 文档更全面</p>
<p><strong>换 OSS4 的具体坏处：</strong><br />
1. 有些硬件不被支持<br />
2. 对 midi 支持很差<br />
3. USB 声音设备支持仍处于试验性阶段<br />
4. 自己折腾可能会把系统声音系统搞跨</p>
<p><strong>开始说安装 OSS4 的具体方法。</strong><br />
<em>方法一</em><br />
到 OSS4 官方网站下载免费商业版， <a href="http://www.opensound.com/download.cgi">下载页面</a>。<br />
选择相应的版本，比如 Linux 2.6 (x86) (DEB)，点 Submit 获得下载链接。注意这个版本按许可证仅可以使用一年。<br />
得到 deb 文件后双击安装（或者 sudo dpkg -i oss-linux*.deb）。<br />
<em>方法二</em><br />
Ubuntu 10.10 可以直接从软件仓库安装版本略旧的 OSS4：<br />
<code>sudo apt-get install oss4-base oss4-dkms oss4-gtk</code><br />
Ubuntu 10.04 和 11.04 不可以使用这个方法，10.04 仓库中的 oss4-dkms 存在打包问题无法正确构建内核模块，11.04 因为内核新（linux >= 2.6.36）而 oss4 版本太老而无法成功构建内核模块。<br />
<em>方法三</em><br />
如果你像我一样喜欢开源版，又喜欢折腾，那么我们一起来编译最新版的。<br />
首先安装 mercurial 以便取回最新版代码：<br />
<code>sudo apt-get install mercurial</code><br />
取出代码：<br />
<code>cd ~<br />
hg clone http://opensound.hg.sourceforge.net:8000/hgroot/opensound/opensound oss-devel</code><br />
创建编译目录，OSS4 需要在空目录编译：<br />
<code>cd ~/<br />
sudo rm -rf oss42build<br />
mkdir oss42build</code><br />
编译并安装，假设你的主目录是 /home/aron：<br />
<code>cd oss42build/<br />
NO_WARNING_CHECKS=yes /home/aron/oss-devel/configure --enable-libsalsa=NO<br />
make<br />
sudo make deb<br />
sudo dpkg -i oss*.deb<br />
</code></p>
<p><strong>安装结束，如果没有遇到错误接下来开始配置：</strong><br />
1. 尽管 OSS4 内建了软件混响，我还是没有删除 PulseAudio，因为 Ubuntu 的桌面环境很多部件仅设置了 PulseAudio 后端。我不想一一折腾，而只是尽量让程序使用 OSS4，毕竟主要的播放器等都支持自定义音频输出。如果你也这样想，照下面做；如果你不想，跳过这段。</p>
<p><em>A. 修改 PulseAudio 设置使其默认使用 OSS4 输出：</em><br />
<code>gksu gedit /etc/pulse/default.pa</code><br />
添加一行：</p>
<ul>
load-module module-oss device=&#8221;/dev/dsp&#8221; sink_name=output source_name=input mmap=0</ul>
<p><em>B. 配置 gstreamer 使用 OSS4 作为后端：</em><br />
安装 gstreamer0.10-plugins-bad<br />
<code>sudo apt-get install gstreamer0.10-plugins-bad</code><br />
运行命令：<br />
<code>gstreamer-properties</code><br />
将输入和输出均设置为 OSS。</p>
<p><em>C. 设置 libasound 将传递给 ALSA 的声音请求转至给 OSS4：</em><br />
<code>gksu gedit /etc/asound.conf</code><br />
添加以下内容：</p>
<ol>
pcm.oss {<br />
       type oss<br />
       device /dev/dsp<br />
}</p>
<p>pcm.!default {<br />
        type oss<br />
        device /dev/dsp<br />
}</p>
<p>ctl.oss {<br />
        type oss<br />
        device /dev/mixer<br />
}</p>
<p>ctl.!default {<br />
        type oss<br />
        device /dev/mixer<br />
}</ol>
<p><em>D. 配置启动时默认启用 OSS4 而非 ALSA：</em><br />
<code>sudo dpkg-reconfigure linux-sound-base </code><br />
选择 OSS 而非 ALSA 或 default。</p>
<p>然后重启电脑，系统级配置基本完成。然后可以给支持自定义音频系统的软件配置成使用 OSS4，比如 Audacious，Wine，Audacity，VLC， (s)mplayer，clementine。</p>
<p>2. 如果你想删除 PulseAudio，也有办法，但是不保证所有程序都能正确输出声音。首先是按照前一种配置方法里的 B、C、D 调整设置，然后按照 E 和 F 对 PulseAudio 开刀。</p>
<p><em>E. 使用 GStreamer 接管 GNOME 声音系统，安装为 GStreamer 后端编译的 libcanberra：</em><br />
<code>sudo add-apt-repository ppa:dtl131/ppa<br />
sudo apt-get update<br />
sudo apt-get purge pulseaudio<br />
sudo apt-get upgrade</code></p>
<p><em>F. 配置 Rhythmbox 等程序使用 Gstreamer （没错，还需要配置）<br />
运行：<br />
<code>gconf-editor</code><br />
找到 system/gstreamer/0.10/audio/default，将其中所有仍被设置为 pulsesink 的键（如 musicaudiosink 和 chataudiosink）都改为 osssink。<br />
系统默认的音量控制插件会失效，因为它是基于 PulseAudio 的，可以在面板上单击右键，添加一个 GNOME 的声音控制。</p>
<p>然后重启，应该绝大部分声音系统都没有问题了。</em><em>可能存在的问题：</em><br />
1.Flash，需要安装 flashplugin-nonfree-extrasound 来获得支持 oss4 的 libflashsupport。<br />
2.Firefox，xulrunner 无法编译成同时支持 Alsa 和 OSS4，所以可能有问题。</p>
<p><strong>FAQ<br />
</strong><br />
<em>1. 声音输入不能用，或者有噪音</em><br />
运行命令：<br />
<code>ossxmix</code><br />
在显示的界面里把 pink 下拉菜单中选成 input，勾选界面里所有的 input-mix 和 input-mix-mute，然后在 pink 处拖动滑块减小音量，一般以 80% 上下为宜，否则会有噪音。</p>
<p><em>2. 如何查看是否已经加载了 OSS4 内核模块，以及我的声卡用了什么模块？</em><br />
运行命令：<br />
<code>lsmod | grep -i oss</code><br />
比如我是 HD Audio，输出如下：</p>
<ol>
oss_usb               104136  1<br />
oss_hdaudio           144219  3<br />
osscore               545146  2 oss_usb,oss_hdaudio</ol>
<p><em>3. 如何查看我的声卡型号？</em><br />
<code>lspci | grep -i audio</code></p>
<p><em>4. 64 位系统能用吗？</em><br />
能，没问题。</p>
<p><em>5. KDE4 用 Phonon，能用吗？</em><br />
Phonon 默认应该可以直接检测到 OSS4。KDE 4.0.x 用 Xine 后端时可能无法使用。</p>
<p><em>6. 用什么调节音量？</em><br />
如果保留了 PulseAuido，则使用它的程序可以用原来的音量控制，如果是用 Gstreamer，则可以使用 GNOME 的音量控制程序。<br />
当然，也可以直接使用 ossxmix 工具调整，或者例如 xfce-oss、kmix 这样的工具。</p>
<p><strong>不想用 OSS4 了，怎么复原？</strong><br />
我针对上面的 A B C D E F 分别说需要的操作。</p>
<p><em>A. 恢复 PulseAudio 默认的硬件检测</em><br />
<code>gksu gedit /etc/pulse/default.pa</code><br />
删除添加的行。</p>
<p><em>B. 配置 gstreamer 使用 PulseAudio 作为后端</em><br />
运行命令：<br />
<code>gstreamer-properties</code><br />
将输入和输出均设置为 PulseAuido。<br />
如果你不想要 gstreamer0.10-plugins-bad，可以删除它：<br />
<code>sudo apt-get purge gstreamer0.10-plugins-bad</code></p>
<p><em>C. 设置 libasound 使用 ALSA：</em><br />
删除 /etc/asound.conf 中增加的所有行。如果你开始折腾 OSS4 之前没有对它做过修改，直接删除就行：<br />
<code>sudo rm /etc/asound.conf</code></p>
<p><em>D. 配置启动时默认启用 ALSA：</em><br />
<code>sudo dpkg-reconfigure linux-sound-base </code><br />
选择 ALSA。</p>
<p><em>E. 换回支持 Gstreamer 和 PulseAudio 的 libcanberra 后端：</em><br />
安装必须的软件：<br />
<code>sudo apt-get install pulseaudio indicator-sound libcanberra-pulse libcanberra-gstreamer pulseaudio-esound-compat pulseaudio-module-bluetooth pulseaudio-module-gconf pulseaudio-module-x11 ppa-purge</code><br />
删除添加的 PPA：<br />
<code>sudo ppa-purge ppa:dtl131/ppa<br />
sudo apt-get update</code><br />
如果还不能正常，就手工降级所有相关软件包（是挺恶心的，但是没别的办法），可以在新立得里用“本地的或陈旧的”过滤器帮你确定是哪些包。</p>
<p><em>F. 配置 Rhythmbox 等程序使用 PulseAudio </em><br />
运行：<br />
<code>gconf-editor</code><br />
找到 system/gstreamer/0.10/audio/default，将其中所有仍被设置为 osssink 的键都改为 pulsesink。</p>
<p>然后把所有前面修改过使用 OSS4 的程序都换回使用 PulseAudio，重启系统。</p>
<p><strong>有用的资料：</strong><br />
1. 为常见应用程序配置 OSS4：<a href="http://www.opensound.com/wiki/index.php/Configuring_Applications_for_OSSv4">Configuring Applications for OSSv4</a><br />
2. 故障处理：<a href="http://www.opensound.com/wiki/index.php/Troubleshooting">OSSv4 Troubleshooting</a><br />
3. Archlinux Wiki 上的 OSS 页面：<a href="https://wiki.archlinux.org/index.php/OSS">英文</a> <a href="https://wiki.archlinux.org/index.php/OSS_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29">中文</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/happyaron/2011/02/12/ubuntu-oss4-sound/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Covert GBK/BIG5 encoded ID3 tag to UTF8</title>
		<link>http://blogs.gnome.org/happyaron/2010/08/13/covert-gbkbig5-encoded-id3-tag-to-utf8/</link>
		<comments>http://blogs.gnome.org/happyaron/2010/08/13/covert-gbkbig5-encoded-id3-tag-to-utf8/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 03:46:06 +0000</pubDate>
		<dc:creator>Aron</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Multimedia]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/happyaron/?p=226</guid>
		<description><![CDATA[For Chinese Linux users, we may meet many mp3 files with GBK/BIG5 encoded ID3 tags, which are very time consuming to change them to UTF8 one by one. Before using the following solution, please confirm that you won&#8217;t use media players on Windows that cannot handle UTF8 encoded ID3 tags correctly, and you won&#8217;t use [...]]]></description>
			<content:encoded><![CDATA[<p>For Chinese Linux users, we may meet many mp3 files with GBK/BIG5 encoded ID3 tags, which are very time consuming to change them to UTF8 one by one.</p>
<p>Before using the following solution, please confirm that you won&#8217;t use media players on Windows that cannot handle UTF8 encoded ID3 tags correctly, and you won&#8217;t use MP3 players that don&#8217;t support it.</p>
<p>Firstly, install python-mutagen package. For Debian/Ubuntu, use:<br />
<code>$ sudo aptitude install python-mutagen</code><br />
For Fedora and others, probably:<br />
<code># yum install python-mutagen</code></p>
<p>Secondly go to the directory containing files need to be converted.<br />
For files with GBK tags:<br />
<code>find . -iname "*.mp3" -execdir mid3iconv -e GBK {} \;</code><br />
For files with BIG5 tags:<br />
<code>find . -iname "*.mp3" -execdir mid3iconv -e BIG5 {} \;</code><br />
There is a good thing that the program could check if the encoding we selected is suitable, so when we convert GBK encoded files, the BIG5 ones won&#8217;t be changed. But please don&#8217;t use GB18030 option because it will cause problem when the file aren&#8217;t really GB18030 encoded.</p>
<p>If you need to edit tag text yourself, try easytag to help you. :P</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/happyaron/2010/08/13/covert-gbkbig5-encoded-id3-tag-to-utf8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Covert flac to mp3</title>
		<link>http://blogs.gnome.org/happyaron/2010/07/06/covert-flac-to-mp3/</link>
		<comments>http://blogs.gnome.org/happyaron/2010/07/06/covert-flac-to-mp3/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 09:19:33 +0000</pubDate>
		<dc:creator>Aron</dc:creator>
				<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Multimedia]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/happyaron/?p=214</guid>
		<description><![CDATA[Some time we have to use mp3 format because our moveable devices commonly don&#8217;t support flac/ogg, thus I need to convert a .flac file to mp3. It&#8217;s very simple: First of all, install flac and lame package from your distribution&#8217;s repository. Then, using the following command to actually covert the file. 1.flac -d filename.flac This [...]]]></description>
			<content:encoded><![CDATA[<p>Some time we have to use mp3 format because our moveable devices commonly don&#8217;t support flac/ogg, thus I need to convert a .flac file to mp3. It&#8217;s very simple:<br />
First of all, install flac and lame package from your distribution&#8217;s repository.<br />
Then, using the following command to actually covert the file.<br />
1.<code>flac -d filename.flac</code><br />
This will output an filename.wav in the same directory.<br />
2.<code>lame filename.wav</code><br />
Now a fresh filename.mp3 is lying in the same directory.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/happyaron/2010/07/06/covert-flac-to-mp3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Split .ape files with cue and convert to flac</title>
		<link>http://blogs.gnome.org/happyaron/2009/08/01/split-ape-cue-convert-flac/</link>
		<comments>http://blogs.gnome.org/happyaron/2009/08/01/split-ape-cue-convert-flac/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 10:08:11 +0000</pubDate>
		<dc:creator>Aron</dc:creator>
				<category><![CDATA[Multimedia]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/happyaron/?p=86</guid>
		<description><![CDATA[Split .ape files with cue and convert to flac format is not so difficult. We do it on an Ubuntu box for example: First, install the dependency of shntool, flac, mac, cuetools sudo aptitdue install flac shntool cuetools and download mac package in form of deb or tarball. Run the following command in a terminal: [...]]]></description>
			<content:encoded><![CDATA[<p>Split .ape files with cue and convert to flac format is not so difficult.</p>
<p>We do it on an Ubuntu box for example:</p>
<p>First, install the dependency of shntool, flac, mac, cuetools</p>
<pre>sudo aptitdue install flac shntool cuetools</pre>
<p>and download mac package in form of <a href="http://ubuntu:ubuntuftp@ftp.ubuntu.org.cn/home/cnfavor/soft/mac_3.99-u4-b5-1_i386.deb">deb</a> or <a href="http://ubuntu:ubuntuftp@ftp.ubuntu.org.cn/home/cnfavor/soft/mac_3.99-u4-b5.orig.tar.gz">tarball</a>.</p>
<p>Run the following command in a terminal:</p>
<p><span class="content"><span class="block" style="margin-left: 0px ! important;"><code class="plain">shntool </code><code class="functions">split</code> <code class="plain">-f FileName.cue -t '%n. %t' -o flac FileName.ape</code></span></span></p>
<p><span class="content"><span class="block" style="margin-left: 0px ! important;">and the output .flac files&#8217; name follows this sequence:</span></span></p>
<p>1. Track1name.flac</p>
<p>2.Track2name.flac</p>
<p><strong>Update:</strong><br />
2011-02-20:<br />
FFmpeg supports decoding APE format since 0.5 release, and it&#8217;s very easy to convert APE to FLAC now:<br />
<code>ffmpeg -i Filename.ape -acodec flac Filename.flac</code><br />
And Clementine supports CUE+APE/FLAC natively.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/happyaron/2009/08/01/split-ape-cue-convert-flac/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blogs.gnome.org/happyaron/category/multimedia/feed/ ) in 1.39608 seconds, on Feb 10th, 2012 at 8:43 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 10th, 2012 at 9:43 pm UTC -->
