Blog

 

Trains (2013/EC/G): generator

trains_gen by Tibor 'Igor2' Palinkas on 2020-02-12

Tags: 2013, ec, 2013ec, generator, sound, signal

node source

 

 

Abstract: n/a

 

Datasheet

Task Trains
When 2013 EC G
Description html
Input pack zip

Generator

Trains was a 2013 EC task G. It was a signal processing problem on sound.

To make sure we got the reference solutions right, we had to generate the input (instead of e.g. recording real trains). The generator is a small C program that can mix raw audio samples according to a very simple script read on stdin: what sound effect to add when. Plus it could pick an alternative sound sample for the same thing randomly and add noise.

The next layer, more closely connected to the actual task of train sounds is an shell+awk script that reads a train file and renders the mixer script then runs the mixer and converts the raw output to wav.

A train script (*.train in the tarball) sets up the environment (background noises mostly) and lists trains passing with the specified speed, wagon by wagon. Wagon geometry is specified in UDoW.txt of the problem set zip. The awk script is working from that file directly to calculate when to render the clicks for the wheels.

We tried to prepare task input files so that the first file could be solved by hand (for example by looking at a wav editor and counting peaks in this case). But then input files gradually got harder and harder to solve; a few files usually could be solved with a simple, brute-force solver but input 10 had to be real long and noisy. The first few files feature trains of the same speed but from input 5 there are different speeds per file.

The hard part of the task is signal processing. Once the exact time offsets for the clicks are extracted, figuring wagon geometry can be done with a simple backtracking. In theory one could sit down and extract clicks on all 10 input by hand. We designed the input files considering that. The length and nosiness of the files would cost so much time that it would not worth it over tuning a simple, naive, low-pass filter based signal processor.

All sound samples are free ( source and license ).

The generator is Copyright (C) 2013 Tibor 'Igor2' Palinkas and is licensed under the GNU GPL version 2.