The navigation bar for a winning entry now has a "_Original C_" link
(between the ✅ and the Inventory on the right hand side) so that one
may easily view the original C code that was submitted for IOCCC judging.
Ran `make www timestamp` to perform the above.
783 lines
32 KiB
HTML
783 lines
32 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||
<!-- START: two lines up starts content from: inc/top.default.html -->
|
||
|
||
<!-- END: this line ends content from: inc/top.default.html -->
|
||
<!-- START: this line starts content from: inc/head.default.html -->
|
||
|
||
<head>
|
||
<link rel="stylesheet" href="../../ioccc.css">
|
||
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap" rel="stylesheet">
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||
<title>2019/giles - Most in need of wide space</title>
|
||
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
|
||
<meta name="description" content="2019 IOCCC entry giles - Most in need of wide space">
|
||
<meta name="keywords" content="IOCCC, 2019, IOCCC 2019, IOCCC entry, giles, Most in need of wide space">
|
||
</head>
|
||
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
|
||
<!-- END: this line ends content from: inc/head.default.html -->
|
||
|
||
<!-- -->
|
||
<!-- This web page was formed via the tool: bin/readme2index.sh -->
|
||
<!-- The content of main section of this web page came from: 2019/giles/README.md -->
|
||
<!-- -->
|
||
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 2019/giles/README.md !!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 2019/giles/README.md !!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 2019/giles/README.md !!! -->
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
|
||
<!-- Markdown content was converted into HTML via the tool: bin/md2html.sh -->
|
||
|
||
<!-- START: this line starts content from: inc/body.default.html -->
|
||
|
||
<body>
|
||
|
||
<!-- END: this line ends content from: inc/body.default.html -->
|
||
<!-- START: this line starts content from: inc/topbar.default.html -->
|
||
|
||
<div class="theader">
|
||
<nav class="topbar">
|
||
<div class="container">
|
||
<div class="logo">
|
||
<a href="../../index.html" class="logo-link">
|
||
IOCCC
|
||
</a>
|
||
</div>
|
||
|
||
<div class="topbar-items">
|
||
<div class="item">
|
||
<span class="item-header">
|
||
Entries
|
||
</span>
|
||
|
||
<div class="sub-item">
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../years.html" class="sub-item-link">
|
||
Winning entries
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../authors.html" class="sub-item-link">
|
||
Winning authors
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../location.html" class="sub-item-link">
|
||
Location of authors
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../bugs.html" class="sub-item-link">
|
||
Bugs and (mis)features
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html#fix_an_entry" class="sub-item-link">
|
||
Fixing entries
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html#fix_author" class="sub-item-link">
|
||
Updating author info
|
||
</a>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="item">
|
||
<span class="item-header">
|
||
Status
|
||
</span>
|
||
|
||
<div class="sub-item">
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../news.html" class="sub-item-link">
|
||
News
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../status.html" class="sub-item-link">
|
||
Contest status
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../next/rules.html" class="sub-item-link">
|
||
IOCCC rules
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../next/guidelines.html" class="sub-item-link">
|
||
IOCCC guidelines
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../markdown.html" class="sub-item-link">
|
||
Markdown guidelines
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../SECURITY.html" class="sub-item-link">
|
||
Security policy
|
||
</a>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="item">
|
||
<span class="item-header">
|
||
FAQ
|
||
</span>
|
||
|
||
<div class="sub-item">
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html" class="sub-item-link">
|
||
Frequently asked questions
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../quick-start.html#enter" class="sub-item-link">
|
||
Enter the IOCCC
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html#compiling" class="sub-item-link">
|
||
Compiling entries
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html#running_entries" class="sub-item-link">
|
||
Running entries
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html#help" class="sub-item-link">
|
||
How to help
|
||
</a>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="item">
|
||
<span class="item-header">
|
||
About
|
||
</span>
|
||
|
||
<div class="sub-item">
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../index.html" class="sub-item-link">
|
||
Home page
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../social.html" class="sub-item-link">
|
||
IOCCC social media
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../about.html" class="sub-item-link">
|
||
About the IOCCC
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../judges.html" class="sub-item-link">
|
||
The judges
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../thanks-for-help.html" class="sub-item-link">
|
||
Thanks for the help
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../contact.html" class="sub-item-link">
|
||
Contact us
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
|
||
<div class="header-mobile-menu">
|
||
<noscript>
|
||
<a href="../../nojs-menu.html" class="topbar-js-label">
|
||
Please Enable JavaScript
|
||
</a>
|
||
</noscript>
|
||
|
||
<button id="header-open-menu-button" class="topbar-mobile-menu">
|
||
<img
|
||
src="../../png/hamburger-icon-open.png"
|
||
alt="hamburger style menu icon - open state"
|
||
width=48
|
||
height=48>
|
||
</button>
|
||
|
||
<button id="header-close-menu-button" class="hide-content">
|
||
<img
|
||
src="../../png/hamburger-icon-closed.png"
|
||
alt="hamburger style menu icon - closed state"
|
||
width=48
|
||
height=48>
|
||
</button>
|
||
|
||
<div id="mobile-menu-panel" class="hide-content">
|
||
<div class="mobile-menu-container">
|
||
|
||
<div class="mobile-menu-wrapper">
|
||
<div class="mobile-menu-item">
|
||
Entries
|
||
</div>
|
||
<div class="mobile-submenu-wrapper">
|
||
|
||
<a class="mobile-submenu-item" href="../../years.html">
|
||
Winning entries
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../authors.html">
|
||
Winning authors
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../location.html">
|
||
Location of authors
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../bugs.html">
|
||
Bugs and (mis)features
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html#fix_an_entry">
|
||
Fixing entries
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html#fix_author">
|
||
Updating author info
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../thanks-for-help.html">
|
||
Thanks for the help
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mobile-menu-wrapper">
|
||
|
||
<div class="mobile-menu-item">
|
||
Status
|
||
</div>
|
||
<div class="mobile-submenu-wrapper">
|
||
|
||
<a class="mobile-submenu-item" href="../../news.html">
|
||
News
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../status.html">
|
||
Contest status
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../next/rules.html">
|
||
IOCCC rules
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../next/guidelines.html">
|
||
IOCCC guidelines
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../markdown.html">
|
||
Markdown guidelines
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../SECURITY.html">
|
||
Security policy
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mobile-menu-wrapper">
|
||
<div class="mobile-menu-item">
|
||
FAQ
|
||
</div>
|
||
<div class="mobile-submenu-wrapper">
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html">
|
||
Frequently asked questions
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../quick-start.html#enter">
|
||
Enter the IOCCC
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html#compiling">
|
||
Compiling entries
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html#running_entries">
|
||
Running entries
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html#help">
|
||
How to help
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mobile-menu-wrapper">
|
||
<div class="mobile-menu-item">
|
||
About
|
||
</div>
|
||
<div class="mobile-submenu-wrapper">
|
||
|
||
<a class="mobile-submenu-item" href="../../index.html">
|
||
Home page
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../social.html">
|
||
IOCCC social media
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../about.html">
|
||
About the IOCCC
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../judges.html">
|
||
The judges
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../contact.html">
|
||
Contact us
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<script>
|
||
var headerOpenMenuButton = document.getElementById("header-open-menu-button");
|
||
var headerCloseMenuButton = document.getElementById("header-close-menu-button");
|
||
var mobileMenuPanel = document.getElementById("mobile-menu-panel");
|
||
|
||
headerOpenMenuButton.addEventListener("click", () => {
|
||
headerOpenMenuButton.classList.remove("topbar-mobile-menu");
|
||
headerOpenMenuButton.classList.add("hide-content");
|
||
|
||
headerCloseMenuButton.classList.remove("hide-content");
|
||
headerCloseMenuButton.classList.add("topbar-mobile-menu");
|
||
|
||
mobileMenuPanel.classList.remove("hide-content");
|
||
mobileMenuPanel.classList.add("topbar-mobile-panel");
|
||
});
|
||
|
||
headerCloseMenuButton.addEventListener("click", () => {
|
||
headerCloseMenuButton.classList.remove("topbar-mobile-menu");
|
||
headerCloseMenuButton.classList.add("hide-content");
|
||
|
||
mobileMenuPanel.classList.add("hide-content");
|
||
mobileMenuPanel.classList.remove("topbar-mobile-panel");
|
||
|
||
headerOpenMenuButton.classList.add("topbar-mobile-menu");
|
||
headerOpenMenuButton.classList.remove("hide-content");
|
||
});
|
||
</script>
|
||
|
||
<!-- END: this line ends content from: inc/topbar.default.html -->
|
||
<!-- START: this line starts content from: inc/header.default.html -->
|
||
|
||
<div class="header">
|
||
<a href="../../2011/zucker/index.html">
|
||
<img src="../../png/ioccc.png"
|
||
alt="IOCCC image by Matt Zucker"
|
||
width=300
|
||
height=110>
|
||
</a>
|
||
<h1>The International Obfuscated C Code Contest</h1>
|
||
<h2>2019/giles - Most in need of wide space</h2>
|
||
<h3>WAV reverberator</h3>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/header.default.html -->
|
||
<!-- START: this line starts content from: inc/navbar.mid.html -->
|
||
|
||
<div class="navbar">
|
||
<a class="Left" href="../endoh/index.html">← 2019/endoh</a>
|
||
<a class="Left" href="../index.html">↑ 2019 ↑</a>
|
||
<a class="Left" href="../karns/index.html">2019/karns →</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2019/giles/prog.c">C code</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2019/giles/Makefile">Makefile</a>
|
||
<a class="Right" href="#inventory">Inventory</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2019/giles/prog.orig.c">Original C</a>
|
||
<a class="Right" href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F2019%2Fgiles%2Findex.html">✓</a>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/navbar.mid.html -->
|
||
<!-- START: this line starts content from: inc/before-content.default.html -->
|
||
|
||
<div class="content" id="content">
|
||
|
||
<!-- END: this line ends content from: inc/before-content.default.html -->
|
||
<!-- START: this line starts content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
|
||
|
||
<!-- START: this line starts content generated by: bin/output-index-author.sh -->
|
||
|
||
<h2 id="author">Author:</h2>
|
||
<ul>
|
||
<li>Name: <a href="../../authors.html#Edward_Giles">Edward Giles</a><br>
|
||
Location: <a href="../../location.html#AU">AU</a> - <em>Commonwealth of Australia</em> (<em>Australia</em>)</li>
|
||
</ul>
|
||
|
||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||
|
||
<!-- END: this line ends content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
|
||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||
|
||
<!-- BEFORE: 1st line of markdown file: 2019/giles/README.md -->
|
||
<h2 id="to-build">To build:</h2>
|
||
<pre><code> make</code></pre>
|
||
<h2 id="to-use">To use:</h2>
|
||
<pre><code> ./prog infile.wav outfile.wav</code></pre>
|
||
<h2 id="try">Try:</h2>
|
||
<pre><code> ./try.sh</code></pre>
|
||
<p><strong>NOTE</strong>: <code>play</code>, which <a href="https://github.com/ioccc-src/winner/blob/master/2019/giles/try.sh">try.sh</a> uses, comes from SoX, the Swiss Army Knife
|
||
of sound processing programs. If you don’t have this installed, see the
|
||
FAQ on “<a href="../../faq.html#sox">SDL1 and SDL2</a>”.</p>
|
||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||
<p>Do you need to pretend enjoying a more spacious living environment than you
|
||
actually are in, or the great outdoors with mountains and canyons, when
|
||
recording your outgoing voicemail message? Then don’t waste another minute!
|
||
Record yourself, send the audio file through this entry, and let your callers be
|
||
surprised.</p>
|
||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||
<h3 id="description">Description:</h3>
|
||
<p>This program takes a WAV audio file as input, and applies an artificial
|
||
reverberation effect to it. It works by feeding the audio through a number of
|
||
delay lines of various lengths, with various amounts of feedback, to create a
|
||
smooth echo that fades away over time. A number of parameters of the effect can
|
||
be altered, to change its sonic characteristics.</p>
|
||
<p><a href="BlockDiagram.png">BlockDiagram.png</a> is a block-diagram of the internal
|
||
structure of the reverb algorithm, which is most likely easier to understand
|
||
than the source code.</p>
|
||
<p><a href="MonodyVocals.wav">MonodyVocals.wav</a> is for testing the program: It is an
|
||
extract of the unprocessed vocals from <a href="https://www.youtube.com/watch?v=B7xai5u_tnk">Monody by TheFatRat, featuring Laura
|
||
Brehm</a>. The track was published
|
||
under a free license.</p>
|
||
<p>This program has also been successfully compiled on Windows, with both the <a href="https://bellard.org/tcc/">Tiny
|
||
C Compiler</a> and Microsoft’s C/C++ compiler. However,
|
||
the latter reports warnings about loss of information when converting <code>float</code>s,
|
||
and that <code>void (*)()</code> and <code>void (*)(void)</code> are not the same thing.</p>
|
||
<p>Interesting fact: The size of the program from <code>./iocccsize -i</code> is 2019.</p>
|
||
<h4 id="how-to-use">How to use:</h4>
|
||
<pre><code> ./prog input [output [size [dry [wet [damping]]]]]
|
||
prog.exe input [output [size [dry [wet [damping]]]]]</code></pre>
|
||
<ul>
|
||
<li><code>input</code>: The path to the input file. Required.</li>
|
||
<li><code>output</code>: The path to the output file. Optional, defaults to <code>out.wav</code>.</li>
|
||
<li><code>size</code>: The perceived size of the room, i.e. the approximate amount of time
|
||
taken for the echo to fade away. Optional, default 1.6 seconds.</li>
|
||
<li><code>dry</code>: The amount of unprocessed signal (“dry” in audio terminology) to add to
|
||
the output. Optional, default 0.3 or 30%.</li>
|
||
<li><code>wet</code>: The amount of processed (“wet”) signal to add to the output. Optional,
|
||
default 0.5 or 50%.</li>
|
||
<li><code>damping</code>: The amount by which high frequencies are damped out as the echo
|
||
continues. This models the tendency for higher frequencies to be absorbed more
|
||
than lower ones. Increasing this value causes the echo to be less “harsh” and
|
||
more “muffled”. Optional, default 0.06 or 6%.</li>
|
||
</ul>
|
||
<p>The values <code>size</code>, <code>dry</code>, <code>wet</code>, and <code>damping</code> can be specified either as
|
||
decimal numbers (e.g. 0.35) or as percentages (e.g. 35%).</p>
|
||
<p>The default settings are designed to make the effect obvious rather than subtle,
|
||
so it may be a good idea to adjust the ratio of “dry” to “wet”, to give a more
|
||
pleasant result:</p>
|
||
<pre><code> ./prog in.wav out.wav 1.8 80% 15%</code></pre>
|
||
<p>The program only supports WAV files, and only mostly. Other audio formats, such
|
||
as MP3, are not supported because they are difficult to decode, but there are
|
||
free programs such as <code>ffmpeg</code> that can perform the conversion. Some of the
|
||
advanced features of the WAV file format are also not supported, such as
|
||
metadata, 3 or more channels, or a bit depth other than 16 bits. Fortunately,
|
||
WAV files that don’t use these features are very common. The program validates
|
||
the input file, so passing it a file it can’t process will cause the program to
|
||
print <code>Bad input file</code> or <code>Wave file must be 16 bits,1-2 channels.</code> depending on
|
||
what it thinks the problem is. If the output file cannot be opened, the program
|
||
will print <code>Can't open output file</code>.</p>
|
||
<h3 id="assumptions">Assumptions:</h3>
|
||
<ol type="1">
|
||
<li>The code is compiled using the C99 or C11 standard.</li>
|
||
<li>Values are stored in memory in little-endian order.</li>
|
||
<li><code>float</code> is a floating-point type of any size, such that all zero bits
|
||
represents the number zero.</li>
|
||
<li><code>int16_t</code> and <code>int32_t</code> are 2’s-complement, <code>sizeof(int16_t) == 2</code> and
|
||
<code>sizeof(int32_t) == 4</code>.</li>
|
||
</ol>
|
||
<h3 id="obfuscations">Obfuscations</h3>
|
||
<p>The main obfuscation is that digital signal processing algorithms are inherently
|
||
opaque. They just consist of iterating through a list of floating-point numbers
|
||
and performing a series of arithmetic operations on each value. Even if this
|
||
entry were entirely cleaned of all other obfuscation, it will appear to the
|
||
average programmer to do the following:</p>
|
||
<ul>
|
||
<li>Read and validate command-line arguments.</li>
|
||
<li>Read and validate the header portion of the input file, and print some errors
|
||
if that fails.</li>
|
||
<li>Write a modified form of that header into the output file.</li>
|
||
<li>Print the parameters read from the command-line arguments, in a human-readable
|
||
format.</li>
|
||
<li>Dynamically allocate some arrays of floating-point numbers, to be used later,
|
||
with lengths based on the <code>size</code> parameter.</li>
|
||
<li>Read 16-bit audio samples from the input file, converting them to
|
||
floating-point.</li>
|
||
<li>For each audio sample, do a weird combination of addition, subtraction, and
|
||
multiplication by constants, using the previously-allocated arrays to store
|
||
results between iterations. Write the resulting audio samples to the output
|
||
file, converting them back to 16-bit integers.</li>
|
||
<li>Close all of the file handles and free the memory.</li>
|
||
</ul>
|
||
<p>Note that no part of the above description of the code’s function had anything
|
||
to do with echoes in a room. The purpose of the code is therefore hidden.</p>
|
||
<p>The source code, on cursory inspection, appears to be a jumbled series of
|
||
characters arranged into three arcs, representing sound waves. The overall
|
||
layout distracts people from the fact that it is source code rather than only
|
||
ASCII art, and the random appearance of the code discourages people from trying
|
||
to decipher it.</p>
|
||
<p><code>#define</code>s are used to abbreviate the code, which has a side effect of making it
|
||
very slightly harder to read.</p>
|
||
<ul>
|
||
<li><code>k</code> is just a general-purpose replacement for <code>16</code>.</li>
|
||
<li><code>i</code> is the number of delay-lines to allocate and use (currently <code>24</code>).</li>
|
||
<li><code>q</code> is an abbreviation for multiplying two elements of <code>w[]</code> together.</li>
|
||
<li><code>u()</code> is used to display percentages with proper rounding.</li>
|
||
<li><code>j()</code> imposes an upper limit on a floating-point value, and then negates it.
|
||
This operation is used eight times.</li>
|
||
<li><code>D()</code> abbreviates a call to <code>setvbuf</code>, used to speed up file I/O.</li>
|
||
<li><code>l()</code> is used to clip audio samples to the acceptable range, and convert them
|
||
to 16-bit integers for output.</li>
|
||
<li><code>g()</code> handles errors.</li>
|
||
<li><code>C()</code> contains the bulk of the signal-processing code, as well as a
|
||
preprocessor obfuscation trick: If you were to read the body of the macro out of
|
||
context, it will appear to have multiple mismatched square brackets, since <code>[</code>
|
||
occurs more than <code>]</code>. However, this macro is always invoked with arguments such
|
||
as <code>C(v],+10)</code> which contain an unmatched <code>]</code> character. When the macro is used
|
||
in this manner, the extra <code>[</code>s in the macro’s body are matched with the <code>]</code>s
|
||
added through the first argument.</li>
|
||
</ul>
|
||
<p>Every variable name is one letter long. This allows the code to fit into the
|
||
IOCCC size limit, and it also makes the purpose of a given variable much less
|
||
clear. For example, it is not evident from the name of the variable <code>t</code> that it
|
||
contains pointers to the delay-line arrays.</p>
|
||
<p>As many values as possible have been crammed into arrays. <code>float w[]</code> contains:</p>
|
||
<ul>
|
||
<li>the input parameters (<code>w[0]</code> to <code>w[3]</code>)</li>
|
||
<li>various constants needed for the reverb algorithm (<code>w[4]</code> to <code>w[9]</code>)</li>
|
||
<li>temporary storage of floating-point audio samples (<code>w[10]</code> to <code>w[20]</code>)</li>
|
||
</ul>
|
||
<p><code>int32_t f[]</code> is even more multi-purpose. It contains:</p>
|
||
<ul>
|
||
<li>the header of the input file (<code>f[0]</code> to <code>f[11]</code>)</li>
|
||
<li>the number of channels in the input file (<code>f[12]</code>)</li>
|
||
<li>the number of samples of output to generate (<code>f[13]</code>)</li>
|
||
<li>an end-of-file flag (<code>f[14]</code>)</li>
|
||
<li>a variable that I forgot the exact purpose of (<code>f[15]</code>)</li>
|
||
<li>indices into the circular buffers where audio samples should be inserted
|
||
(<code>f[16]</code> to <code>f[39]</code>)</li>
|
||
<li>indices where audio samples should be read out (<code>f[40]</code> to <code>f[63]</code>)</li>
|
||
<li>lengths of the buffers (<code>f[64]</code> to <code>f[87]</code>)</li>
|
||
</ul>
|
||
<p>All of the strings are concatenated together and “encrypted” by breaking the
|
||
string into 4-byte chunks (by casting it to an <code>int32_t*</code>), and then XORing the
|
||
sequence of <code>int</code>s with a known numeric sequence. The “decryption” is not done
|
||
in-place, to avoid writing over the string constant.</p>
|
||
<p><code>int32_t *c</code> is a pointer that points into <code>f[]</code>, except that it is often
|
||
incremented or decremented when it is accessed. In order to determine which
|
||
indices of <code>f[]</code> are being accessed through <code>c</code> at any given point in the code,
|
||
you would have to locate the places where <code>c</code> is modified.</p>
|
||
<p>In order for this program to read and write WAV files, it needs to parse the
|
||
header. The necessary information, such as the sample rate and channel count, is
|
||
defined by the standard to be in somewhat arbitrary locations within the file.
|
||
Therefore, even if you know which indices of <code>f[]</code> are being accessed, it takes
|
||
extra effort to look up the WAV file format and determine which field that
|
||
corresponds to.</p>
|
||
<p>Some array accesses (which make up most of the program) have been replaced with
|
||
harder-to-interpret equivalents, for example:</p>
|
||
<ul>
|
||
<li><code>X[1]</code> -> <code>1[X]</code></li>
|
||
<li><code>f[14]</code> -> <code>10[f+4]</code></li>
|
||
<li><code>X[0]</code> -> <code>*X</code></li>
|
||
</ul>
|
||
<p>Assignments return the assigned value, allowing them to be included into later
|
||
expressions: <code>10[f]=f[13]<<2; f[1]=20+10[f]+k;</code> is replaced with
|
||
<code>f[1]=20+(10[f]=f[13]<<2)+k;</code>.</p>
|
||
<p>This technique is used in conjunction with the comma operator to further obscure
|
||
where the data ends up. For example:</p>
|
||
<ul>
|
||
<li><code>12[f]=4[++c]>>k;</code> was incorporated into <code>w[0]*=6[f];</code> to yield
|
||
<code>w[0]*=(12[f]=4[++c]>>k,6[f]);</code></li>
|
||
<li><code>w[15]=w[k]=e[12[f]]; w[11]=w[10]=e[1];</code> becomes
|
||
<code>w[11]=(w[15]=w[k]=e[12[f]],w[10]=e[1]);</code></li>
|
||
</ul>
|
||
<p>A few other miscellaneous obfuscations have also been done:</p>
|
||
<ul>
|
||
<li><code>while(++f[15]<12);</code> is used instead of <code>f[15]=12;</code></li>
|
||
<li><code>for(s=14[f]=0;s<f[13];s++)</code> is used instead of <code>f[14]=0; for(s=0;s<f[13];s++)</code></li>
|
||
<li>The line that contains <code>printf("Hello, world!");</code> is mostly commented out.</li>
|
||
</ul>
|
||
<!--
|
||
|
||
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
|
||
|
||
You are free to share and adapt this file under the terms of this license:
|
||
|
||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||
|
||
For more information, see:
|
||
|
||
https://creativecommons.org/licenses/by-sa/4.0/
|
||
|
||
-->
|
||
<!-- AFTER: last line of markdown file: 2019/giles/README.md -->
|
||
|
||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||
|
||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||
|
||
<div id="inventory">
|
||
<h1 id="inventory-for-2019giles">Inventory for 2019/giles</h1>
|
||
</div>
|
||
<h2 id="primary-files">Primary files</h2>
|
||
<ul>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/giles/prog.c">prog.c</a> - entry source code</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/giles/Makefile">Makefile</a> - entry Makefile</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/giles/prog.orig.c">prog.orig.c</a> - original source code</li>
|
||
<li><a href="BlockDiagram.png">BlockDiagram.png</a> - image of reverb algo block-diagram of internal structure</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/giles/try.sh">try.sh</a> - script to try entry</li>
|
||
<li><a href="MonodyVocals.wav">MonodyVocals.wav</a> - Monody WAV file by TheFatRat featuring Laura Brehm</li>
|
||
</ul>
|
||
<h2 id="secondary-files">Secondary files</h2>
|
||
<ul>
|
||
<li><a href="2019_giles.tar.bz2">2019_giles.tar.bz2</a> - download entry tarball</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/giles/README.md">README.md</a> - markdown source for this web page</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/giles/.entry.json">.entry.json</a> - entry summary and manifest in JSON</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/giles/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2019/giles/.path">.path</a> - directory path from top level directory</li>
|
||
<li><a href="index.html">index.html</a> - this web page</li>
|
||
</ul>
|
||
<hr style="width:10%;text-align:left;margin-left:0">
|
||
<h4>
|
||
Jump to: <a href="#">top</a>
|
||
</h4>
|
||
|
||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||
|
||
<!-- END: this line ends content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||
<!-- START: this line starts content from: inc/after-content.default.html -->
|
||
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/after-content.default.html -->
|
||
<!-- START: this line starts content from: inc/footer.inventory.html -->
|
||
|
||
<!--
|
||
|
||
Copyright © 1984-2025 by Landon Curt Noll. All Rights Reserved.
|
||
|
||
You are free to share and adapt this file under the terms of this license:
|
||
|
||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||
|
||
For more information, see:
|
||
|
||
https://creativecommons.org/licenses/by-sa/4.0/
|
||
|
||
-->
|
||
|
||
<div class="footer">
|
||
|
||
<div id="copyright"><h3>Copyright © 1984-2025 by Landon Curt Noll:
|
||
<a href="https://creativecommons.org/faq/#what-does-some-rights-reserved-mean"
|
||
target="_blank"
|
||
rel="license noopener noreferrer">Some Rights Reserved</a></h3>
|
||
<p>
|
||
This work is <b>licensed by Landon Curt Noll</b> under
|
||
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1"
|
||
target="_blank"
|
||
rel="license noopener noreferrer"
|
||
style="display:inline-block;">CC BY-SA 4.0</a></b>.
|
||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||
src="../../png/cc.png"
|
||
alt="cc inside circle symbol">
|
||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||
src="../../png/by.png"
|
||
alt="person inside circle symbol">
|
||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||
src="../../png/sa.png"
|
||
alt="arrow looping back on itself inside circle symbol"><br>
|
||
You should <b>carefully review</b> the
|
||
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode.en"
|
||
target="_blank"
|
||
rel="license noopener noreferrer">CC BY-SA 4.0 LEGAL CODE</a></b>
|
||
before using the licensed material.<br>
|
||
You may wish to review the
|
||
<b><a href="../../license.html"
|
||
target="_blank"
|
||
rel="license noopener noreferrer">highlights of some of the key features and terms</a></b>
|
||
of <b>CC BY-SA 4.0</b>.<br>
|
||
</p>
|
||
</div>
|
||
|
||
<div id="coda"><h3>Coda</h3>
|
||
<p>
|
||
<a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F2019%2Fgiles%2Findex.html" rel="nofollow">Nu HTML check this web page</a><br>
|
||
<a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a><br>
|
||
</p>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/footer.inventory.html -->
|
||
<!-- START: this line starts content from: inc/bottom.default.html -->
|
||
|
||
</body>
|
||
</html>
|
||
|
||
<!-- END: this line ends content from: inc/bottom.default.html -->
|