Tuesday, February 17, 2015

Enhanced Audio On The Emacspeak Desktop

1 Enhanced Audio On The Emacspeak Desktop

I recently added a set of modules to Emacspeak to leverage some
of the high-end audio functionality available on Linux machines
on modern hardware. As an example, applying effects such as 3D
spatialization, high-end reverb effects etc. once consumed
CPU cycles to the extent where it was not possible to play with
these in realtime. All these now take less than 1–5% of the CPU,
and that when my laptop is running in power-save mode!

1.1 An Audio Workbench Using SoX

Sound Exchange (SoX), described as the Swiss army knife of sound
processing, has been around since the time I was a graduate
student. Today it provides a versatile set of tools for editing
and manipulating both wave and mp3 files. Module sox.el
implements a simple Audio Workbench for the Emacspeak desktop.

1.1.1 Pre-Requisites

SoX with all available auxillary packages for adding support for
various filetypes such as mp3.
The various Ladspa related packages for installing additional
audio effect filters.

1.1.2 Usage Instructions For SoX.el

Launch the Audio Workbench via by executing M-x sox.

Use f to open a wave or mp3 file you wish to manipulate.

Add any of the supported effects using e.

Use upper-case E to add more than one effect.

Hit p to play the result, s to save the result to a new
file.

At present sox.el supports a few effects such as trim for
clipping files, reverb for adding a reverb etc., with more to
come as I use it.

1.2 Adding High-End Reverb When Playing Media Streams

I use mplayer to play both local and network media
streams. MPlayer can apply a wide range of filters to the audio
stream; more interestingly it can also apply effects implemented
as Ladspa plugins. Package tap-plugins implements a large
number of high-quality Ladspa filters, including a versatile
Reverb filter.

Once you have package tap-plugins and its dependencies
installed, and a relatively new version of MPlayer (with support
for Ladspa plugins), you can now apply various Reverb Presets
to your media streams via Emacspeak MPlayer command
emacspeak-m-player-apply-reverb-preset bound to P in
Emacspeak MPlayer. Package tap-plugins defines a total of 42
Reverb Presets, experiment with these when wearing headsets.
Once you have applied a Reverb Preset, you can edit its current
settings via command emacspeak-m-player-edit-reverb bound to R
in Emacspeak MPlayer.
Alternatively, you can pick a default effect to use via Emacs'
custom interface; see option emacspeak-m-player-reverb-filter.

1.3 Defining Convenient MPLayer Shortcuts

Finally, You can now bind shortcut keys for launching Emacspeak
MPlayer from specific locations where you store media, e.g.,
you can have separate shortcuts for Music vs Audio Books –
see command emacspeak-m-player-accelerator.
This is best used by customizing Emacspeak option
emacspeak-media-location-bindings — just use the Customize
interface to specify pairs of shortcut keys and media locations.

1.1 Pre-Requisites

2 Simple Usage Summary

M-x emacspeak-wizards-tune-in-radio-search prompts for a
query and brings up search results.

Both browse and search get the results back as an OPML
feed, which gets displayed as a simple Web page within the
Emacs Web Browser (EWW if using 24.4).

Items identified as (link) are themselves OPML feeds and
can be opened via command emacspeak-feeds-opml-display.

The initial browse buffer is set up to use opml-display
when you click on link items.

You can play (audio) links by invoking command
emacspeak-webutils-play-media-at-point — this command is
bound to _; in EWW.

You need to provide an interactive prefix argument to the
above command to indicate that it is a playlist — so you
actually press C-u ; on audio links.

Many of the audio links do not return a playlist – they
instead return a link that is a pointer to a playlist. Newer
versions of mplayer will throw a security error — you can
tell mplayer to follow them by invoking the earlier command
with two prefix args so C-u C-u ;.

All this works about 90% of the time. In some cases –
depending on whether the server failed to generate the right

mimetype for the play URL etc, you may need to run

curl --silent <url>

where <url> is the URL of the audio link, then pass that
resulting URL to command emacspeak-m-player-url.