News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Beautiful Lissajous Curve

Started by six_L, October 21, 2024, 01:18:01 PM

Previous topic - Next topic

six_L

Hi,All

Core code:
GenerateAlgoCurve proc uses rbx @@pGraphics:QWORD
    LOCAL Fmin:REAL10
    LOCAL Fmax:REAL10
    local aa:REAL10
    local bb:REAL10
    local theta:REAL10
    local x00:REAL4
    local y00:REAL4
    local x11:REAL4
    local y11:REAL4
    local @Pen:QWORD
    local xPhase:REAL10
    local nn:REAL10

    ;Lissajous Curve
    ;x(@)=a.sin(@)
    ;y(@)=b.sin(n.@+0)    n >= 1 ,(3.14/2) >= 0 >= O
    ;n: Multiple of frequency
       
    finit
   
    fld    FP10(1.0)   
    fstp    Fmin
    fld    FP10(2.0)   
    fstp    Fmax
    invoke  randf,addr Fmax,addr Fmin       
    fstp    nn

    fldz
    fstp    Fmin
    fldpi            ; 3.14
    fld    FP10(2.0)
    fdiv            ; 3.14/2
    fstp    Fmax
    invoke  randf,addr Fmax,addr Fmin        ;st0=[@Fmin,@Fmax)
    fstp    xPhase

   
    fldz
    fstp    theta

    fld    FP10(295.11)    ;a=width
    fstp    aa

    fld    FP10(240.07)    ;b=height
    fstp    bb

    invoke    GdipCreatePen1,0FF00FF00H,FP4(0.5),0,addr @Pen    ;FP4(0.5) pen width,
    xor    rbx,rbx
    .repeat
        fld    theta
        fldpi            ; 3.14
        fmul            ; theta*3.14
        fld    FP10(180.0)
        fdiv
        fsin            ; sin(theta*3.14/180)
        fld    aa
        fmul            ; a*sin(theta*3.14/180)
        fstp    x11
       
        fld    theta
        fldpi            ; 3.14
        fmul            ; theta*3.14/180
        fld    FP10(180.0)
        fdiv
        fld    nn
        fmul            ; n*(theta*3.14/180)
        fld    xPhase
        fadd            ; n*(theta*3.14/180)+xPhase
       
        fsin            ; sin(n*(theta*3.14/180)+xPhase)
        fld    bb
        fmul            ; b*sin(n*(theta*3.14/180)+xPhase)
        fstp    y11
       
        ;move to the center
        fld    FP10(420.5)
        fld    x11
        fadd
        fstp    x00
       
        fld    FP10(310.5)
        fld    y11
        fadd
        fstp    y00
       
        invoke    GdipDrawEllipse,@@pGraphics,@Pen,x00,y00,FP4(2.1),FP4(2.1)
       
        fld    FP10(0.908)        ;step of theta
        fld    theta
        fadd
        fstp    theta

        inc    rbx
    .until rbx == 6000
    invoke    GdipDeletePen,@Pen
    ret

GenerateAlgoCurve endp

the attachment is exe and screenshot.

Say you, Say me, Say the codes together for ever.

fearless

Nice. I had the thought that something like that could be used for a visualizer for music for my media player for example.

TimoVJL

Nice, good for those making rings
May the source be with you

six_L

Hi: fearless,TimoVJL
Thank your recognition.

regard.

@fearless:
QuoteI had the thought that something like that could be used for a visualizer for music for my media player for example.
This is a good research direction.
for instance. Design a symphony assisted rehearsal system to help the symphonic music commander traning orchestra.
the system can find every player's frequency and cycle. Who is playing high or low, long or short, weak or strong?

Say you, Say me, Say the codes together for ever.

NoCforMe

Quote from: six_L on October 24, 2024, 03:51:59 AMThis is a good research direction.
for instance. Design a symphony assisted rehearsal system to help the symphonic music commander traning orchestra.
the system can find every player's frequency and cycle. Who is playing high or low, long or short, weak or strong?


That's not at all how orchestras work, or should work.
They're not music-making machines.
I know; I used to play in them in a previous life ...
Assembly language programming should be fun. That's why I do it.

daydreamer

Quote from: NoCforMe on October 24, 2024, 11:39:22 AM
Quote from: six_L on October 24, 2024, 03:51:59 AMThis is a good research direction.
for instance. Design a symphony assisted rehearsal system to help the symphonic music commander traning orchestra.
the system can find every player's frequency and cycle. Who is playing high or low, long or short, weak or strong?

As a stradivarius violin ? :)


That's not at all how orchestras work, or should work.
They're not music-making machines.
I know; I used to play in them in a previous life ...
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

NoCforMe

Huh? Care to reformat that unintelligible reply?
Assembly language programming should be fun. That's why I do it.

six_L

Hi: NoCforMe,daydreamer
You are lover of classical music at least.

regards.

@NoCforMe:
I didn't know this system already existed.
Say you, Say me, Say the codes together for ever.

NoCforMe

Quote from: six_L on October 24, 2024, 07:31:30 PMI didn't know this system already existed.

You mean the system by which an orchestra learns/is trained to produce a piece of music well?

It's been around for centuries. It's called "opening your ears" (both conductor and players), listening to both yourself and each other.

Well, that and what jazz musicians refer to as "woodshedding" (practice, practice, practice).
Assembly language programming should be fun. That's why I do it.

six_L

#9
Hi, NoCforMe

perhaps its  "opening your ears".

regard.

You have already done the perfect codes. thank you for sharing it.
QuoteA little toy: Lissajous figure demo
https://masm32.com/board/index.php?topic=11132.0
Say you, Say me, Say the codes together for ever.