BBC BASIC
« The Sussex Carol »

Welcome Guest. Please Login or Register.
Jan 20th, 2018, 6:05pm


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: The Sussex Carol  (Read 136 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx The Sussex Carol
« Thread started on: Dec 17th, 2017, 09:34am »

Here's a seasonal offering from Ron Stickley: The Sussex Carol, transcribed for the old Z80 Music Program in 1983. The code will run in 'BBC BASIC for SDL 2.0' (on all platforms, including the experimental 64-bit version!) or in 'BBC BASIC for Windows' (including the trial version).

I don't think it's common to repeat the first verse, but Ron did so I've kept that feature in his memory. I'm so pleased that a reasonably complete archive of Ron's transcriptions has survived all this time.

Because of its length I have listed the source code in a separate message.



Richard.
« Last Edit: Dec 17th, 2017, 10:29am by Richard Russell » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx Re: The Sussex Carol
« Reply #1 on: Dec 17th, 2017, 09:34am »

Code:
REM The Sussex Carol, Traditional Lyrics and Melody.
REM Transcribed for Z80 Music by Ron J. Stickley 1983
REM BBC BASIC version by Richard Russell, 16-Dec-2017

IF INKEY$(-256) = "W" THEN
 INSTALL @lib$+"HQSOUND"
 PROC_hqinit
 *FONT Consolas,10
 PROC_stereo(0,-127)
 PROC_stereo(1,-0)
 PROC_stereo(2,127)
 PROC_stereo(3,127)
ELSE
 ON ERROR IF ERR=17 CHAIN @lib$+"../examples/tools/touchide" ELSE PRINT REPORT$ : END
 OSCLI "FONT """ + @lib$ + "DejaVuSansMono"",10"
 *STEREO 0,-127
 *STEREO 1,0
 *STEREO 2,127
 *STEREO 3,127
ENDIF
*TEMPO 129

DIM snd{(3,50)a&,p&,d&}, p%(3), q%(3), vol%(3)
DIM cmajor&(7), scale%(7), acc%(7), flat&(7), sharp&(7)
cmajor&() = 88,96,52,60,68,72,80
flat&() = 0, &02, &12, &13, &1B, &5B, &5F, &7F
sharp&() = 0, &A0, &A4, &E4, &EC, &ED, &FD, &FF
vol%() = 4, 1, 2, 3
dur% = 24
tempo% = 3
ENVELOPE 1,1,0,0,0,0,0,0,56,0,-28,-8,112,0
ENVELOPE 2,1,0,0,0,0,0,0,28,0,-14,-4,56,0
ENVELOPE 3,1,0,0,0,0,0,0,28,0,-14,-4,56,0
ENVELOPE 4,1,0,0,0,0,0,0,28,0,-14,-4,56,0
REPEAT
 T$ = ""
 REPEAT
 READ R$ : IF R$="" OFF : REPEAT WAIT 10 : UNTIL FALSE
 T$ += R$ : IF RIGHT$(T$) = "\" T$ = LEFT$(T$)
 UNTIL RIGHT$(R$) <> "\"
 acc%() = scale%()
 clef% = 48 : voice% = 1
 p%() = 0 : q%() = 0
 play% = FALSE
 WHILE T$<>""
 I% = 1 : WHILE INSTR("0123456789",MID$(T$,I%,1)) I% += 1 : ENDWHILE
 IF I% > 1 dur% = VALLEFT$(T$,I%-1) : T$ = MID$(T$,I%)
 C$ = LEFT$(T$,1) : T$=MID$(T$,2)
 CASE C$ OF
  WHEN "[": PRINT T$ :T$ = ""
  WHEN ";": T$ = ""
   WHEN " ":
   WHEN "P": T$ = MID$(T$,2)
   WHEN "T": acc%() = scale%() : clef% = 48
   WHEN "S": acc%() = scale%() : clef% = 0
   WHEN "V": voice% = ASC(T$) - &30 : T$=MID$(T$,2)
    IF voice%=4 voice%=0
   WHEN "W": wave% = VAL(T$) : T$ = MID$(T$,2)
    WHILE ADVAL(-5-voice%)<8 WAIT 0:ENDWHILE
    IF wave% = 0 vol%(voice%) = 1
    IF INKEY$(-256) = "W" THEN
     PROC_voice(voice%, wave%)
    ELSE
     OSCLI "voice " + STR$voice% + "," + STR$(wave%)
    ENDIF
   WHEN "K": key% = ASC(T$) - &30 : T$=MID$(T$,2)
    scale%() = 0
    IF key% THEN
     key$ = LEFT$(T$,1) : T$=MID$(T$,2)
     CASE key$ OF
      WHEN "#": key& = sharp&(key%)
      WHEN "b","&": key& = flat&(key%)
     ENDCASE
     FOR I% = 0 TO 6
      IF key& AND (2^I%) scale%(I%) = -4 : IF key& AND &80 scale%(I%) = +4
     NEXT
    ENDIF
    acc%() = scale%()
    SOUND 1,-15,0,4
   OTHERWISE
    Note% = INSTR("ABCDEFG$",C$)-1
    IF Note% < 0 ERROR 100, "Unrecognised command "+C$
    octave% = 0
    staccato = 0
    REPEAT
     ok% = FALSE
     CASE LEFT$(T$,1) OF
      WHEN "#": acc%(Note%) = 4 : T$=MID$(T$,2) : ok% = TRUE
      WHEN "%": acc%(Note%) = 0 : T$=MID$(T$,2) : ok% = TRUE
      WHEN "&","b": acc%(Note%) =-4 : T$=MID$(T$,2) : ok% = TRUE
      WHEN "+": octave% += 48  : T$=MID$(T$,2) : ok% = TRUE
      WHEN "-": octave% -= 48  : T$=MID$(T$,2) : ok% = TRUE
      WHEN ",": staccato = 1/2 : T$=MID$(T$,2) : ok% = TRUE
      WHEN "'": staccato = 1/8 : T$=MID$(T$,2) : ok% = TRUE
      WHEN """": staccato = 1/4 : T$=MID$(T$,2) : ok% = TRUE
     ENDCASE
    UNTIL NOT ok%
    tim% = dur% DIV 3 * tempo%
    IF LEFT$(T$,1)="." tim% = dur% DIV 3 * tempo% * 3/2 : T$=MID$(T$,2)
    IF LEFT$(T$,1)=":" tim% = dur% DIV 3 * tempo% * 2/3 : T$=MID$(T$,2)
    pitch% = cmajor&(Note%) + acc%(Note%) + clef% + octave%
    IF Note% = 7 pitch% = 0
    WHILE pitch% < 0 pitch% += 48 : ENDWHILE
    WHILE pitch% > 255 : pitch% -= 48 : ENDWHILE
    IF tim% < 0 ERROR 100, "Duration out of range: "+STR$tim%
    gap% = INT(tim% * staccato) + 0.5
    IF voice% < 4 THEN
     IF gap% THEN tim% -= gap%
     REPEAT
      IF tim% < 254 l% = tim% ELSE l% = 254
      snd{(voice%,p%(voice%))}.a& = vol%(voice%)
      snd{(voice%,p%(voice%))}.p& = pitch%
      snd{(voice%,p%(voice%))}.d& = l%
      p%(voice%) += 1
      tim% -= l%
     UNTIL tim% = 0
     IF gap% THEN
      snd{(voice%,p%(voice%))}.a& = vol%(voice%)
      snd{(voice%,p%(voice%))}.p& = 0
      snd{(voice%,p%(voice%))}.d& = gap%
      p%(voice%) += 1
     ENDIF
    ENDIF
    play% = TRUE
  ENDCASE
 ENDWHILE

 IF play% THEN
  SOUND &300,0,0,0 : SOUND &301,0,0,0 : SOUND &302,0,0,0 : SOUND &303,0,0,0
  WHILE p%(0)<>q%(0) OR p%(1)<>q%(1) OR p%(2)<>q%(2) OR p%(3)<>q%(3)
   stall% = TRUE
   FOR v% = 0 TO 3
    IF q%(v%) < p%(v%) IF ADVAL(-5-v%) THEN
     stall% = FALSE
     SOUND v%,snd{(v%,q%(v%))}.a&,snd{(v%,q%(v%))}.p&,snd{(v%,q%(v%))}.d&
     q%(v%) += 1
    ENDIF
   NEXT v%
   IF stall% WAIT 0
  ENDWHILE
 ENDIF
UNTIL FALSE
END

DATA [  THE SUSSEX CAROL - Traditional English Carol.
DATA [ Transcribed for Z80 Music by R.J.Stickley 1983.
DATA [
DATA [ 1. On Christmas night all Christians sing
DATA [    To hear the news the angels bring       (repeat)
DATA "[    News of great joy, news of great mirth"
DATA [    News of our merciful King's birth.
DATA [
DATA K1#
DATA V1W2V2W8V3W8V4W7
DATA PA
DATA TV224D+'
DATA TV2D+G+D+'C+G+D+' SV348G.C+. V496G-.
DATA PB
DATA TV124$$$$$D+ V224B'A'G'AD+F' SV348B.A. V496G-.
DATA TV148D+24B48C+24D+ V2G'B'D+'G+'C+'G' SV348D.E. V496G-.
DATA TV124BAG48A24F V2D+'B'F'E+'A'E' SV348D.C. V496G-.
DATA TV148G24GABC+ V2B'G'D'E+'A'E' SV348B-.C. V496G-.
DATA TV148B24A48G24D+ V224D+C+B'C+BA' SV348D.E. V496G-.
DATA TV148D+24B48C+24D+ V2G'B'D+'G+'C+'G' SV348F.A. V4G-.A.
DATA TV124BAG48A24F V2D+'B'F'E+'A'E' SV348B.A. V4D.C.
DATA TV148G24GABC+ V2B'G'D'E+'A'E' SV348G.A. V4B-.C.
DATA TV148B24A48G. V224D+FD'BGD' SV348F.D. V4D.G-.
DATA PC
DATA TV148A.A24G V224AFDF+AF SV348F.A. V496D.
DATA TV124ABC+D+C+B V2E+AFD+BG SV348A.B. V4C.B-.
DATA TV196A. V224E+AGF+D+A SV348C+A+ V496C.
DATA TV148D+.E+.D+. V224G+D+GG+C+GG+BG V348D.C.B-. SV4B-.C.D.
DATA TV148C+24BAGA V2G+C+GE+C+A SV396A. V448E.C.
DATA TV196G. V224D+G+B'C+G+D+' SV348B.C+. V496G-.
DATA [ 2. On Christmas night all Christians sing
DATA [    To hear the news the angels bring       (repeat)
DATA "[    News of great joy, news of great mirth"
DATA [    News of our merciful King's birth.
DATA [
DATA TV124$$$ V224B'A'G' SV348B. V448G-.
DATA PD V1W6
DATA TV124$$D+ V224AD+F' SV348A. V448G-.
DATA V2W1V3W1V4W7
DATA TV148D+24B48C+24D+ V2G'B'D+'G+'C+'G' SV348D.E. V496G-.
DATA TV124BAG48A24F V2D+'B'F'E+'A'E' SV348D.C. V496G-.
DATA TV148G24GABC+ V2B'G'D'E+'A'E' SV348B-.C. V496G-.
DATA TV148B24A48G24D+ V224D+C+B'C+BA' SV348D.E. V496G-.
DATA TV148D+24B48C+24D+ V2G'B'D+'G+'C+'G' SV348F.A. V4G-.A.
DATA TV124BAG48A24F V2D+'B'F'E+'A'E' SV348B.A. V4D.C.
DATA TV148G24GABC+ V2B'G'D'E+'A'E' SV348G.A. V4B-.C.
DATA TV148B24A48G. V224D+FD'BGD' SV348F.D. V4D.G-.
DATA PE
DATA TV148A.A24G V248F.F24E V348D.D24D V448D.D+24D+
DATA TV124ABC+D+C+B V2FGABAG V348D24D48D24E V448C24C48B-24C
DATA TV196A. V2F. V348F.E. V4D.C.
DATA TV148D+.E+.D+. V2G.E.G. V3D.C.B-. SV4B.36C+C48D.
DATA TV148C+24BAGA V248G24G48E24G V348C24D48E24C SV448E24E48C24E
DATA TV148G. V224D+G+D+'C+G+D+' SV348G.C+. V496G-.
DATA [ 3. Then why should men on earth be so sad
DATA [    Since our redeemer made us glad         (repeat)
DATA [    When from our sin he set us free
DATA [    All for to gain our liberty.
DATA [
DATA TV124$$$ V224B'A'G' SV348B. V448G-.
DATA PF V1W2
DATA TV124$$D+ V224AD+F' SV348A. V448G-.
DATA V2W5V3W8V4W7
DATA TV148D+24B48C+24D+ V236GFGA V3B-D72C SV4$E
DATA TV124BAG48A24F V236BC+24D+E+F+ SV372G36E+D+ V472DC
DATA TV148G24GABC+ V236G+DF%+E+ V372D24CB-A- SV472B-C
DATA TV148B24A48G24D+ V236D+C+BA V324B-CD72D SV4D36GA
DATA PG
DATA TV148D+24B48C+24D+ V236GFGA V3B-D72C SV4$E
DATA TV124BAG48A24F V236BC+24D+E+F+ SV372G36E+D+ V472DC
DATA TV148G24GABC+ V236G+DF%+E+ V372D24CB-A- SV472B-C
DATA TV148B24A48G. V236D+C+BA V324B-CD72D SV4D36GA
DATA PH
DATA TV148A.A24G V236AD+F+E+ V372D36A-D SV472D36DD
DATA TV124ABC+D+C+B V236AF72G V336FE72D SV4CB
DATA TV196A. V236E+D+E+F+ V3EE72A SV436C+C+72C
DATA TV148D+.E+.D+. V224G+F+E+36D+C+BG V372GED SV4B-CD
DATA TV148C+24BAGA V236ABC+E+ V3CDEC SV4EECC
DATA TV148G. V224D+G+D+'C+G+D+' SV348G.C+. V496G-.
DATA [ 4. When sin departs before his grace
DATA [    Then life and health come in its place  (repeat)
DATA [    Angels and men with joy may sing
DATA [    All for to see the new born King.
DATA [
DATA TV124$$$ V224B'A'G' SV348B. V448G-.
DATA PX V1W6
DATA TV124$$D+ V224AD+F' SV348A. V448G-.
DATA V2W8V3W8V4W7
DATA TV148D+24B48C+24D+ V2G'B'D+'G+'C+'G' SV348D.E. V496G-.
DATA TV124BAG48A24F V2D+'B'F'E+'A'E' SV348D.C. V496G-.
DATA TV148G24GABC+ V2B'G'D'E+'A'E' SV348B-.C. V496G-.
DATA TV148B24A48G24D+ V224D+C+B'C+BA' SV348D.E. V496G-.
DATA TV148D+24B48C+24D+ V2G'B'D+'G+'C+'G' SV348F.A. V4G-.A.
DATA TV124BAG48A24F V2D+'B'F'E+'A'E' SV348B.A. V4D.C.
DATA TV148G24GABC+ V2B'G'D'E+'A'E' SV348G.A. V4B-.C.
DATA TV148B24A48G. V224D+FD'BGD' SV348F.D. V4D.G-.
DATA TV148A.A24G V224AFDF+AF SV348F.A. V496D.
DATA TV124ABC+D+C+B V2E+AFD+BG SV348A.B. V4C.B-.
DATA TV196A. V224E+AGF+D+A SV348C+A+ V496C.
DATA TV148D+.E+.D+. V224G+D+GG+C+GG+BG V348D.C.B-. SV4B-.C.D.
DATA TV148C+24BAGA V2G+C+GE+C+A SV396A. V448E.C.
DATA TV196G. V224D+G+B'C+G+D+' SV3B.C+. V496G-.
DATA [ 5. All out of darkness we have light
DATA [    Which made the angels sing this night   (repeat)
DATA [    "Glory to God and peace to men
DATA [    Now and for evermore. Amen".
DATA SV124$$$ TV224B'A'G' V348B. V448G-.
DATA PY V1W6
DATA SV124$$D+ TV224AD+F' V348A. V448G-.
DATA V2W8V3W3V4W3
DATA PJ
DATA SV148D+24B48C+24D+ TV2G'B'D+'G+'C+'G' V348D.E. V496G-.
DATA SV124BAG48A24F TV2D+'B'F'E+'A'E' V348D.C. V496G-.
DATA SV148G24GABC+ TV2B'G'D'E+'A'E' V348B-.C. V496G-.
DATA SV148B24A48G24D+ TV224D+C+B'C+BA' V348D.E. V496G-.
DATA SV148D+24B48C+24D+ TV2G'B'D+'G+'C+'G' V348F.A. V4G-.A.
DATA SV124BAG48A24F TV2D+'B'F'E+'A'E' V348B.A. V4D.C.
DATA SV148G24GABC+ TV2B'G'D'E+'A'E' V348G.A. V4B-.C.
DATA SV148B24A48G. TV224D+FD'BGD' V348F.D. V4D.G-.
DATA PK V3W0
DATA TV136AD+F+E+ V2FGAB SV348A.A24G V448D.D.
DATA TV172D+.36D+ V2AFGG SV324ABC+D+C+B V448C.B-.
DATA TV136E+D+E+F+ V2EE72A SV396A. V4C.
DATA PL
DATA TV127G+F+E+D+.C+.B.G. V281GGG V354D.E.D. SV454B-.C.D.
DATA PM
DATA TV127A.B.C+.E+. V2G.E.G.C+. SV354C+27BAGA V454E.C.
DATA TV1112G+.G+. V2B.B. SV3G.G. V4G-.G-.
DATA "" 

« Last Edit: Dec 17th, 2017, 09:55am by Richard Russell » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx Re: The Sussex Carol
« Reply #2 on: Dec 18th, 2017, 10:25pm »

I'm rather disappointed to have received no reaction to this (except a solitary 'like' on Facebook). Is it that bad? Or have the religious overtones inadvertently caused offence (I am an atheist but I can still enjoy the music and appreciate the skill that went into the transcription)?

Richard.
User IP Logged

michael
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 141
xx Re: The Sussex Carol
« Reply #3 on: Dec 19th, 2017, 02:17am »

That is a very nice carol. Do you play an instrument like violin or piano or guitar? I doubt it would be as much to do with religion as it would do with the times. Times change. Although, it does bring back memories of programming my TRS-80 back in 1982.

Id say, it would be a matter of spirit (inner spirit) that drives a person to create such melodies.

Quote:
Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there will ever be to know and understand

: Einstein

The universe would have no meaning without awareness, and would not exist without those whom were there to witness its endless wonders. So what is likely or unlikely is irrelevant, for it is what one makes of experience that gives life meaning.

I wish you well Richard.

« Last Edit: Dec 19th, 2017, 02:21am by michael » User IP Logged

I like reinventing the wheel, but for now I will work on tools for D3D
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls