The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: six_L on October 21, 2024, 01:18:01 PM

Title: Beautiful Lissajous Curve
Post by: six_L on October 21, 2024, 01:18:01 PM
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.

Title: Re: Beautiful Lissajous Curve
Post by: fearless on October 21, 2024, 08:01:56 PM
Nice. I had the thought that something like that could be used for a visualizer for music for my media player for example.
Title: Re: Beautiful Lissajous Curve
Post by: TimoVJL on October 22, 2024, 06:21:48 AM
Nice, good for those making rings
Title: Re: Beautiful Lissajous Curve
Post by: six_L on October 24, 2024, 03:51:59 AM
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?

Title: Re: Beautiful Lissajous Curve
Post by: 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?


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 ...
Title: Re: Beautiful Lissajous Curve
Post by: daydreamer on October 24, 2024, 02:59:18 PM
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 ...
Title: Re: Beautiful Lissajous Curve
Post by: NoCforMe on October 24, 2024, 04:16:18 PM
Huh? Care to reformat that unintelligible reply?
Title: Re: Beautiful Lissajous Curve
Post by: six_L on October 24, 2024, 07:31:30 PM
Hi: NoCforMe,daydreamer
You are lover of classical music at least.

regards.

@NoCforMe:
I didn't know this system already existed.
Title: Re: Beautiful Lissajous Curve
Post by: NoCforMe on October 24, 2024, 08:20:20 PM
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).
Title: Re: Beautiful Lissajous Curve
Post by: six_L on October 25, 2024, 04:14:38 PM
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