PLAY musak!
#11
Well I am eager to add patterns and graphics to this but I've got to catch up on Play first.

We will have to read the e$ and to convert instructions to add graphics and timing is probably going to be a difficulty. Perhaps break down the e$ string and Play and Draw pieces at a time? Just off the top of my head.
b = b + ...
Reply
#12
In particular there are only three code lines to worry about (line #169, #180, #191). For example where there is this:

Code: (Select All)
e$ = e$ + phrase(Random1(5)) + frag(a) + frag(b) + frag(c) + frag(d)

just straight out do:

Code: (Select All)
PLAY phrase(Random1(5)) + frag(a) + frag(b) + frag(c) + frag(d)

and do whatever else needs to be done right after that PLAY statement. Delete PLAY e$ left later in the code. Also where e$ begins being built to set the tempo, background mode etc. use PLAY directly on that string like you already fixed it earlier.
Reply
#13
I made some more modifications:

Code: (Select All)

'by mnrvovrfc 20-June-2023
'works in QB64 Phoenix Edition v3.8 and later
'otherwise see below
OPTION _EXPLICIT

DIM frag(1 TO 48) AS STRING
DIM scales(1 TO 2, 1 TO 5) AS INTEGER
DIM phrase(1 TO 10) AS STRING
DIM AS INTEGER basenote, numfrag, n, vu, ve, u, a, b, c, d
DIM AS INTEGER x, y
DIM e$, f$, notes$, nop$, ncl$, double1 AS _BYTE, double2 AS _BYTE
DIM octav$, setdot AS _BYTE, fe as long

notes$ = "C C#D D#E F F#G G#A A#B "

RANDOMIZE TIMER

octav$ = "O3"
double1 = Random1(2) - 1
double2 = Random1(2) - 1
FOR y = 1 TO 2
    basenote = Random1(12) * 2 - 1
    FOR x = 1 TO 5
        scales(y, x) = basenote
        basenote = basenote + Rand(3, 6) * 2
        if y = 1 and basenote >= 40 then octav$ = "O2"
    NEXT
NEXT

vu = 0
ve = 0
FOR y = 1 TO 32
    setdot = 0
    u = Random1(10)
    SELECT CASE u
        CASE 1: e$ = "L4~~"
        CASE 2: e$ = "L8~~~~"
        CASE 3: e$ = "L4~L8~~"
        CASE 4: e$ = "L8~~L4~"
        CASE 5: e$ = "L8~L4~L8~"
        CASE 6: e$ = "L16~~L8~L4~"
        CASE 7: e$ = "L16~~~~L4~"
        CASE 8: e$ = "L8~~L16~~~~"
        CASE 9: e$ = "L8~L16~~L8~L16~~"
        CASE 10
            setdot = 1
            e$ = "L4~L8~"
    END SELECT

    setdot = 0
    x = CountString(e$, "~")
    n = scales(1, Random1(2))
    DO WHILE x > 0
        nop$ = ""
        ncl$ = ""
        DO WHILE n > 23
            nop$ = nop$ + ">"
            ncl$ = ncl$ + "<"
            n = n - 24
        LOOP
        DO
            vu = Random1(3)
        LOOP WHILE vu = ve
        ve = vu
        SELECT CASE vu
            CASE 1: nop$ = nop$ + "V50"
            CASE 2: nop$ = nop$ + "V25"
            CASE 3: nop$ = nop$ + "V12"
        END SELECT
        IF setdot THEN
            setdot = 0
            nop$ = nop$ + RTRIM$(MID$(notes$, n, 2)) + "." + ncl$
        ELSE
            nop$ = nop$ + RTRIM$(MID$(notes$, n, 2)) + ncl$
        END IF
        ReplaceString2 e$, "~", nop$, 1
        n = scales(1, Random1(5))
        x = x - 1
    LOOP
    frag(y) = e$
NEXT

vu = 0
ve = 0
FOR y = 33 TO 48
    u = Random1(10)
    SELECT CASE u
        CASE 1: e$ = "L4~~"
        CASE 2: e$ = "L8~~~~"
        CASE 3: e$ = "L4~L8~~"
        CASE 4: e$ = "L8~~L4~"
        CASE 5: e$ = "L8~L4~L8~"
        CASE 6: e$ = "L16~~L8~L4~"
        CASE 7: e$ = "L16~~~~L4~"
        CASE 8: e$ = "L8~~L16~~~~"
        CASE 9: e$ = "L8~L16~~L8~L16~~"
        CASE 10
            setdot = 1
            e$ = "L4~L8~"
    END SELECT

    x = CountString(e$, "~")
    DO WHILE x > 0
        n = scales(2, Random1(5))
        nop$ = ""
        ncl$ = ""
        DO WHILE n > 23
            nop$ = nop$ + ">"
            ncl$ = ncl$ + "<"
            n = n - 24
        LOOP
        DO
            vu = Random1(3)
        LOOP WHILE vu = ve
        ve = vu
        SELECT CASE vu
            CASE 1: nop$ = nop$ + "V50"
            CASE 2: nop$ = nop$ + "V25"
            CASE 3: nop$ = nop$ + "V12"
        END SELECT
        IF setdot THEN
            setdot = 0
            nop$ = nop$ + RTRIM$(MID$(notes$, n, 2)) + "." + ncl$
        ELSE
            nop$ = nop$ + RTRIM$(MID$(notes$, n, 2)) + ncl$
        END IF
        ReplaceString2 e$, "~", nop$, 1
        x = x - 1
    LOOP
    frag(y) = e$
NEXT

DO  'ONLY ONCE

    'the following up to the next comment for QB64PE v3.8 or later:
    e$ = "MB"
    if val(right$(time$, 1)) mod 4 = 2 then
        e$ = e$ + "MST" + _TRIM$(STR$(Rand(18, 25) * 10))
    else
        e$ = e$ + "MNT" + _TRIM$(STR$(Rand(9, 16) * 10))
    end if
    e$ = e$ + "@" + _TRIM$(STR$(Random1(4))) + octav$
    'use this line instead for earlier QB64PE, or for other QB64:
    'e$ = "MBMNT" + _TRIM$(STR$(Rand(9, 16) * 10)) + "O3"

    _TITLE "Press [ESC] to quit."
    CLS
    PRINT e$
    PLAY e$

    numfrag = Rand(6, 16)
    n = numfrag
    FOR x = 1 TO 5
        a = Random1(10)
        b = Random1(10)
        c = Random1(10)
        d = Random1(10)
        phrase(x) = frag(a) + frag(b) + frag(c) + frag(d)
        IF double1 AND x < 3 THEN phrase(x) = phrase(x) + frag(a) + frag(b) + frag(c) + frag(d)
    NEXT
    FOR x = 6 TO 10
        a = Rand(33, 40)
        b = Rand(33, 40)
        c = Rand(33, 40)
        d = Rand(33, 40)
        phrase(x) = frag(a) + frag(b) + frag(c) + frag(d)
        IF double2 AND x < 8 THEN phrase(x) = phrase(x) + frag(a) + frag(b) + frag(c) + frag(d)
    NEXT

    n = numfrag
    u = 11
    DO WHILE n > 0
        a = advanceu(11, 24, u)
        b = advanceu(11, 24, u)
        c = advanceu(11, 24, u)
        d = advanceu(11, 24, u)
        f$ = phrase(Random1(5)) + frag(a) + frag(b) + frag(c) + frag(d)
        PRINT f$
        e$ = e$ + f$
        PLAY f$
        DO WHILE PLAY(0) > 0
            _LIMIT 600
            IF _KEYDOWN(27) THEN EXIT DO
        LOOP
        IF _KEYDOWN(27) THEN EXIT DO
        n = n - 1
    LOOP
    IF _KEYDOWN(27) THEN EXIT DO

    u = Rand(33, 40)
    n = numfrag
    DO WHILE n > 0
        a = advanceu(33, 48, u)
        b = advanceu(33, 48, u)
        c = advanceu(33, 48, u)
        d = advanceu(33, 48, u)
        f$ = phrase(Random1(5) + 5) + frag(a) + frag(b) + frag(c) + frag(d)
        PRINT f$
        e$ = e$ + f$
        PLAY f$
        DO WHILE PLAY(0) > 0
            _LIMIT 600
            IF _KEYDOWN(27) THEN EXIT DO
        LOOP
        IF _KEYDOWN(27) THEN EXIT DO
        n = n - 1
    LOOP
    IF _KEYDOWN(27) THEN EXIT DO

    u = Rand(11, 24)
    n = numfrag
    DO WHILE n > 0
        a = advanceu(11, 32, u)
        b = advanceu(11, 32, u)
        c = advanceu(11, 32, u)
        d = advanceu(11, 32, u)
        f$ = phrase(Random1(5)) + frag(a) + frag(b) + frag(c) + frag(d)
        PRINT f$
        e$ = e$ + f$
        PLAY f$
        DO WHILE PLAY(0) > 0
            _LIMIT 600
            IF _KEYDOWN(27) THEN EXIT DO
        LOOP
        IF _KEYDOWN(27) THEN EXIT DO
        n = n - 1
    LOOP

LOOP UNTIL 1

_CLIPBOARD$ = e$
fe = FREEFILE
OPEN "mnrvovrfc-musak.bas" FOR OUTPUT AS fe
PRINT #fe, "PLAY "; CHR$(34); e$; CHR$(34)
CLOSE fe
SYSTEM


'CHANGED: u
FUNCTION advanceu% (fromval AS INTEGER, totoval AS INTEGER, u AS INTEGER)
    u = u + 1
    IF u > totoval THEN u = fromval
    advanceu% = u
END FUNCTION


FUNCTION Rand& (fromval&, toval&)
    DIM sg%, f&, t&
    IF fromval& = toval& THEN
        Rand& = fromval&
        EXIT FUNCTION
    END IF
    f& = fromval&
    t& = toval&
    IF (f& < 0) AND (t& < 0) THEN
        sg% = -1
        f& = f& * -1
        t& = t& * -1
    ELSE
        sg% = 1
    END IF
    IF f& > t& THEN SWAP f&, t&
    Rand& = INT(RND * (t& - f& + 1) + f&) * sg%
END FUNCTION

FUNCTION Random1& (maxvaluu&)
    DIM sg%
    sg% = SGN(maxvaluu&)
    IF sg% = 0 THEN
        Random1& = 0
    ELSE
        IF sg% = -1 THEN maxvaluu& = maxvaluu& * -1
        Random1& = INT(RND * maxvaluu& + 1) * sg%
    END IF
END FUNCTION

SUB ReplaceString2 (tx AS STRING, sfind AS STRING, repl AS STRING, numtimes AS _UNSIGNED LONG)
    DIM AS STRING s, t
    DIM AS _UNSIGNED LONG ls, lx, count, u
    DIM goahead AS _BYTE
    IF (tx = "") OR (sfind = "") OR (sfind = repl) OR (LEN(sfind) > LEN(tx)) THEN EXIT SUB
    s = UCASE$(sfind): t = UCASE$(tx)
    ls = LEN(s)
    count = 0
    goahead = 1
    DO
        u = INSTR(t, s)
        IF u > 0 THEN
            tx$ = LEFT$(tx, u - 1) + repl + MID$(tx, u + ls)
            t = UCASE$(tx)
            IF numtimes > 0 THEN count = count + 1: IF count >= numtimes THEN goahead = 0
        ELSE
            goahead = 0
        END IF
    LOOP WHILE goahead
END SUB

FUNCTION CountString% (tx$, delim$)
    DIM AS LONG count, z1, z2, lx
    IF (tx$ = "") OR (delim$ = "") THEN
        CountString% = 0
        EXIT FUNCTION
    END IF
    lx = LEN(delim$)
    z1 = 1
    z2 = INSTR(tx$, delim$)
    count = 0
    DO UNTIL z2 = 0
        count = count + 1
        z1 = z2 + lx
        z2 = INSTR(z1, tx$, delim$)
    LOOP
    CountString% = count
END FUNCTION

Otherwise the music pitch was going too high. I desired to include staccato play option like my other program, and I neglected the sinewave. Yeah it's boring and absolutely needs the octave to start at 2 instead of 3 because the highest pitches could barely be heard...

Fixed measuring wrong which was "L4." then "L16". The last one should be "L8", that is three "L8" of one note, then one "L8" of different note.

I also changed it so it involves way more volume commands -- make it more dynamic. But I wish I could clean up all those angle brackets which look unsightly. Could take down about half the string changing all the ">>" into "O4", and delete the corresponding "<<" while the base is "O2", or something like that.

Now chunks of the PLAY string are played while the program checks for escape key press to quit. EDIT: was forced to change where _CLIPBOARD$ resided because I had a good one playing and, in the process of copying and pasting this text into the forum I lost the song. (boo-hoo)

EDIT: Having problems with Firefox on Manjaro KDE and other stuff so I also added the ability to save to a BAS file called "mnrvovrfc-musak.bas" in the same directory as the executable, with the created PLAY string completed or not, and ready to be loaded and run into the QB64 IDE.
Reply
#14
OK v3.8 installed and latest Musak! version tested.

Some notes seem out of tune not in scales. But this sounded better to my ears:
   
(Missing starting code)

Can you see why this is different that first 3-4 ran?
b = b + ...
Reply
#15
The scales are decided randomly, just advance "current base note" by 3, 4, 5 or 6 to have five notes to work with for each group called a scale. As I've said before, I don't have enough music education to go into Phrygian and other such scales, and less those used in Old World ethnic music.

If you take a closer look at the program, it mostly goes along with "ABA" song divison format. The second "A", however has additional small "phrases" that are added, which are not included near the beginning of the song. The "B" division was meant to be totally different with the way the program was written, but it really should try to be as similar as possible to "A".

Even more variety with note lengths could be added especially for dotted-lengths but adding those are tricky. To get better at it must issue notes as "A4.C4C4" instead of "L4A.CE".

Are you able to paste from this program into a text editor or this forum's reply window? What happened to the text file that I was forced to have it write?
Reply
#16
Quote:Are you able to paste from this program into a text editor or this forum's reply window? What happened to the text file that I was forced to have it write?

Ah, let me check my brand spank'n new QB64pe v3.8 folder, here it is:
Quote:PLAY "MBMST180@1O2L16V12G>V25C<>V50G<V25GL4>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50G>V12D#<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L16V12G>V25C<>V50G<V25GL4>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50G>V12D#<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L16>V50C<>>V12C#<<>V50G<>>V12C#<<L4>V50G<L16V12G>V50D#<V25G>V50G<L4V12GL8V25G>V50D#<L4>V12C<L8V25GL4>V50C<L8>V25D#<L4V50G>V12D#<L8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L4>V25C<L8>V12D#<L4>V12C<L8>>V50C#<<>V12C<L8V25G>V12C<L16V50G>V25G<>V50C<>V25C<L16V12G>V50G<L8V25GL4V12GL8V25G>V12C<L16>V25D#<>V12G<>V50G<>V12D#<L16>V12C<>V50C<L8>>V12C#<<L4V50GL8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50GL8>V12D#<>V25C<L4>V50C<L8>>V25C#<<L8V12GV25GL16>V12G<>V50D#<>V12G<>V25G<L8V12G>V50C<>V12D#<>>V25C#<<L4>V12C<L8>V50G<>V12G<L16>V12C<>V50C<L8>>V12C#<<L4V50GL8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50GL8>V12D#<>V25C<L8V50G>V25D#<L16>V12G<>>V25C#<<V50G>V25C<L4V25GL8>V12G<L16>V50C<>>V12C#<<>V50G<>>V12C#<<L4>V50G<L16V12G>V50D#<V25G>V50G<L4V12GL16V12G>V25C<>V50G<V25GL4>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50G>V12D#<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L16V12G>V25C<>V50G<V25GL4>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50G>V12D#<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L8V25G>V50D#<L4>V12C<L8V25GL4>V50C<L8>V25D#<L4>V12C<L8>>V50C#<<>V12C<L8V25G>V12C<L16V50G>V25G<>V50C<>V25C<L4V50G>V12D#<L8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L4>V25C<L8>V12D#<L16V12G>V50G<L8V25GL4V12GL8V25G>V12C<L16>V25D#<>V12G<>V50G<>V12D#<L4>V50C<L8>>V25C#<<L8V12GV25GL16>V12G<>V50D#<>V12G<>V25G<L16>V12C<>V50C<L8>>V12C#<<L4V50GL8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50GL8>V12D#<>V25C<L8V12G>V50C<>V12D#<>>V25C#<<L4>V12C<L8>V50G<>V12G<L8V50G>V25D#<L16>V12G<>>V25C#<<V50G>V25C<L4V25GL8>V12G<L8>V12F#<>>V50C<<L4>>V12D#<<L4>V50F#<>V25F#<L4>>V25D#.<<L8>>V50C<<L4>V50F#<>V25F#<L4>V50F#<>V25F#<L8>V12F#<>>V50C<<L4>>V12D#<<L16>V50F#<V12GL8>V50F#<L4V12GL8>V50C#<>V12F#<L4>V50F#<L16>V50F#<V12GL8>V50F#<L4V12GL8>V12F#<>>V50C<<L4>>V12D#<<L16>V50F#<V12GL8>V50F#<L4V12GL4>V12F#<L8>>V50D#<<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L16>>V12D#<<>>V25C<<>>V12C<<>V25F#<L4>>V12D#<<L8>>V25C<<>>V50C<<L16V25G>V12F#<V50G>V12F#<L8>V50C#<L4V25GL8>>V12C<<L8>>V12C<<L16>V50F#<>>V12C<<L8>>V50C<<L16>V25F#<>V50F#<L4>>V25D#.<<L8>>V50C<<L4>V12F#<L8>>V50D#<<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L8>>V12C<<L16>V50F#<>>V12C<<L8>>V50C<<L16>V25F#<>V50F#<L4>>V25D#.<<L8>>V50C<<L4>V12F#<L8>>V50D#<<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L8>>V25D#<<L16V12G>V25F#<L8V50GL16>V25F#<>V50C#<L16V12G>V50F#<L8>V12C#<L4>V50F#<L16>>V25C<<>V50F#<L8>V25C#<L4>>V50C<<L4>V12C#<>V50F#<L4>V50F#<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L4>>V25D#.<<L8>>V50C<<L8>V12F#<>>V50C<<L4>>V12D#<<L4>V50F#<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L4>>V25D#.<<L8>>V50C<<L8>V12F#<>>V50C<<L4>>V12D#<<L8>>V25C<<L16>>V12D#<<>>V25D#<<L8V50GL16>V25C#<>V50F#<L4>>V25D#.<<L8>>V50C<<L8>>V12C<<L16>V50F#<>>V12C<<L8>>V50C<<L16>V25F#<>V50F#<L8V25GL4V50GL8>V25C#<L8>>V12C<<L16>V50F#<>>V12C<<L8>>V50C<<L16>V25F#<>V50F#<L4>>V25D#.<<L8>>V50C<<L4>V12F#<L8>>V50D#<<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L8>>V12C<<L16>V50F#<>>V12C<<L8>>V50C<<L16>V25F#<>V50F#<L4>>V25D#.<<L8>>V50C<<L4>V12F#<L8>>V50D#<<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L4>V50F#<>V25F#<L8>V12F#<>>V50C<<L4>>V12D#<<L16>V50F#<V12GL8>V50F#<L4V12GL8>V50C#<>V12F#<L4>V50F#<L8>>V12C<<L16>V50F#<>>V12C<<L8>>V50C<<L16>V25F#<>V50F#<L4>>V25D#.<<L8>>V50C<<L4>V12F#<L8>>V50D#<<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L8>>V12C<<L16>V50F#<>>V12C<<L8>>V50C<<L16>V25F#<>V50F#<L4>>V25D#.<<L8>>V50C<<L4>V12F#<L8>>V50D#<<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L16>>V12D#<<>>V25C<<>>V12C<<>V25F#<L4>>V12D#<<L8>>V25C<<>>V50C<<L16V25G>V12F#<V50G>V12F#<L8>V50C#<L4V25GL8>>V12C<<L4>V50F#<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L4>>V25D#.<<L8>>V50C<<L8>V12F#<>>V50C<<L4>>V12D#<<L4>V50F#<>V25F#<L4>V12F#<L8>>V50D#<<>V25F#<L4>>V25D#.<<L8>>V50C<<L8>V12F#<>>V50C<<L4>>V12D#<<L8>>V25D#<<L16V12G>V25F#<L8V50GL16>V25F#<>V50C#<L16V12G>V50F#<L8>V12C#<L4>V50F#<L16>>V25C<<>V50F#<L8>V25C#<L4>>V50C<<L4>V12C#<>V50F#<L16>V12C<>V50C<L8>>V12C#<<L4V50GL8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50GL8>V12D#<>V25C<L16>V50C<>>V12C#<<>V50G<>>V12C#<<L4>V50G<L16V12G>V50D#<V25G>V50G<L4V12GL8V25G>V50D#<L4>V12C<L8V25GL4>V50C<L8>V25D#<L4V50G>V12D#<L8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L4>V25C<L8>V12D#<L4>V12C<L8>>V50C#<<>V12C<L8V25G>V12C<L16V50G>V25G<>V50C<>V25C<L16V12G>V50G<L8V25GL4V12GL8V25G>V12C<L16>V25D#<>V12G<>V50G<>V12D#<L16>V12C<>V50C<L8>>V12C#<<L4V50GL8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50GL8>V12D#<>V25C<L4>V50C<L8>>V25C#<<L8V12GV25GL16>V12G<>V50D#<>V12G<>V25G<L8V12G>V50C<>V12D#<>>V25C#<<L4>V12C<L8>V50G<>V12G<L4V50GL8>V12D#<>V25C<L8>V25C<L4>V12D#<L8>V25G<L16V12G>V25C<>V50G<V25GL4>V12G<L8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L8V50G>V25D#<L16>V12G<>>V25C#<<V50G>V25C<L8V50G>V12C<>V50D#<V25GL4>V12C<>V25D#<L8V12GL16>>V25C#<<V50GL8>V25D#<L16V12G>V25D#<L8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L4V50G>V12D#<L16V12G>V25C<>V50G<V25GL4>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L4V50G>V12D#<L16V12G>V25C<>V50G<V25GL4>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L16>V50C<V12GL8>V25C<L4>V50D#<L4V25G>>V50C#<<L8V12GL4>V25C<L8>>V50C#<<L8V12GV25GL16>V50G<>>V25C#<<>V50G<>V12C<L4V50GL8>V12D#<>V25C<L8>V25C<L4>V12D#<L8>V25G<L16V12G>V25C<>V50G<V25GL4>V12G<L8V12GL16>V50G<>V25C<L8>V50C<L16>V25D#<>V12G<L16V50G>V12G<L8>V50D#<L4>V12G<L4V25GL8>V12G<L16>V50C<>>V12C#<<>V50G<>>V12C#<<L4>V50G<L16V12G>V50D#<V25G>V50G<L4V12GL16V12G>V25C<>V50G<V25GL4>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50G>V12D#<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L16V12G>V25C<>V50G<V25GL4>V12G<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L4V50G>V12D#<L8V25G>V50C<L16>V12C<>V50C<>V12G<>V25G<L8V25G>V50D#<L4>V12C<L8V25GL4>V50C<L8>V25D#<L4>V12C<L8>>V50C#<<>V12C<L8V25G>V12C<L16V50G>V25G<>V50C<>V25C<"

But that's not the one I wanted to share, it sounds like one of the previous. I suppose I quit program before it had chance to write the one I caught a snapshot of.

You do seem to have repeated patterns with variations in the Musak Smile
b = b + ...
Reply
#17
Near the top of the most recent code, it could be modified like this:

Code: (Select All)

DIM firstnote AS INTEGER

RANDOMIZE TIMER

firstnote = Random1(12) * 2 - 1
octav$ = "O3"
double1 = Random1(2) - 1
double2 = Random1(2) - 1
FOR y = 1 TO 2
basenote = firstnote
FOR x = 1 TO 5
scales(y, x) = basenote
basenote = basenote + Rand(3, 6) * 2
if y = 1 and basenote >= 40 then octav$ = "O2"
NEXT
NEXT

to make the song divisions "A" and "B" more like each other, but only for pitches. A better way is to ditch the "B" division altogether and have 10 "phrases" based on the same five notes of the scale.

The live playback is a bit disturbed on my computer especially after it gets to the second "A" division. Sometimes it displays a longer string than before that it doesn't finish processing. So it's a good thing I had it writing a BAS file so the musak stays on the beat always.

The "phrases" idea would be nice for "space music" LOL involving the "N" command of PLAY and fast runs of notes. Only if that sinewave could be heard at higher frequencies. For multichannel sound it might be better to avoid PLAY, and figure out how to do surfs and eerie noises as the background channel, with the "space music" in front. In the old forum I liked Mr.Why's experimentations with _SNDRAW.
Reply
#18
I notice the comment in the code (that KiloManjaro posted) saying it requires a certain version of QB64PE. I can't remember the way to check the compiler version and display an error if they're using the wrong one. I used to do it all the time. I just can't remember how to do it.
Schuwatch!
Yes, it's me. Now shut up.
Reply
#19
(06-26-2023, 11:38 AM)Ultraman Wrote: I notice the comment in the code (that KiloManjaro posted) saying it requires a certain version of QB64PE. I can't remember the way to check the compiler version and display an error if they're using the wrong one. I used to do it all the time. I just can't remember how to do it.

Would a search of the exe file for "QB64pe" (not case sensitive) be fruitful for getting the version of QB64PE?
b = b + ...
Reply
#20
It's an actual metacommand in the language but I just don't remember how to do it. Matt or Samuel should know how to do it.
Schuwatch!
Yes, it's me. Now shut up.
Reply




Users browsing this thread: 3 Guest(s)