QB64 Phoenix Edition
Just a silly C Pentatonic random notes player - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7)
+---- Thread: Just a silly C Pentatonic random notes player (/showthread.php?tid=149)



Just a silly C Pentatonic random notes player - CharlieJV - 04-23-2022

Code: (Select All)
dim c_pentatonic(0 to 4) as single
c_pentatonic(0) = 130.81
c_pentatonic(1) = 146.83
c_pentatonic(2) = 164.81
c_pentatonic(3) = 196.0
c_pentatonic(4) = 220.00
duration = 6
while inkey$ <> chr$(27)
  i = int(5 * rnd + 1) - 1
  print i,
  freq = c_pentatonic(i)
  sound freq, duration
  _delay 0.5
wend



RE: Just a silly C Pentatonic random notes player - SierraKen - 04-23-2022

That's pretty slick. You can shorten the notes and the delay and make it go a lot faster too.


RE: Just a silly C Pentatonic random notes player - CharlieJV - 04-23-2022

(04-23-2022, 10:07 PM)SierraKen Wrote: That's pretty slick. You can shorten the notes and the delay and make it go a lot faster too.

Aside: Oh man.  I've been in "dirty old man" training for the last 20 years.  (Just can't seem to get "old man cute" working with it.  Yet.)  If HR could plug an RCA jack in the back of my sponge to see what's grinding up there, HR would not be happy ...

All of that to say, insta-thought in this old bean of mine:  can lengthen the notes and the delay to make it go slower too.

Or could get SIN(), or whatever other functions, involved in there to have varying length delays.

Now something so dinky as a study of the pentatonic scale can lead to all sorts of programming fun.  Huh.