PDA

View Full Version : twinkle twinkle little star



hitsware
04-11-2007, 11:33 AM
cx data 8,6,9,6:nx data 2,4,3,4
c var nib (4):n var nib(4):x var nib:y var nib
for x=0 to 3:read cx+x,c(x):read nx+x,n(x):next
play:for x=0 to 3:for y=0 to 3
freqout 0,400,c(x)*n(y)*8,c(x)*n(y)*16
next:next:goto play

Chris Savage
04-11-2007, 12:12 PM
hitsware,

Is there a question or information in your post? The code you posted is incomplete, unformatted and there is no statement or question to assist us in identifying what your post is to convey.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

hitsware
04-11-2007, 02:25 PM
>Is there a question or information in your post?

Evedently not

>The code you posted is incomplete,

It runs with stamp2.exe
and a BS2

>unformatted and there is no statement or question
>to assist us in identifying what your post is to convey.

If you hook your sterero (via Y plug to (p0 (of your stamp)to both channels))
(and run the code) you will hear what I mean.

Just trying to show the musical abilities of a BS ........

Chris Savage
04-11-2007, 10:03 PM
My apologies…Because of the code formatting I missed the first line of code which contains the data I was missing. I would recommend adding some formatting to code you post so that it is easier for new users of the BASIC Stamp to follow. You can see some examples by looking at code we have posted. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

hitsware
04-11-2007, 10:59 PM
cx data 8,6,9,6 ' This is in response to a post below (which seems
nx data 2,4,3,4 'to have disappeared(or I can't find)) asking for a
c var nib (4) ' pic version of "twinkle twinkle little star".
n var nib(4) 'This is not that tune, but demonstrates one
x var nib 'method of generating music with a stamp2
y var nib 'cx = chord
for x=0 to 3 'nx=note
read cx+x,c(x) 'for instance for the notes in
read nx+x,n(x) '(major chords have a 3,4,5 frequency ratio)
next 'Cmaj:
play '6*3=18=G,6*4=24=C,6*5=30=E
for x=0 to 3 '6,8,9 gives the ratios of the 3 major chords
for y=0 to 3 'in a key (say C,F,G)
freqout 0,400,c(x)*n(y)*8,c(x)*n(y)*16 '
next
next
goto play

PJ Allen
04-12-2007, 08:22 AM
I guess, hitsware, that you meant (??) to Reply to this Subject -- http://forums.parallax.com/showthread.php?p=641113

hitsware
04-13-2007, 11:27 PM
n var byte ' Yea. Thanks. Finally got it.
t var nib
x var byte
a con 40
c con 24
d con 27
e con 30
f con 32
g con 36
q con 1
h con 2
for x=0 to 26
lookup x,[c,c,g,g,a,a,g,f,f,e,e,d,d,c,g,g,f,e,e,d,g,g,f,f,e, e,d],n
lookup x,[q,q,q,q,q,q,h,q,q,q,q,q,q,h,q,q,h,q,q,h,q,q,q,q,q, q,h],t
freqout 0,t*300,n*11
next
for x=0 to 13
lookup x,[c,c,g,g,a,a,g,f,f,e,e,d,d,c],n
lookup x,[q,q,q,q,q,q,h,q,q,q,q,q,q,h],t
freqout 0,t*300,n*11
next