Sound Bytes

A coding competition


Project maintained by coding-competitions Hosted on GitHub Pages — Theme by mattgraham

Early Draft of the 5th

by gpersell

Listen

An imagined early draft of something like Beethoven’s 5th symphony.

Program.cs


using System;
using System.IO;
using System.Linq;
namespace gpersell_fur_elise
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var b = new BinaryWriter(Console.OpenStandardOutput()))
            {for (int t=0;t<41000*30;t++) {b.Write((ushort)Enumerable.Range(1,8).Sum(i=>8e3/i/i*Math.Sin(t*1.424e-4*Math.Pow(2,(new[]{4,4,4,1,1,1,1,1,3,3,3,0,0,0,0,0,4,4,4,1,8,8,8,4,13,13,13,8,8,8,8,8}[(int)Math.Abs((t/20000)%32)]-14)/12.0)*440*i)*(1-Math.Pow(2*(t/2e4%1)-1,4))));}}
        }
    }
}


Language

C# (console)

Golf Score

534

Parameters

Sample Rate: 41000 Hz
Sample Size: 16 bits
Channels: 1 (mono)
Encoding: unsigned-integer

Commands

Run

dotnet run

Spectrogram

Spectrogram