Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DivineHolinessjr

Pages: [1]
1
Programs / Re: School Project: Melody Maker
« on: May 22, 2020, 04:28:46 pm »
That is impressive! I wasn't making programs like this in high school! I was just doing stuff to help me with my math homework haha. Of course, I'm pretty sure I was using the old SDL version anyways and wasn't really trying to make anything super complex. It wasn't until I saw Fellippe's library, InForm, that I really got back into QB64. Now I spend most of my free time doing it. Looking forward to seeing more from you! You could maybe even convert your program to using InForm by making custom piano-key shaped buttons!

Sounds like a good idea. I've had InForm on my computer for a while but couldn't really figure out how to use it with code. I'll probably start playing with it and looking stuff up now and try to convert it into an InForm interface now though.

Welcome to the forum DivineHolinessjr,

Small upgrade for mouse calling can repairing your 3x reactions:

 
Name Input.JPG


I'll go ahead and take use of that, would've never thought of that fix personally. I'll try and keep that in mind for any future programs I decide to make.

Edit: Right after I posted I noticed that instead of future I put feature. How do I keep replacing words while typing.

2
Programs / Re: School Project: Melody Maker
« on: May 22, 2020, 01:40:46 pm »
Thanks! Surprised to already have gotten a reply, and from a member of the team themselves. Been lurking here for a few days and only just thought to upload the project once I finished it.

3
Programs / School Project: Melody Maker
« on: May 22, 2020, 01:29:58 pm »
So, I take Foundations of Programming at my highschool and the final project was to make anything you wanted as long as it did certain things. Here's the thing. Just wanted to see people's opinion on it and how to fix some things (for example, the play command makes music play three times despite being called once, and clicking on the save and load buttons seems to make the prompt show up three times as well. I assume this is because before it goes to the prompt, the if statement gets executed 3 times or something along those lines). Also looking for cool ideas because it would be nice to add more stuff to this and to give myself a reason to work on a project some more.

Code: QB64: [Select]
  1. DIM song(100, 100)
  2. DIM octave(1000)
  3. DIM notes$(12)
  4. DIM NLS(3)
  5. FOR a = 1 TO 100
  6.     FOR b = 1 TO 100
  7.         song(a, b) = 0
  8.     NEXT b
  9. FOR i = 1 TO 50
  10.     octave(i) = 2
  11. FOR i = 1 TO 3
  12.     NLS(i) = 0
  13. NLS(2) = 1
  14.  
  15. 'assigning notes
  16. notes$(1) = "C"
  17. notes$(2) = "C#"
  18. notes$(3) = "D"
  19. notes$(4) = "D#"
  20. notes$(5) = "E"
  21. notes$(6) = "F"
  22. notes$(7) = "F#"
  23. notes$(8) = "G"
  24. notes$(9) = "G#"
  25. notes$(10) = "A"
  26. notes$(11) = "A#"
  27. notes$(12) = "B"
  28. 'mouse on window
  29. _MOUSEMOVE 100, 100
  30.  
  31. 'menu
  32. menu:
  33. PRINT TAB(36); "Melody"
  34. PRINT TAB(36); "Creator"
  35. PRINT "  Editor"
  36. PRINT "  Help"
  37. PRINT "  Quit"
  38. CIRCLE (305, 120), 24, 15
  39. CIRCLE (305, 120), 23, 15
  40. LINE (328, 120)-(329, 20), 15, BF
  41. CIRCLE (400, 300), 20, 15
  42. CIRCLE (500, 275), 20, 15
  43. LINE (420, 300)-(420, 200), 15
  44. LINE (520, 275)-(520, 175), 15
  45. LINE -(420, 200), 15
  46. LINE (420, 220)-(520, 195), 15
  47. CIRCLE (100, 100), 20, 15
  48. LINE (120, 100)-(120, 25), 15
  49.         mx = _MOUSEX
  50.         my = _MOUSEY
  51.         mx = INT(mx / 8) + 1
  52.         my = INT(my / 16) + 1
  53.         IF _MOUSEBUTTON(1) AND my = 16 AND (mx >= 3 AND mx <= 8) THEN
  54.             GOTO editor
  55.         ELSEIF _MOUSEBUTTON(1) AND my = 19 AND (mx >= 3 AND mx <= 6) THEN
  56.             GOTO help
  57.         ELSEIF _MOUSEBUTTON(1) AND my = 22 AND (mx >= 3 AND mx <= 6) THEN
  58.             END
  59.         END IF
  60.     END IF
  61.  
  62. help:
  63. PRINT "Welcome to the Melody Creator! This a program where you can create melodies."
  64. PRINT "To start, click on the 'Editor' button, or click 'Quit' to exit the program."
  65. PRINT "Within the editor you can click the -'s and #'s to toggle notes on and off."
  66. PRINT "A - means a note is off, and a # means a note is on."
  67. PRINT "Down at the bottom there's a section labled 'Oct.' This stands for octave."
  68. PRINT "Click the arrows at the top and bottom to increase or decrease the octave."
  69. PRINT "Below the octave section is 's N l.'"
  70. PRINT "This stands for stacatto, normal note length, and legatto."
  71. PRINT "These buttons change the length of notes."
  72. PRINT "Finally is the play button, click this button to play the melody."
  73. PRINT "There is also the Save and Load buttons which can save, and load, melodies."
  74. PRINT "Simply give them the path towards a place to save, or load, a melody."
  75. PRINT "Back to Main Menu"
  76.         mx = _MOUSEX
  77.         my = _MOUSEY
  78.         mx = INT(mx / 8) + 1
  79.         my = INT(my / 16) + 1
  80.         IF _MOUSEBUTTON(1) AND my = 18 AND (mx >= 1 AND mx <= 18) THEN
  81.             GOTO menu
  82.         END IF
  83.     END IF
  84.  
  85. ' UI
  86. editor:
  87. PRINT "              11111111112222222222333333333344444444445"
  88. PRINT "     12345678901234567890123456789012345678901234567890"
  89. PRINT "________________________________________________________"
  90. PRINT " C | --------------------------------------------------|"
  91. PRINT " C#| --------------------------------------------------|"
  92. PRINT " D | --------------------------------------------------|"
  93. PRINT " D#| --------------------------------------------------|"
  94. PRINT " E | --------------------------------------------------|"
  95. PRINT " F | --------------------------------------------------|"
  96. PRINT " F#| --------------------------------------------------|"
  97. PRINT " G | --------------------------------------------------|"
  98. PRINT " G#| --------------------------------------------------|"
  99. PRINT " A | --------------------------------------------------|"
  100. PRINT " A#| --------------------------------------------------|"
  101. PRINT " B | --------------------------------------------------|"
  102. PRINT "_______________________________________________________|"
  103. PRINT "Oct| |"
  104. PRINT "   | 22222222222222222222222222222222222222222222222222|"
  105. PRINT "   | |"
  106. PRINT "________________________________________________________"
  107. PRINT " s N l"
  108. PRINT " Play"
  109. PRINT " Save"
  110. PRINT " Load"
  111. PRINT "Back to Main Menu"
  112. FOR i = 1 TO 50
  113.     FOR j = 1 TO 12
  114.         IF song(i, j) = 1 THEN
  115.             LOCATE j + 3, 5 + i
  116.             PRINT "#"
  117.         END IF
  118.     NEXT j
  119. FOR i = 1 TO 50
  120.     LOCATE 18, 5 + i
  121.     PRINT RIGHT$(STR$(octave(i)), 1)
  122. IF NLS(1) = 1 THEN
  123.     LOCATE 21, 2
  124.     PRINT "S n l"
  125. ELSEIF NLS(2) = 1 THEN
  126.     LOCATE 21, 2
  127.     PRINT "s N l"
  128. ELSEIF NLS(3) = 1 THEN
  129.     LOCATE 21, 2
  130.     PRINT "s n L"
  131.     'mouse tracking
  132.         mx = _MOUSEX
  133.         my = _MOUSEY
  134.         mx = INT(mx / 8) + 1
  135.         my = INT(my / 16) + 1
  136.         'LOCATE 25, 1
  137.         'PRINT mx, my
  138.         'LOCATE 26
  139.         'PRINT octave(1), octave(2), octave(3)
  140.         'PRINT octave(23), octave(24), octave(25)
  141.         'Note Chooser
  142.         IF _MOUSEBUTTON(1) AND (my > 3 AND my < 16) AND (mx > 5 AND mx < 56) THEN
  143.             IF song(mx - 5, my - 3) = 0 THEN
  144.                 LOCATE my, mx
  145.                 PRINT "#"
  146.                 song(mx - 5, my - 3) = 1
  147.             ELSEIF song(mx - 5, my - 3) = 1 THEN
  148.                 LOCATE my, mx
  149.                 PRINT "-"
  150.                 song(mx - 5, my - 3) = 0
  151.             END IF
  152.             'octave up
  153.         ELSEIF _MOUSEBUTTON(1) AND my = 17 AND (mx > 5 AND mx < 56) AND timerlast <> TIMER THEN
  154.             IF octave(mx - 5) < 6 THEN
  155.                 octave(mx - 5) = octave(mx - 5) + 1
  156.                 LOCATE 18, mx
  157.                 PRINT RIGHT$(STR$(octave(mx - 5)), 1)
  158.                 timerlast = TIMER
  159.             END IF
  160.             'octave down
  161.         ELSEIF _MOUSEBUTTON(1) AND my = 19 AND (mx > 5 AND mx < 56) AND timerlast <> TIMER THEN
  162.             IF octave(mx - 5) > 0 THEN
  163.                 octave(mx - 5) = octave(mx - 5) - 1
  164.                 LOCATE 18, mx
  165.                 PRINT RIGHT$(STR$(octave(mx - 5)), 1)
  166.                 timerlast = TIMER
  167.             END IF
  168.         ELSEIF _MOUSEBUTTON(1) AND my = 21 THEN
  169.             'Staccato
  170.             IF mx = 2 THEN
  171.                 FOR i = 1 TO 3
  172.                     NLS(i) = 0
  173.                 NEXT i
  174.                 NLS(1) = 1
  175.                 LOCATE 21, 2
  176.                 PRINT "S n l"
  177.                 'Normal
  178.             ELSEIF mx = 4 THEN
  179.                 FOR i = 1 TO 3
  180.                     NLS(i) = 0
  181.                 NEXT i
  182.                 NLS(2) = 1
  183.                 LOCATE 21, 2
  184.                 PRINT "s N l"
  185.                 'Legato
  186.             ELSEIF mx = 6 THEN
  187.                 FOR i = 1 TO 3
  188.                     NLS(i) = 0
  189.                 NEXT i
  190.                 NLS(3) = 1
  191.                 LOCATE 21, 2
  192.                 PRINT "s n L"
  193.             END IF
  194.             'play song
  195.         ELSEIF _MOUSEBUTTON(1) AND my = 22 AND (mx >= 2 AND mx <= 5) THEN
  196.             'LOCATE 30, 1
  197.             'PRINT "test"
  198.             symbols$ = stringy$ + "V25 MB "
  199.             'Note Length
  200.             IF NLS(1) = 1 THEN
  201.                 symbols$ = symbols$ + " MS"
  202.             ELSEIF NLS(2) = 1 THEN
  203.             ELSEIF NLS(3) = 1 THEN
  204.                 symbols$ = symbols$ + " ML"
  205.             END IF
  206.             total = 0
  207.             FOR i = 1 TO 50
  208.                 symbols$ = symbols$ + " O" + RIGHT$(STR$(octave(i)), 1) + " "
  209.                 'LOCATE 24, i
  210.                 ' PRINT RIGHT$(STR$(octave(i)), 1)
  211.                 FOR j = 1 TO 12
  212.                     IF song(i, j) = 1 AND thing = 1 THEN
  213.                         symbols$ = symbols$ + ", " + notes$(j)
  214.                     ELSEIF song(i, j) = 1 AND thing = 0 THEN
  215.                         symbols$ = symbols$ + " " + notes$(j)
  216.                         thing = 1
  217.                     ELSE
  218.                         total = total + 1
  219.                     END IF
  220.                 NEXT j
  221.                 IF total / 12 = 1 THEN
  222.                     symbols$ = symbols$ + " P4"
  223.                 END IF
  224.                 total = 0
  225.                 thing = 0
  226.             NEXT i
  227.             PLAY symbols$
  228.             ' LOCATE 29, 1
  229.             'PRINT symbols$
  230.             'PRINT stringy$
  231.             'PRINT octave
  232.  
  233.             'save
  234.         ELSEIF _MOUSEBUTTON(1) AND my = 23 AND (mx >= 2 AND mx <= 5) AND NOT toiming = TIMER THEN
  235.             toiming = TIMER
  236.             GOTO save
  237.             'load
  238.         ELSEIF _MOUSEBUTTON(1) AND my = 24 AND (mx >= 2 AND mx <= 5) AND NOT toiming = TIMER THEN
  239.             toiming = TIMER
  240.             GOTO load
  241.             'back to menu
  242.         ELSEIF _MOUSEBUTTON(1) AND my = 26 AND (mx >= 1 AND mx <= 18) THEN
  243.             GOTO menu
  244.         END IF
  245.     END IF
  246.  
  247. save:
  248. PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
  249. PRINT " ³ Enter A Path To Save The File Or Type 'Cancel' 3x To Go Back:            ³"
  250. PRINT " ³                                                                          ³"
  251. PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ"
  252. LOCATE 6, 4
  253. INPUT "", path$
  254. IF LCASE$(path$) = "cancel" THEN
  255.     GOTO editor
  256. ELSEIF NOT (RIGHT$(path$, 4) = ".txt" OR RIGHT$(path$, 4) = ".dat") THEN
  257.     CLS
  258.     PRINT "Please enter a valid path. "
  259.     PRINT "You should be pointing to a valid folder, and then end with a valid file."
  260.     PRINT "A valid file ends with .dat or .txt."
  261.     PRINT
  262.     PRINT "Press Any Key To Continue"
  263.     WHILE INKEY$ = ""
  264.     WEND
  265.     GOTO save
  266. OPEN path$ FOR OUTPUT AS #1
  267. FOR i = 1 TO 50
  268.     FOR j = 1 TO 12
  269.         PRINT #1, song(i, j);
  270.     NEXT j
  271.     PRINT #1, ,
  272. FOR i = 1 TO 50
  273.     PRINT #1, octave(i);
  274. PRINT #1, ,
  275. FOR i = 1 TO 3
  276.     PRINT #1, NLS(i);
  277. GOTO editor
  278.  
  279. load:
  280. PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
  281. PRINT " ³ Enter A Path To Load The File Or Type 'Cancel' 3x To Go Back:            ³"
  282. PRINT " ³                                                                          ³"
  283. PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ"
  284. LOCATE 6, 4
  285. INPUT "", path$
  286. IF LCASE$(path$) = "cancel" THEN
  287.     GOTO editor
  288. ELSEIF NOT (RIGHT$(path$, 4) = ".txt" OR RIGHT$(path$, 4) = ".dat") THEN
  289.     CLS
  290.     PRINT "Please enter a valid path. "
  291.     PRINT "You should be pointing to a valid folder, and then end with a valid file."
  292.     PRINT "A valid file ends with .dat or .txt."
  293.     PRINT
  294.     PRINT "Press Any Key To Continue"
  295.     WHILE INKEY$ = ""
  296.     WEND
  297.     GOTO save
  298. OPEN path$ FOR INPUT AS #1
  299. FOR i = 1 TO 50
  300.     FOR j = 1 TO 12
  301.         INPUT #1, song(i, j)
  302.     NEXT j
  303. FOR i = 1 TO 50
  304.     INPUT #1, octave(i)
  305. FOR i = 1 TO 3
  306.     INPUT #1, NLS(i)
  307. GOTO editor
  308.  

Also feel free to rate my mediocre documentation.

Pages: [1]