Category Archives: Film-making

Playlists from Foobar2000 into Mixxx

If you like to curate your music using the famously flexible free player Foobar2000, yet you’d like to import your playlists to do some DJ-ing using the free Mixxx software, you’ve probably noticed it won’t import Foobar2000 playlists in the best common format, M3U8.

This is because Foobar2000 doesn’t insert the expected #EXTM3U and #EXTINF tags in the file.

I have written a little Python program (Python 3) to put the tags in for you. Put the program somewhere in your PATH, call the program, and use the name of your playlist as its only argument:

> python playlistfix.py 'VERY COOL MUSIC.m3u8'

You can download it here.

Warning: bad Realtek audio drivers

This page shows you how to fix bad audio from Realtek drivers on Windows.

It is tempting to imagine that the Windows modern audio interface (WASAPI) takes account of present-day fast CPUs and allows sharing of audio devices between programs at high quality, using good sample-rate conversion and audio mixing.

It does not. In the case tested briefly here, the stock Realtek driver (“Reaktek High Definition Audio Codecs R2.81“), in use on countless motherboards and other embedded applications, demonstrates genuinely audible problems, even to a fellow with typical hearing of a fifty-three year old. On searching the Internet for information about this problem, I found none, so decided to document it for you here along with a simple, but not immediately obvious, solution.

This effect was discovered after editing a voiceover. The playback from the audio workstation, which directly addresses the computer’s sound output without the use of the WASAPI interface or any of its logic, seemed clean. But playing back through any media player on the same machine, using the WASAPI driver in shared mode, resulted in what sounded like filtering of the top end, and a phase distortion not unlike that heard in a multiband broadcast compressor.

By a process of trial and error, I found where the problem was. This probably applies to any Windows computer using Realtek components. Please read this, and restore cleaner audio to your listening experience.

The Realtek audio driver contains a number of ‘enhancements’ (in other words, effects or distortions) for non-audiophile users to enjoy. These include reverberation, response selective amplification (or EQ), pitch shift and others. There is also an option to disable all enhancements, at which point the selection list becomes inoperative.

You MUST choose the option to “Disable all sound effects” to achieve high quality playback. Merely leaving all the effects deselected causes noticeable frequency and phase response problems, which become even clearer when tested.

Here is the output spectrum of my test. Audio is white noise, and uncompressed linear 24-bit WAV files were used throughout. The first example, on the left, is 48kHz-sampled white noise played with all enhancements off, but without ticking the “Disable all sound effects” box. You can see that there is a marked roll-off of the higher frequencies. I have not tested for phase shift, but listening to speech also gives this problem. When the “Disable all sound effects” box is selected, the audio is passed through without any change to frequency response, and informal speech testing indicates that the phase distortion is also removed.

I cannot emphasise this enough. The default Windows audio playback through the Realtek driver is appallingly bad, unless this simple adjustment is made.

The Lost Music of Firle

Can the music inspired by a Firle landmark be rediscovered?

If twenty-nine year old composer George Butterworth had not answered his country’s call to arms in 1914, English classical music rooted in the beautiful melodies of folk-song might be even broader and brighter with treasures. By the start of World War I, Butterworth had discovered his true vocation as a composer of lush orchestral textures and poignant songs. He travelled England, especially Sussex, recording on primitive machines or writing down in inns and markets the traditional songs of this land. But, like millions of others, he was lost to the First World War at the age of 31. Not even his body could be retrieved after he fell.

To this day, many critics regard him as the most promising composer of his generation. His tiny catalogue of just fifteen works, more than half of them songs or song cycles, is still popular around the world today, wherever evocations of English rural idylls or the lost beauties of the countryside are sought. And one of those idylls takes us up to the majesty of Firle Beacon.

After Butterworth’s time reading Greats at Oxford, where he excelled in music to the detriment of his other studies, he taught and composed a little: but the modest library of pieces he left are some of the finest examples of the English renaissance in national music, celebrating the folk music tunes and styles of this country. In 1907, at the age of 22, he journeyed widely in England, especially here in Sussex, collecting over 450 folk songs from this area. As he paid his respects to our local heritage of song, perhaps it was around this time that he became acquainted with Firle? His own manuscripts, with the musical notation jotted down in a neat but sharp hand, tell us for certain that he heard songs at least as close as Rodmell, Lewes and East Chiltington (images here are from the Vaughan Williams Memorial Library).

In English musical history, along with folk song, one inevitably finds historical research into traditional English dance. Butterworth was no slouch, as a famous piece of film from 1912 illustrates.

His orchestral works are extraordinarily pleasant to hear, typifying the pastoral English tradition carrying its torch blazing bold against the surge of modern, atonal music that other countries, particularly Austria, were producing. Both styles of music appeared for good reasons (imagine the turmoil in creative arts as the twentieth century matured!) but it will always be the English music that features more on the playlists of popular classical radio stations, particularly Butterworth’s “The Banks of Green Willow”. Other popular pieces include his English Idylls and the song-cycle to A. E. Housman’s poetry, “A Shropshire Lad”, from which the composer himself created an orchestral fantasy.

But now, we must consider the centre of our mystery. We know there was a piano piece, “Firle Beacon”, written before 1911. Butterworth considered this piece highly: he felt it worthy of performance before another English composer who was to have a long and glittering career: Ralph Vaughan Williams. The younger man was inspired by Butterworth in many of his own, more numerous, compositions, but he remembered “Firle Beacon” affectionately. He left this tribute to his friend:

“One of my most grateful memories of George is connected with my London Symphony, indeed I owe its whole idea to him. I remember very well how the idea originated. He had been sitting with us one evening talking, smoking, and playing (I like to think that it was one of those rare occasions when we persuaded him to play us his beautiful little pianoforte piece, ‘Firle Beacon’), and at the end of the evening, just as he was getting up to go, he said, in his characteristically abrupt way, ‘You know, you ought to write a symphony.’ From that moment the idea of a symphony — a thing which I had always declared I would never attempt — dominated my mind. I showed the sketches to George, bit by bit as they were finished, and it was then that I realized that he possessed, in common with very few composers, a wonderful power of criticism of other men’s work and insight into their ideas and motives. I can never feel too grateful to him for all he did for me over this work and his help did not stop short at criticism”.

Could we play this piece today on the historic Erard piano at Firle Place, which we know to have been made several years before “Firle Beacon” was composed? At the moment, it appears not. For, unlike the celebrated library of music still safely on the publishers’ shelves, “Firle Beacon” has never been seen or heard since the composer played it. Why might this be?

It seems true that Butterworth was a perfectionist. He destroyed many of his manuscripts before he went to the Battle of the Somme, wishing to avoid the possibility of unrevised, imperfect music being discovered in case he did not return from war. A sniper’s bullet fulfilled this nightmare. Butterworth posthumously received the Military Cross.

Is this why the manuscript of “Firle Beacon” is lost?

Or, could it be that, in his time walking on the South Downs, the young Butterworth might have brought his music to the great house at the heart of Firle, to let it be heard in the fine acoustic of the Great Hall? And, as a gift to his hosts, could he have left the manuscript there? Today, is it possible that this lost work by a revered son of English music may be discovered between two long-neglected books on a library shelf, or safely stored flat amid the pages of a leather-bound volume?

Election results—read all about them

This morning, 10th February 2017, the UK Independence Party is boasting, waving its flags in fact, about winning a district council by-election in the Great Oakley and Little Oakley ward of Tendring, Essex. Tendring District, we note, contains two of England’s ten most deprived areas*.

The winning party is singing about its majority being 7.7% with a 36.8% share of the vote. But the voter numbers, as opposed to proportions, tell a different story. Within the turnout of only 35% of the electorate, the party won by 45 votes out of the 587 cast. That margin is only half the number of players in my local darts league in this small Sussex town.

Furthermore, apart from this result, UKIP’s vote has dropped in every single council election since October 2016 in a ward where it had previously stood (except Swanley, Kent)†.

Just up the road from the three villages in this ward, in the town of Harwich, the candidate with the 45-vote majority had opened a shop promoting his party. The word ‘Independance’ (sic) was mispelt on its signs‡.

Statistics, when kept, can be comforting. But the work outside this echo-chamber must carry on.

* UK Government, Department for Communities and Local Government, Index of Multiple Deprivation 2015

Statistics compiled by Association of Liberal Democrat Campaigners and Councillors

Essex County Standard 4th February 2017

Is home audio moving forward?

The other day, a friend asked a Facebook group how developments in domestic audio might shape up in the future.

Nothing, not even Dolby Atmos, beats the revelation I experienced, in the early 1980s, of

  1. being able to leave behind the distortion and interruptions of vinyl by using CD or tape; and
  2. being able to build better loudspeakers.

The story goes back fifty years, at the time of writing. In 1967, my father bolted a rescued Garrard AT6Garrard AT6, the autochanger based on the SP25, into a polished brown radiogram cabinet and wired the crystal cartridge to the input of the built-in valve radio/amplifier. The cabinet had a richly toned single speaker underneath, and this system of glowing radio dial and filaments played his classical LPs, the 7-inch singles my mother inherited from her DJ brother, and my children’s records, together with some shellac 78s from second-hand shops and relatives, played by turning the crystal cartridge over in its headshell.

Amid the clunks and whirs of the mechanism, I was hooked on music of all kinds, Radiogram circa 1955and speech recordings too from companies like Saga and Delysé. On command, even a child could make dramatic magic happen in that warm-sounding loudspeaker. The amp with its lethal HT anode kicks was IC10replaced in 1969 by a black box into which my father had installed a Sinclair IC10-based 10W amp, which lasted through the replacement of the cartridge with a ceramic item in 1971, then he built (with me holding the circuit-boards steady sometimes) the Practical Electronics Gemini stereo amp set in 1972. In the years of mass-market stereo LPs on “Music for Pleasure” among others, we played this amp into mis-matched speakers rescued from Army surplus shops. Gemini preamp“But it was a stereo hi-fi to US” (to misquote Eric Idle), and the leap forward into “sound sculpted in space” was never regretted.

A Goldring magnetic cartridge followed, and a tuner, and other improvements here and there; but, as a musician-in-training, even when young, it maddened me that the music didn’t sound like it did on the radio or in the schoolroom when we played. There were ticks and pops that you didn’t get from instruments nor did you hear radio3-1967them on the Radio 3 concerts. Sometimes the pitch wavered slowly. Nearly always the sound had a ‘fuzz’ with it toward the end of a side, particularly on French horns, muted brass and sopranos. None of this happened when I taped a cassette off the radio, and it was a crying shame that all recorded music for the masses had this gauze of dirt, this veil in front of it. I learned where every scratch was in the quiet passages of the symphonies and chamber music on the shelf, and was almost surprised when those noises didn’t occur where expected on radio performances. My parents didn’t mind the interruptions, but I knew this rubbish was not music, even though the frequency response ran smoothly from bottom to top and the amplifier’s distortion was almost below measurement. And it was sad that one poorly set-up pickup or arm could damage a precious recording for ever.

Later, in my early teens, the record-making process was unveiled to me, and it seemed strange that good tape copies of the masters were not sold to music-lovers. ella-cassette“Musicassettes” too often sounded muddy, though we rescued a reel-to-reel deck to play home-recorded tapes well; but no decent tapes were available unless recorded from Radio 3 concerts or the Big Band shows on Radio 2 which were superbly presented. As you can tell, I had no idea of the economics of producing tape versus vinyl LPs.

But soon after that I was engineering or producing my own student recordings of good concerts or bands in our departmental studio at Surrey University; and almost simultaneously with my leaving home, 1982 Sony CD playerthe CD came along. Teenagers (as I was then) can tell where 20kHz brickwall filters harm music, but at last, at long last, the music was almost completely pure. It did not waver or wobble. It was not interrupted by ticks and pops, nor by fuzz. Its quality was identical from beginning to end. There was no mourning that the beautiful passages of “En Saga” were harmed by being close to the end of the LP side. There was silence between the tracks or in the rests. Just like in the concert hall or recording session. And, later, it became clear that the recorded sound did not need to be sanitized (albeit, in the hands of a mastering engineer, very sympathetically and musically indeed) to survive the transition from tape to vinyl groove. After this, all else was candlelight. We didn’t have gas in the village where I grew up. (Note to the youngest readers: find Karajan’s statement on digital audio.)

Apart from the gradual increase in amplifier efficiency and very occasional leaps forward in speaker technology (my main speakers are twenty years old, though a better sub was added recently), to answer the original question, I have heard nothing since the advent of interruption-free recordings, whether digital or analogue, that improves my enjoyment of music or drama, except for one thing. The ability to compress the music to suit my listening environment is my primary nod to convenience. Where necessary, my in-car or ‘party’ music on memory sticks has broadcast-style processing added so I never touch the volume control anywhere on the road or while people are chatting over the guacamole (home made) and Cava.

What’s left? Convenience; curation; accessibility, discovery; that’s all, really — and a means of paying musicians properly, of course.

As I become older, one thing intrigues me. If I become thoroughly deaf, and need a cochlear implant, could I tune my computer, as a musical instrument, to the frequency channels and be able to hear (or compose) music arranged especially for those channels? Could that be a thing? Can there be music composed or arranged specifically to be heard at its best through the limited-pitch channels of a cochlear implant, so that permanently and profoundly deaf people might choose to try experiencing music in this way too?

I’d like to thank Mike Brown, very senior audio engineer and radio presenter, for asking the question that provoked this ramble. His website is http://www.originalsound.co.uk/, and you can read about his many regular radio shows here: https://www.facebook.com/mikeonthewireless/

Illustrations are not mine; but are similar items seen on eBay or other websites

Free audio display with FFmpeg and MPV

Just for fun, I wondered what useful stereo audio displays could be placed on a Windows desktop using a single open source suite. Using my binary distribution, here is a promising start.

Audio Meters with FFmpeg

Here, within the MPV player, FFmpeg libraries produce two kinds of spectrum, a phase indicator, an EBU R128 measurement tool, a display showing the musical pitch of incoming sounds, a display of coherence between channels with an average indication, and a volume meter. I’ve started calibration. The PPM is referenced to the BBC’s transmitted levels, and it therefore reads 5dB high. On the spectrum displays, the vertical intervals occur every 5kHz.

Use the MPV player, which can take full advantage of OpenGL acceleration in Windows and other OSes. Then it’s easier to change the stereo source on the end to anything you like. In the example below, I use the 320kbit/s AAC stream of BBC 6Music, which you can hear in the UK. Alter it to your own preferred stereo source.

Please ignore line breaks in what follows… (a straight copy-and-paste into Windows Powershell works perfectly).

mpv --lavfi-complex="[aid1]asplit=7[a][b][c][d][e][f][g];[a]avectorscope=size=480x480:zoom=2:draw=line:r=25,drawgrid=240:240:color=gray[z];[b]ebur128=video=1:meter=18[q][x];[q]scale=480:480[y];[z][y]hstack[w];[c]showfreqs=fscale=lin:win_size=w4096:cmode=separate:size=480x480:minamp=1e-009,drawgrid=x=0:y=479:w=100:h=60:color=gray[u];[d]showspectrum=size=480x480:overlap=1:slide=scroll:scale=5thrt:mode=combined[t];[t][u]hstack[v];[e]showvolume=r=25:w=960:h=50:t=0:f=0.9,drawtext=font=Arial:fontsize=24:text='1':x=47:y=40:fontcolor=white,drawtext=font=Arial:fontsize=24:text='2':x=77:y=40:fontcolor=white,drawtext=font=Arial:fontsize=24:text='3':x=128:y=40:fontcolor=white,drawtext=font=Arial:fontsize=24:text='4':x=206:y=40:fontcolor=cyan,drawtext=font=Arial:fontsize=24:text='5':x=330:y=40:fontcolor=white,drawtext=font=Arial:fontsize=24:text='6':x=528:y=40:fontcolor=red,drawtext=font=Arial:fontsize=24:text='7':x=842:y=40:fontcolor=pink[s];[f]showcqt=size=960x180:r=25:bar_g=7:timeclamp=0.5[r];[g]aphasemeter=size=960x40:mpc=red[h][p];[h]anullsink;[v][w][r][p][s]vstack=inputs=5[vo];[x]anull[ao]" http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_6music.m3u8

Television spectrum bandwidth

At the height of analogue television, how much spectrum bandwidth was allocated to the magic rectangle?

Radio frequencies are precious natural resources. There are only so many to go around. Now, it is true that, in many cases, frequencies are reusable (e.g. a tv station in Glasgow can be on the same frequency as a transmitter in London, without causing mutual interference), but frequency bands are generally given over to one or two uses each.

So how much spectrum is taken up by one use: broadcast television to households? When I was younger, and we had only a few television channels, big programmes in the UK would routinely attract 17 million viewers, or thereabouts. One night in 1990, when I appeared on the popular consumer report programme “That’s Life” playing a telephone accompanied by the musically-talented Howard Leader on accordion, the figures that evening indicated that 11 million people tuned in to view. How much of that valuable radio-frequency spectrum did television occupy?

A simple answer is to add together the bandwidth taken up by the four bands used for television broadcasting in Europe, called Bands I, III, IV and V.

Their total bandwidth? 471MHz.

When I was younger, no radio frequency above 1GHz really mattered to the average consumer at home. So, until the advent of PCN mobile telephones in 1995, up at about 1.8GHz, the range of spectrum occupied by broadcast television was very nearly one half of all radio frequencies. Everything else, including all radio, ship-to-shore messages, radio amateurs, weather services, early cellphones, time signals, radio teleprinters, was in the other half.

With the advent of satellite broadcasting, the usable spectrum has expanded; but so has the use of television. All that precious bandwidth, used for entertainment, news and education? Still roughly half.

That’s either a disappointment, or a great responsibility.

HTTP Redirects in PHP

Here’s a really quick and simple example of an HTTP redirect using PHP.

The British Geological Survey publishes live data from its seismographs, located in many parts of the UK. The URL for the latest data changes daily, and is derived from the calendar. So it’s easy to reconstruct the URL. But I’d like to access the current day’s data for my local area from an unchanging, static URL.

Therefore, the static URL needs to create an HTTP redirect to the current day’s data from the location I want to use, my local seismograph at the former Royal Observatory at Herstmonceaux, Sussex. Here is the code to do that. The method ought to be self-explanatory. To be precise, this code causes the Apache webserver to instruct a client (your web browser) to follow a 302 Redirect.

You can give this page of PHP any name you like. My URL is http://johnwarburton.net/did-the-earth-move.php

$DIRECTORY = "http://www.earthquakes.bgs.ac.uk/helicorder/heli_dir_shz/";
$PREFIX    = "HMNX_SHZ_GB_00.";
$timestamp = date("Ymd");
$SUFFIX    = "00.gif";

$redirectUrl = $DIRECTORY.$PREFIX.$timestamp.$SUFFIX;

header("Location: ".$redirectUrl);
exit;

FFmpeg, SoX, x265, x264, GraphicsMagick, etc., Win64 binary installer

I have upgraded my binary distribution of open source multimedia utilities to include a proper installer, not just an archive. This distribution is for Windows 64 bit only, and is tested on Windows 10.

MultimediaTools-mingw-w64-Open-source.exe

These are usually very recent compilations of best-in-class open source programs for multimedia conversion, manipulation and exchange. Within this bundle are extremely full versions of: FFmpeg, SoX, x265, x264, x262, the Fraunhofer AAC encoder (including HE-AAC and HE-AAC2), the mpv player, LAME, GraphicsMagick, MP4Box, DCP-o-matic and many others. Many of these are world-standard programs, very actively maintained, and in constant use by broadcasters and multi-media companies on every continent.

These are all open source and free (as in both beer and speech), so you are welcome to download and use them, and much else beside, without any consideration beyond obeying the legal licences accompanying them. The licence usually forbids you from withholding the source code if you modify anything, and this is a very important rule that you must obey. If you just use the binary programs, you need probably not worry about anything else.

The source code for my compilation is available from GitHub, and the README file is fairly up-to-date. It contains information about other packages you will need to make some of these run (a Perl and a Python interpreter, for example).

GitHub source: https://github.com/Warblefly/MultimediaTools-mingw-w64

README: https://github.com/Warblefly/MultimediaTools-mingw-w64#readme

Binary distribution (download and run this installer): http://gallery.johnwarburton.net/MultimediaTools-mingw-w64-Open-source.exe

Prevent Samsung TV or Monitor from dimming

Some Samsung monitors automatically dim the backlight when the displayed video falls below a certain brightness. For professional editing, this is a nuisance. Here’s how to prevent it, at least on the C570 series e.g. T28C570

In picture settings, find “Movie” mode. This stops the dimming. Then, you must recalibrate your monitor’s saturations, contrast, brightness, sharpness, etc., as before.

My settings, for an HDMI input from an Intel HD560 graphics chipset, are:

Backlight
20
Contrast
95
Brightness
45
Sharpness
0
Colour
45

Also, turn off anything to do with “dynamic”, noise reduction, enhanced contrast, etc.