How to resolve the algorithm Musical scale step by step in the Commodore BASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Musical scale step by step in the Commodore BASIC programming language
Table of Contents
Problem Statement
Output the 8 notes of the C major diatonic scale to the default musical sound device on the system. Specifically, pitch must be tuned to 12-tone equal temperament (12TET) with the modern standard A=440Hz. These are the notes "C, D, E, F, G, A, B, C(1 octave higher)", or "Do, Re, Mi, Fa, Sol, La, Si/Ti, Do(1 octave higher)" on Fixed do Solfège. For the purpose of this task, Middle C (in the case of the above tuning, around 261.63 Hz) should be used as the starting note, and any note duration is allowed. For languages that cannot utilize a sound device, it is permissible to output to a musical score sheet (or midi file), or the task can be omitted.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Musical scale step by step in the Commodore BASIC programming language
Source code in the commodore programming language
10 rem musical scale
15 rem rosetta code
20 print chr$(147)
25 s=54272
30 for l=s to s+23:poke l,0:next
35 poke s+5,9:poke s+6,0
40 poke s+24,15
45 for i=1 to 8
50 read fq
60 ff=int(fq/.06097)
65 fh=int(ff/256):fl=ff-(256*fh)
70 poke s+1,fh:poke s,fl
75 poke s+4,17
80 for d=1 to 350:next
85 poke s+4,16
90 for d=1 to 25:next
95 next i
500 data 261.63,293.66,329.63,349.23,392,440,493.88,523.25
10 print chr$(147)
20 play "o4 cdefgab o5 c"
You may also check:How to resolve the algorithm Abundant, deficient and perfect number classifications step by step in the Arturo programming language
You may also check:How to resolve the algorithm Make directory path step by step in the Phix programming language
You may also check:How to resolve the algorithm Count the coins step by step in the C++ programming language
You may also check:How to resolve the algorithm String matching step by step in the Yabasic programming language
You may also check:How to resolve the algorithm String case step by step in the K programming language