Generate ABC

Generate the open-source ABC format in C for MIDI music.

Generate music files.

Date Created:Thursday May 10th, 2007 10:47 PM
Date Modified:Sunday August 03rd, 2008 12:37 PM

#include <stdio.h>
#include "music.h"

int main()

    srand time(NULL) );
    return 0;

* Author: Dan Lynch

void m_header(){

void m_key(char x) {

void m_length(char x) {

void m_title(char x) {

void m_metre(int nint d) {

void m_id(int n) {

void m_scale() {
    char scale="ABCDEFG";
    int i;
    int note;
    int length;
    for ( 0100i++ ) {
        if (i==0printf("|(");
        if (i%4==&& i!=&& i%16!=printf(")|(");
        if (i%16==0&&i!=0printf("\n|(");
        note rand()%7;
        if (i>7) {note+=4;note=note%7;}
        if (i>15) {note+=6;note=note%7;}
        if (i>23) {note+=5;note=note%7;}
        if (i>31) {note+=3;note=note%7;}

        length rand()%8+1;
        printf("[%c,%d%c,%d%c,%d]"scale[note], lengthscale[(note+2)%7], lengthscale[(note+4)%7], length );

Download: generate.c 125 B
Download: music.h 933 B

Please login or Click Here to register for downloads
Creative Commons License
Generate ABC by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at
Permissions beyond the scope of this license may be available at