File:ParsonsCode-Ode to Joy.png

ParsonsCode-Ode_to_Joy.png(286 × 243 pixels, file size: 5 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

edit
Description
English: 'Ode to Joy' melodic contour (Parsons code) (+schema)
Français : Contour mélodique de l'Hymne à la joie (code Parsons)
Date
Source Own work
Author Xofc
This text image could be re-created using vector graphics as an SVG file. This has several advantages; see Commons:Media for cleanup for more information. If an SVG form of this image is available, please upload it and afterwards replace this template with {{vector version available|new image name}}.


It is recommended to name the SVG file “ParsonsCode-Ode to Joy.svg”—then the template Vector version available (or Vva) does not need the new image name parameter.

Licensing

edit
I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Source code

edit
Parsons$ ./contour *RUURDDDDRUURDR

        *-*                    
       /   \                  
      *     *                  
     /       \                
  *-*         *         *-*    
               \       /   \  
                *     *     *-*
                 \   /        
                  *-*          
                              

Parsons$ 

The contour has been generated by this 'C' program :

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#define MAXLEN 20
void usage(char *str)
	{
	fprintf(stderr, "%s\n", str);
	exit(-1);
	}
main(int argc, char *argv[])
	{
	int	i;
	int	x, y;
	int	level, max_level, min_level;
	int	level_tab[MAXLEN];
	int	code_len;

	if (argc != 2)
		usage("nombre d'arguments invalide");
	if (argv[1][0] != '*')
		usage("mauvais code initial");
	if ((code_len = strlen(argv[1])) > MAXLEN)
		usage("code trop long");
	/*
	** minimax
	*/
	max_level = min_level = level = 0;
	level_tab[0] = 0;
	for (i = 1; argv[1][i]; i++)
		{
		switch (argv[1][i])
			{
			case 'u': case 'U':
				level += 1;
				if (level > max_level)
					max_level = level;
				break;

			case 'd': case 'D':
				level -= 1;
				if (level < min_level)
					min_level = level;
				break;

			case 'r': case 'R':
				break;

			default:
				usage("mauvais code");
				break;
			}
		level_tab[i] = level;
		}
	printf("\n");
	for (y = max_level; y >= min_level; y--)
		{
		if (y == 0)
			printf("  *");
		else	printf("   ");
		for (x = 1; x < code_len; x++)
			{
			if (level_tab[x] == y)
				{
				if (level_tab[x-1] == level_tab[x])
					printf("-*");
				else	printf(" *");
				}
			else	printf("  ");
			}
		printf("\n  ");
		for (x = 1; x < code_len; x++)
			{
			if (level_tab[x] == y)
				{
				if (level_tab[x-1] < y)
					printf(" /");
				else	printf("  ");
				}
			else if (level_tab[x-1] == y && level_tab[x] < y)
				{
				printf(" \\");
				}
			else	printf("  ");
			}
		printf("\n");
		}
	printf("\n");
	}

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current06:49, 16 May 2011Thumbnail for version as of 06:49, 16 May 2011286 × 243 (5 KB)Xofc (talk | contribs){{Information |Description ={{en|1='Ode to Joy' melodic contour (Parsons code) (+schema)}} {{fr|1=Contour mélodique de l'Hymne à la joie (code Parsons)}} |Source ={{own}} |Author =Xofc |Date =2011-05-45 |Permis

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file: