Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post code that plays a Christmas tune [closed]

Tags:

audio

playback

Is there a way to play a Christmas tune on a PC or Mac without having a pre-recorded sound file? (No .mp3 or .wav or whatever-sound file)

I remember on my TI 99/4A and Apple II sounds (resembling music) could be played. Not sure if modern computers have these abilities (aside from beep).

like image 220
user21826 Avatar asked Dec 24 '08 20:12

user21826


1 Answers

"Jingle Bells" in java (bloated as usual), using JFugue, with tubular bells and xylophones (polyphonic!):

import org.jfugue.*;

public class JingleBells
{
    public static void main(String[] args)
    {
        Player player = new Player();
        player.play("T170 "+
                    "     V0 I[XYLOPHONE] C4q C4q C3h C4q C4q C3h C3q B3q A3q G3q C4h "+
                    "     V1 I[TUBULAR_BELLS] E5q E5q E5h E5q E5q E5h E5q G5q C5q D5q Eqh "+
                    "     V2 I[XYLOPHONE] G3h     G2q G3q G3h     G3h");
    }
}
like image 121
friol Avatar answered Sep 30 '22 18:09

friol