Wednesday, November 30, 2011

Upgrading My Powered Subwoofer for Hi-Fi

I had been supplementing the low end on my ol' hi-fi with a crappy 30-watt powered subwoofer that came with some boxed surround sound set I purchased a number of years ago. It uses an 1/8" jack for input and drives a 4.5" (I think) woofer in a 4th order bandpass enclosure, like this:
However, the sound was pretty lackluster and failed to really produce anything much below 50 Hz, so I decided to kick it up a notch with some spare equipment I had laying around.

The stock woofer was highly inefficient when trying to play low frequencies, and was prone to "chuffing" (the sound air makes when it is quickly pushed out of the port hole) at higher volumes. The subwoofer's amplifier, however, is quiet (no humming, even with the volume cranked) and I like the simplicity of the 1/8" input (fewer wires jumbled up behind my setup), so I decided to bypass the crappy stock speaker and use the amp to drive a more capable bass speaker.

I had a spare Electro Voice EVM-15L driver with matching enclosure that I used for playing bass guitar, so I cut a 1/4" patch cable in half to get at the bare signal/ground connections without damaging the existing enclosure (in case I decide to use it for bass guitar again at some point) and disassembled my little subwoofer enclosure.

The subwoofer amplifier stage is mounted on a plate that came off easily after removing 8 little screws. A single wire connected the amplifier to the crappy stock speaker, so I cut that and pushed it to the outside of the enclosure to power my EV 15".

At this point, I could have removed the amplifier plate entirely from the old enclosure and woofer, but I didn't want to have a bunch of bare circuit boards laying around, so I routed the aforementioned cut-wire out through one of the screw holes and then screwed the plate back into place on the enclosure.

Unfortunately, when I connected the now-liberated amplifier to my EV 15", I experienced a lot of clipping, even at low volumes. I suspected that this might be a problem with the impedance of the driver not matching up with that of the stock driver, so I wired a spare 8-ohm resister in series with my EV, which fixed things right up. Now, it sounds great and has much more volume than I could ever want/need (the EV's SPL at lower frequencies is, unsurprisingly, far greater than the stock driver's).

The bass is smooth, punchy and you can feel it in your guts, unlike the piddly, flatulent sounds of the stock configuration. I've heard a lot of audiophiles say that "pro" audio gear is inappropriate for hi-fi use, but my experience demonstrates otherwise.

Monday, November 28, 2011

Installing Linux Mint 12 on Lenovo x120e

Ubuntu has really been pissing me off lately with the whole GNOME 3 / Unity desktop hokey pokey so I decided to test the waters with some other options. After trying and rejecting some alternate desktop packages within the Ubuntu ecosystem, I decided to try the newly released, Ubuntu-derived Linux Mint 12.

Installation

Since my computer (Lenovo ThinkPad x120e) doesn't have an optical drive, I downloaded the Linux Mint 12 CD (64-bit) release image and used Ubuntu's "Create a USB startup disk" utility to write it to my flash drive. However, when I tried to boot from it, it kept failing at the bootloader with an error that I can't quite remember (I'll try to reproduce the problem, for search indexing's sake).

I installed the unetbootin package, though, and it created a working drive on the first try. Once I booted into the Mint live system, installation proceeded smoothly and identically to a normal Ubuntu install.

First Impressions

Upon rebooting into my shiny new installation, the restricted driver manager popped up and acknowledged my Broadcom wireless card and Radeon graphics. The wireless drivers never kicked in, though, and the graphics displayed text wrong in the panels and menus (some letters and words were a scrambled, garbled mess).

The lack of wireless *and* a proper graphics driver was a definite deal-breaker for me, so that's where my first experience ended. I hope to give it another shot soon, so I'll update this post if I have any better luck.

UPDATE (12/05/11): I switched over to Linux Mint Debian, which is a rolling-release version based on Debian Testing. Again, installation was successful and fast. Debian doesn't have some of Ubuntu's noob-friendly utilities, such as the 'Additional Drivers' (jockey) utility, so you'll have to manually install the fglrx-driver package and then configure your /etc/X11/xorg.conf file to get accelerated graphics. There is an automated tool, aticonfig, that you can use to configure your xorg.conf. The following command will install the fglrx driver and the helper libraries to get accelerated video decoding, then invoke the aticonfig command to automatically configure your xorg to use the new driver (Thanks Erik!):

sudo apt-get install libva1 libva-x11-1 libva-tpi1 libva-glx1 libva-dev xvba-va-driver fglrx-atieventsd fglrx-control fglrx-driver fglrx-glx fglrx-glx-ia32 fglrx-modules-dkms
Thankfully, Mint Debian had none of the aforementioned weird rendering issues with the proprietary driver, and Compiz worked just fine (I installed the fusion-icon package so I could turn it on and off more easily).

UPDATE (12/30/11): Erik notes:
I went back to the open source drivers....
They seem to work much better for watching flash movies. For Youtube I use the FVR Flashvideoreplacer addon. The other websites are better with the open source drivers then with fglrx.
So, if you watch a lot of Flash video (youtube, Hulu, etc.), you might be better off sticking with the default, open source drivers, buy YMMV, so be sure to try both.

I have not yet been able to get my Broadcom wireless working, but I'll try to update this post if/when I get it figured out. If you are fortunate enough to have chosen the other wireless chipset, you should be fine out-of-the-box.

Saturday, November 19, 2011

Advanced RetroArch Configuration Options

Update (4/23/2012): SSNES has changed its name to reflect its versatility beyond SNES emulation. The new name is RetroArch and this article has been updated to reflect the change.

This guide picks up from where the basic guide left off, so if you haven't read it yet, you should.

In the main window, you can choose whether to save a BSV movie, which is basically a small file that logs all of your keypresses when you play. You can later take this file and replay it back like a sort of movie. This can be used to share your gameplay with others without the necessity of passing around gigantic files.

Below that, we have FFmpeg movie output, which allows you to dump actual video files using state-of-the-art, lossless RGB x264 with FLAC audio. The files can be quite large, but are appropriate for high-quality recording for things like speed runs. Currently, only *.mkv files are supported, so if you want to use this feature, make sure your file name ends in mkv. This feature can be used in conjunction with BSV playback to simplify recording speed runs, etc.

General

At the top of the main window, you'll see a menu labeled Settings. From there, click on General, and it should open a window that looks like this:
The first entry, Enable rewind, is what toggles on the ability to use real-time rewind, similar to what you find in the popular indie game Braid.

The next few options are for special use cases and can generally be ignored (the defaults are usually fine).

The next option I want to point out is Records filtered output, which will make the aforementioned mkv video dumps capture the image *after* filters (but not shaders) are applied, so your video will look as fancy as what you see on your screen. Below that, you have fields to load XML cheat databases, such as those used in bsnes, and below that you have some entries to specify paths for various additional files, such as save data and screenshots, that RetroArch creates. If left blank, these will default to the folder the ROM is loaded from.

Video
From here, you can choose your desired video driver. For most people, OpenGL (the default), will be fine and I will assume that's the one you'll use for the remainder of this tutorial. However, if OpenGL doesn't work for you, you can choose the slow and crappy (but reliable) SDL driver, or the D3D driver (not available in Linux, of course).

Windowed X and Y scale let you set custom sizes for the emulator window, while Fullscreen X and Y resolutions let you set custom resolutions in fullscreen (leaving it at 0 will attempt to scale the window as large as possible).

Checking VSync will cap your framerate to your monitor's refresh rate (a good thing, or else the emulator will run as fast as it can...).

Start in fullscreen is self-explanatory, and you probably want to leave Force 16-bit color turned off.

Disable composition (Win Vista/7) will automatically turn off Aero transparency, which can conflict with VSync in windowed mode (makes video stuttery), but doesn't affect fullscreen.

Bilinear filtering will add a slight blur to the image to take the edge off of the hard pixel edges (also known as smooth video in some emulators). This option has very little impact on performance.

Lock aspect ratio will ensure that the image is always a given aspect ratio (default is 8:7, assuming square pixels). You can also enter a custom aspect ratio (in decimal format, such as 1.333333 for 4:3 assuming non-square pixels) in the window next to the Aspect ratio entry farther down.

Crop overscan cuts off a few pixels around the edges of the image that were customarily left blank by developers and sometimes contain garbage pixels.

Below that, we have Shader/filter settings, which opens the advanced shader and filter settings window, and at the bottom we have Font settings which opens the advanced preferences for the onscreen text display.

Shader and Filter Settings

This is where RetroArch gets its bling:
The first entry, Cg pixel shader, allows you to load pixel shaders in Nvidia's Cg format. Below that, you can load bSNES XML shaders (deprecated in bsnes with v083, but RetroArch still supports them). The Cg shader format works with both OpenGL and D3D drivers, which is nice, but the selection is more limited than with the more common bSNES XML shaders.

The XML shader directory option allows you to select a folder that contains XML shaders that will be loaded in sequence when you press the assigned hotkey.

Checking the box by Render-to-texture (2-pass rendering) allows you to "stack" an additional XML pixel shader for additional effects. If you enable this, the FBO X and Y Scale fields allow you to specify a scale factor for the first-pass pixel shader. This often doesn't make a huge difference, but it can help with certain shaders that are intended to be calculated at a specific scale, such as HQ2x. Bilinear filtering (2. pass) applies the same slight blurring as before, but this setting ensures that you have fine control over how much blurring occurs and when. Finally, the Shader (2. pass) field is where you select the desired shader for the second pass.

The last field, bSNES video filter, allows you to apply CPU-powered filter libraries from bsnes (like XML shaders, they were deprecated in bsnes as of v083, but RetroArch still supports them), such as blargg's kickass NTSC filter.

You can download a number of Cg shaders from my Mediafire Cg repo, while XML shaders can be downloaded from Screwtape's XML shader repo and/or my Mediafire XML repo.

This page has preview pics for most of the XML shaders and a link to Themaister's WebGL shader testing applet.

You can download bsnes video filters for Windows here (32-bit) and here (64-bit) and for Linux here (32-bit) and here(64-bit).

Font Settings

With the On-screen message font entry, you can load a custom Truetype Font for RetroArch to display onscreen, while On-screen font size specifies the font size in points.

Enable on-screen messages is pretty self-explanatory. Uncheck to disable onscreen messages from  RetroArch.

On-screen message pos lets you specify custom X and Y axis positions for onscreen text, and Message color (RGB hex) determines the the color of the text in hex format. You can use an online color picker like this one to get your desired color in the proper format.

Audio


The first option is self-explanatory. Uncheck it to completely disable audio.

Audio driver is also pretty straightforward. DirectSound is usually the most compatible in Windows, but XAudio2 has lower latency and is often less buggy. In Linux, ALSA is what I use, but many speak highly of OSS.

With the External audio driver option, you can choose a custom driver that conforms to the RetroArch plugin API, but the only one available at the time of this writing is Themaister's experimental WASAPI driver. Below that, you can specify an Audio DSP plugin, which can potentially provide reverb and echo effects, etc. Mudlord has written a few of these, which even come with a fancy Qt GUI.

Audio sample rate should be set to match your computer's sound card output rate, which is usually the default 48 kHz.

Audio input rate can be confusing at first but is awesome once you get it set up (like RetroArch itself :P). Basically, as the emulator chugs away, it creates video frames at a rate of 60 per second and audio at an ideal rate of 32,040 samples per second. However, modern LCD monitors rarely have a true 60 Hz refresh rate, so, when displayed with VSync enabled on such a display, the audio and video will get faintly out of sync and cause either a video frame to drop (manifested as a stutter in the video) or a crackle in the audio. The default value of 31,980 is a closer match to modern display refresh rates than the ideal rate, but you can nudge it higher--if your video still drops frames occasionally--or even lower if your audio continues to crackle.

Audio rate step specifies the granularity at which the audio rate increases or decreases when you press the corresponding hotkeys.

Dunno what Audio device does.

Audio sync is similar to VSync in that it keeps the framerate in synchronization with the audio. Keep it checked for best results.

Audio latency (ms) is pretty self-explanatory. The default value is usually fine.

Input Settings

The Input settings window is where you can assign buttons and/or keys.

The slider at the top, labeled Input axis threshold, determines at which point an analog control will register as a digital button-press.

Below that, you can choose whether or not to use Player 1 button/key assignments during netplay regardless of whether you're hosting the game or connecting to someone else.

The pulldown menu below that lists the categories of keys you can assign, including all of the available controller slots from Player 1 to Player 5 and the miscellaneous RetroArch functions, like rewind. You can bind any of these functions by double-clicking on its entry and then pressing the appropriate key when prompted.

Last, the Detect analog checkbox determines whether analog inputs are even polled.

Netplay

Netplay is one of RetroArch's crown jewels and can be enabled via the main RetroArch-Phoenix window. We'll cover its configuration first and then go over some of the quirks you should be aware of.

If you check the box to enable netplay, you must specify whether you will be hosting (server) or joining (client) the game. If joining, you must also enter the host's IP address in the field below. Make sure your firewall is open on port 55435 (default; you can change it if you like) and that the port is forwarded in your router, if applicable. You can also specify 'spectator mode,' which will allow an arbitrary number of spectators to join and watch you play without being able to play themselves.

Delay frames denotes the maximum number of frames RetroArch will need to emulate at once to maintain synchonization due to actual network latency. You can figure out an appropriate ballpark for this number by pinging the other player and dividing the time (in milliseconds) by 16 (roughly the number of milliseconds in a frame from a game running at 60 fps).

Similar to the GGPO platform, RetroArch creates a constant stream of savestates which, along with button presses, are exchanged and compared between the server and client machines. If the savestates start to diverge, the game rolls back in time to a point where they both agree and then emulates the missing frames all at once to get back to the appropriate spot. This gives the illusion of completely lagless inputs, which is invaluable for twitchy, fine controls, such as parrying in Street Fighter III: Third Strike.

The downside to this method is that sound is almost always crackly and it can sometimes create odd time-rollback isues (hard to explain, but you'll know them when you see them ;P). It also produces occasonal spikes in CPU utilization as the emulator needs to emulate a series of frames all at once to catch up after a rollback.

If the gameplay is a bit choppy, try increasing the number of delay frames a bit. If you try to connect to a server and it immediately says client disconnected, open your log and make sure your ROMs match exactly (it will complain about a hash mismatch otherwise). If it gives you a weird time-out error, just close the window and try to connect again and it should work itself out (sometimes excessive spikes in network latency can cause the states to diverge catastrophically, resulting in this error).

It is also important to note that netplay does not work with all libsnes implementations. Known working implementations include snes9x (and the -next variant) and FBA's CPS3 driver (e.g., for SFIII: Third Strike). Other implementations may work, but you'll have to try them yourself (please leave a comment with your experiences if other implementations work/fail). Often, RetroArch won't show a disconnection if things desync during netplay and will instead show either a non-moving second player, or his/her behavior will be weird (like jumping into holes, running into enemies, etc.).

Getting Started with RetroArch

Update (4/23/2012): SSNES has changed its name to reflect its versatility beyond SNES emulation. The new name is RetroArch and this article has been updated to reflect the change.

RetroArch is a multi-platform multi-emulator with support for some really cool, unique features, including extensive shader and filter support, real-time rewind, lossless video dumping, advanced "lagless" netplay, and more. Unlike many other emulators, RetroArch is under rapid and active development and receives new features on a regular basis. However, all of these esoteric options and capabilities can be daunting to new users, so this guide will cover the basics. The instructions are primarily geared toward Windows users, but the configuration information is essentially the same on any platform.

So, first off: RetroArch is all about modularity, so we need to download a couple of initial modules, namely the RetroArch executable and its helper libraries. To get started, go to the RetroArch homepage and download the RetroArch full package that suits your system (the 'x86' build will work on all machines, while the x64 build will only work in 64-bit versions of Windows; get the x86 version if you don't know which is appropriate for you). The slim package contains the absolute minimum required for bare, no-frills emulation, while the full package is prepared to utilize RetroArch's many advanced features.

Once your download finishes, extract the zip file, navigate to the extracted RetroArch folder and look for retroarch-phoenix.exe. This is the graphical user interface (GUI) module that will help us get RetroArch set up and configured. Double-click it and you should see a window that looks like this:
Along the upper edge of the window, open the RetroArch menu and select Update RetroArch:
It should open a window that looks like this:
You can use this tool to automatically download updates for RetroArch, its helper libraries and any/all of the various emulation cores. First off, you'll need to select which flavor of RetroArch you're using--x86 or x64 (aka x86_64)--by clicking on the appropriate bubble next to CPU.
Then, click on the button labeled Check version. This will search for updates to RetroArch and/or its helper libraries and populate the list of available emulation cores:
After that, click on the bubble labeled Redist and then the button that says Download RetroArch. This will fetch any updated RetroArch executables, as well as fresh copies of all of the helper libraries (you can update RetroArch without the helper libraries by using the Full button instead of Redist).

At this point, you can also automatically download any of the cores in the list by double-clicking on its entry. After the download finishes, it will ask if you want to use the core. Whether you do or not is okay, as we'll be specifying our desired core in just a few seconds anyway.

Once you're done downloading cores (you can come back to this menu and download more cores at any time), close the Updater window and return to the main window, where we'll need to configure some options.

Starting from the top, the Normal ROM path is where you select the ROM you want to play. It will not hide inappropriate files, so make sure you pick the right one for the system you wish to emulate ;)

Next, we need to tell RetroArch where to store and load its settings, via the RetroArch config file path. Click Open, and then navigate to your RetroArch folder and choose the file named retroarch.cfg. Likewise, for RetroArch path, click Open, navigate to the same folder and select retroarch.exe.
Finally, the Emulator core path lets us select which emulation core we wish to use. So, click Open, navigate to the RetroArch folder and look for your desired core that you downloaded from the Updater, such as gambatte-0.5wip1-x86_64.dll in my case. RetroArch can be paired with any emulator core that conforms to the libretro API specification, including but not limited to the original libretro (previously known as libsnes) derived from byuu's bsnes.

At this point, simple emulation should be functional, so go ahead and try it by clicking on the big button labeled Start RetroArch. If it works, congratulations! You're ready to play. Check out the advanced configuration options to learn about filters/shaders, netplay, rewind support and more.

If it doesn't work, click on the File menu at the top of the window and select Show log. This will give you some information on why it failed. If you seek help at the RetroArch forums or in the RetroArch IRC channel, be sure to have this information handy, as it will help others solve your problem.


If you would like to explore some of RetroArch's more advanced features, check out this guide.

For Linux Users

If you're using a Debian-based distro, such as Ubuntu or Mint, you can use my PPA repo, where I package a number of emulators, including RetroArch and all flavors of libretro. To install RetroArch, open Synaptic Package Manager and add ppa:hunter-kaller/ppa to your software sources. You can then install any of the packages through your normal installation procedure of choice.

Otherwise, configuration is just like in Windows, except your retroarch.cfg file is initially installed to /etc/retroarch.cfg (but can then be copied to and overridden by any retroarch.cfg file located in ~/.config/retroarch/) and the emulation cores install to /usr/lib/.

Analytics Tracking Footer