Files
ioccc/2011/vik
Landon Curt Noll 2b92c89be8 fix and improve links within the web site
Entry source is now prog.c for IOCCC years 2014 thru 2020,
or is now dirname.c IOCCC years 1984 thru 2013.

To achieve this state, we renamed the following:

renamed:    2004/hibachi/src/hibachi.c -> 2004/hibachi/hibachi.c
renamed:    2012/omoikane/nyaruko.alt.c -> 2012/omoikane/omoikane.alt.c
renamed:    2012/omoikane/nyaruko.alt2.c -> 2012/omoikane/omoikane.alt2.c
renamed:    2012/omoikane/nyaruko.c -> 2012/omoikane/omoikane.c
renamed:    2012/omoikane/nyaruko.orig.c -> 2012/omoikane/omoikane.orig.c

Modified `bin/subst.entry-index.sh` to add to entry `index.html` file,
links to the `Makefile` and the _C code_ to the top navigation bar.
Changed `bin/subst.entry-index.sh` VERSION from "1.2.2 2024-02-25"
to "1.3 2024-03-02".

Moved printing the Inventory link in the top navigation bar
from `bin/subst.entry-navbar.awk` to `bin/subst.entry-index.sh`.
Changed `bin/subst.entry-navbar.awk` VERSION from "1.0.1 2024-02-23"
to "1.1 2024-03-02".

Moved printing the Inventory link in the top navigation bar
from `bin/subst.year-navbar.awk` to `bin/subst.year-index.sh`.
Changed `bin/subst.year-index.sh` VERSION from "1.0 2024-02-11"
to "1.1 2024-03-02".
Changed `bin/subst.year-navbar.awk` VERSION from "1.0 2024-02-11"
to "1.1 2024-03-02".

Added location names (both default and common) to `author.html`.
Changed `tmp/gen_author_json.sh` VERSION from "1.0 2023-06-06"
to "1.1 2024-03-04".

Added location names (both default and common) to `author.html`.
Changed `bin/gen-authors.sh` VERSION from "1.2 2024-03-09"
to "1.3 2024-03-04".

The manifest and the resulting `.entry.json` files have been changed
for `2004/hibachi` and `2012/omoikane`.

The Makefiles for  `2004/hibachi` and `2012/omoikane` copy the
source file into the "previously used location".  The `make clobber`
rule removes the copied source.  The `.gitignore` files have been
updated accordingly.

Improved how the concept of IOCCC terms _entry_, _author_ and _submission_ are
used in markdown files.

Links to markdown files (files ending in .md) within the repo were
changed to link to HTML files (files ending in .html).  Special cases
where `README.md` became `index.html` were modified accordingly.

Fixed URL for `bugs.html` in Makefile comments.

Fixed name of `bin/sgi.sh` referenced in comments in `.gitignore` files.

Links to locations within the repo are now relative.  For example a
link to `/contact.html` may become `../contact.html' or '../../contact.html`
depending on the directory level of the markdown file.

Nearly all links with absolute URLs under _https://www.ioccc.org_
or `https://ioccc-src.github.io/temp-test-ioccc_ have been changed to
relative paths within the repo.  Some exceptions to this (such as
referring to a GitHub repo) were preserved.

Fixed a number of inside `faq.md` and `bugs.md`.

Added HTML name tags (in the form of an _entry_id_) for each entry
referenced in `bugs.md`.  Fixed links from outside of `bugs.html`
into `bugs.html` accordingly.

Where FAQ entries are referenced, a named tag is used so that if a
FAQ is ever renumbered, links outside of `faq.html` will still work.

Changed the _inventory_order_ of a compressed tarball from _300_
to _100000_.  While this may have been done for the manifest,
this changed had not yet been propagated into the `.entry.json` files.

Links to web sites that were in the for <URL> are now [URL](URL).

Performed `name www` to process all of the above.

Improved format of `authors.html`.  Full names are now bold.
Location codes are now links back into `location.html` and
location names (both default and common) are now italics.
Added _author_handle_ each author.

Changed `bin/gen-authors.sh` VERSION from "1.1 2024-02-25"
to "1.2 2024-03-09".

Improved format of `location.html` as location codes are now bold,
author counts in a given location are now bold, and location names
(both default and common) are now italics.

Changed `bin/gen-location.sh` VERSION from "1.0.1 2024-02-23"
to "1.1 2024-03-04".

Added italic location name after location code in entry
`index.html` files.

Changed `bin/output-index-author.sh` VERSION from "1.4.1 2024-02-23"
to "1.5 2024-03-04".

Added _Location of authors_ to the sidebar as a link to `location.html`.

TODO: While nearly all of the above mentioned changes are likely correct,
      they likely introduced a few errors that need correcting.
2024-03-04 23:45:28 -08:00
..
2024-02-27 23:21:32 -08:00
2020-12-30 16:57:03 -08:00
2020-12-30 16:57:03 -08:00
2020-12-30 16:57:03 -08:00
2023-07-06 21:49:38 -07:00

To build:

make

There is an alternate version that should work for Windows. See alternate code below.

Bugs and (Mis)features:

The current status of this entry is:

STATUS: INABIAF - please **DO NOT** fix

For more detailed information see 2011 vik bugs.

To use:

./vik file.mod > audio_file.raw

If you have mplayer(1):

./vik file.mod | mplayer -demuxer rawaudio -

Alternatively, you can convert the file to a WAV:

./vik file.mod > file.raw; ./raw2wav file.raw > file.wav

and then play file.wav with a program that can play WAV files.

Try:

./try.sh

The script checks that you have mplayer(1) installed and if it is it will pipe vik to mplayer. In this case it will also use raw2wav to convert the file to a WAV file. If mplayer(1) cannot be found it will just use raw2wav. This way even if one has an mplayer(1) that fails or is for some reason not what is expected they can at least play the WAV file manually.

It is also possible to download a number of music module files from The Mod Archive.

Alternate code:

This version is based on the author's remarks and it should work for Windows.

Alternate build:

Assuming that make is similar enough try:

make alt

Alternate use:

Use vik.alt as you would vik above.

Judges' remarks:

This entry converts .MOD audio files to a playable stream in a most pleasing manner if you don't like tremolo or vibrato.

Also it abuses the C compiler and/or assembler with a partially initialized 32MB array. Can you tell what that partial initialization for?

Does it take your system a long time to compile? You may want to do:

cc -S vik.c

and examine the resulting assembly file vik.s. On some platforms the assembly file is about 128MB in size!

NOTE: The randowan.mod and mad_world.mod files were created by Henrik Bertilsson and are included with his permission.

Author's remarks:

Introduction

In 1987, Karsten Obarski changed the way music was handled in games and demos with the introduction of the MOD file format on Commodore Amiga

A MOD file contains a set of samples, a number of patterns indicating how and when the samples are to be played, a list of what patterns to play in what order, and a number of effects.

Features

This program converts MOD files created with the standard trackers for Amiga, e.g. Pro Tracker, Noise Tracker and Sound Tracker to raw 16 bit 44.1kHz stereo audio. The program supports MOD music with 4, 6, and 8 channels MOD files with up to 31 samples.

The MOD format includes many effects for each audio channel and this program supports most of them, including:

  • Arpeggio
  • Slide and fine slide up/down/to note
  • Set sample offset
  • Volume slide
  • Pattern break
  • Filter on/off
  • Set volume
  • Cut sample
  • Delay sample
  • Delay pattern
  • Set speed

Due to size constraints tremolo and vibrato is not supported. Also, to avoid infinite long songs, the position jump feature is ignored.

Songs

With his permission, the package includes two songs composed by Henrik Bertilsson, also known as Deelite:

  1. Mad World
  2. Randowan

Build

Compiling for Unix systems (including cygwin) is straight forward:

gcc -o vik vik.c

Usage

Convert MOD file to raw 44.1kHz stereo audio file

./vik mad_world.mod > audio_file.raw

Listen to the MOD file (streaming to mplayer)

./vik randowan.mod | mplayer -demuxer rawaudio -

(Don't forget the last - as it makes mplayer read from stdin.)

Obfuscation

The IOCCC rules did not put a limit on the entropy of the source code, and it appears that the general entropy rules don't apply. An estimate is that the code density entropy of this entry is ~1.2 which means that there are around 2500 characters of code carrying information, yet there are only 2037 IOCCC characters of actual code. Most of the additional characters are encoded with non-counting characters in the frequency table. But there are also ~50 or so white space characters spread out through the source code that carry information.

The use of macros certainly adds to the obfuscation but the reason for using them is mainly to fit as many features as possible within the size limits. So please excuse the use of them.

Once the preprocessor is run, the code gets more interesting. The MOD player is basically a register based state machine and all the magic is hidden in a fog of short statements. Many of the register updates are conditional and the program uses the ?: operator (sigh) mainly to save space, but also to leverage the comma operator and precedence more efficiently.

Portability

The program is portable to most platforms. The only system dependency is that the program relies on writing binary data to stdout.

Microsoft compilers adds a carriage return to newlines, and to compile the program with this platform, the following line can be added after the main declaration in order for the program to run correctly:

_setmode(_fileno(stdout), 0x8000);

NOTE: this is what the alternate version is for.

Limitations

The program only runs when a valid MOD file is passed as argument. If no argument is passed, the program crashes.

This file is Copyright (c) 2023 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/