Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exploring QB64-PE default soundfont patches
#31
Great to hear!  I've only tested in Linux so far.   I need to add error checking stuff now.


I thought I'd give a brief overview on how to write MIDI songs using this program...

You must give a tempo of the song, a program name to use for sound (0-127), and your string$ data of notes to play.  Here's how to write note strings...

If you were sitting in front of a piano, played middle c, in this program that would be a "c4" (4 being the octave on the piano).  So if you played a scale from middle c to the next higher c, here it would look like this "c4d4e4g4a4b4c5"  (that last c started a new octave).

Notes are case sensitive here.  Capital letters in notes make them a sharp note.   "c4" is a regular c, but C4 will be a C# on the piano.  For example, "d4F4a4"  Would be a D,F#,A on the piano, in the 4th octave.

You can play more than one note at the same time (in groups) by putting them in parenthesis, like "(c4e4g4)" will play a C chord of those 3 notes.
 
How long a note plays depends on the duration you specify.  By default notes will be a quarter note long (qn). But you can change that by putting a new duration code in front of the note.  For example, if you wanted to play the c scale in eighth notes, uses the "en" code in front of them, like "en c4d4e4f4g4a4b4c5".  When a duration code is given all notes afterwards will play that duration until you change it.  Duration codes cannot be inside of a group () of notes.  Place it in front of the group if needed "hn(c4e4g4)".  You can change the note duration as much as needed.

Here are the following note duration codes:  

wn = whole note
dh = dotted half note
hn = half note
dq = dotted quarter
qn = quarter note
de = dotted eighth note
en = eighth note
ds = dotted sixteenth not
sn = sixteenth not
ts = thirty second note

Here's a part of twinkle twinkle little star:  "qn c4c4 g4g4 a4a4    hn g4"
The first notes are using quarter notes (qn), all of them  (twinkle, twinkle, little).., 
The last note is a half note (hn) on the note g4 ( star...).

That's the basics to building  a string of notes here.  Spaces are ignored in the notes string.  So you can use spaces for visual reference if needed.  There's no error checking yet, so if you make something and it fails to play, there's probably a typo in the notes data somewhere..

- Dav

Find my programs here in Dav's QB64 Corner
Reply


Messages In This Thread
RE: Exploring QB64-PE default soundfont patches - by Dav - 09-12-2024, 12:20 AM



Users browsing this thread: 22 Guest(s)