Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Anything more complicated...
by
munair
[
Today
at 09:51:55 pm]
How can I make an externa...
by
Sander
[
Today
at 09:51:14 pm]
Lazarus Release 4.0
by
dhatlestad
[
Today
at 08:41:24 pm]
How to close a window whi...
by
sensui
[
Today
at 08:32:27 pm]
Feature Request/Suggestio...
by
Martin_fr
[
Today
at 08:28:36 pm]
Database Locked Exception
by
cdbc
[
Today
at 08:24:46 pm]
Learn how to (un)dock a T...
by
Hansvb
[
Today
at 08:16:05 pm]
Certifying windows execut...
by
ASBzone
[
Today
at 08:08:19 pm]
fpc 3.2.2 + win32api Call...
by
paule32
[
Today
at 08:01:05 pm]
[SOLVED]Help: Need Advice...
by
TBMan
[
Today
at 07:26:38 pm]
IDE crashes and takes so ...
by
Martin_fr
[
Today
at 06:26:16 pm]
full featured Android Nat...
by
Handoko
[
Today
at 06:21:06 pm]
Automatically compiling d...
by
MarkMLl
[
Today
at 03:04:01 pm]
Error trying to initializ...
by
silvercoder70
[
Today
at 02:30:07 pm]
Unable to access the wiki
by
Aruna
[
Today
at 01:36:51 pm]
Unexpected highlighted li...
by
Thaddy
[
Today
at 11:30:15 am]
[SOLVED] How to define a ...
by
440bx
[
Today
at 11:29:40 am]
Volunteering Partner Need...
by
Thaddy
[
Today
at 11:22:09 am]
I can write your README.m...
by
cdbc
[
Today
at 09:19:09 am]
64 bits and PascalScript
by
Thaddy
[
Today
at 09:14:00 am]
[SOLVED] How to "Jump To"...
by
cdbc
[
Today
at 07:41:56 am]
Feature announcement: Fun...
by
Thaddy
[
Today
at 07:29:24 am]
Windows Sleep precision
by
Sander
[
Today
at 12:46:20 am]
Groupview Partial loading...
by
AlexTP
[May 20, 2025, 10:37:31 pm]
Acessing a file dialog fr...
by
Remy Lebeau
[May 20, 2025, 10:15:44 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Peter de Jong Attractor: Bgrabmp Colouring Help Needed ? (Read 479 times)
Boleeman
Hero Member
Posts: 910
Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
«
on:
April 16, 2025, 10:19:59 am »
I made a Lazarus program that creates Peter de Jong Attractors.
I am trying to get a
smooth high coloured rainbow effect
like at
https://richardrosenman.com/shop/peter-de-jong-attractor/
I used a TBgrabmap for the rendering but have been struggling to get a high coloured rendering."
Up to version 4, after making a basic rendering and then extending it.
Logged
Thaddy
Hero Member
Posts: 16982
Ceterum censeo Trump esse delendam
Re: Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
«
Reply #1 on:
April 16, 2025, 02:14:43 pm »
Wow. Made me think to apply it to audio:
Code: Pascal
[Select]
[+]
[-]
unit
PeterDeJongAttractor
;
{$mode objfpc}
interface
uses
Math
,
Types
;
type
TDoublePoint
=
record
X
,
Y
:
Double
;
constructor
Create
(
AX
,
AY
:
Double
)
;
end
;
constructor
TDoublePoint
.
Create
(
AX
,
AY
:
Double
)
;
begin
X
:
=
AX
;
Y
:
=
AY
;
end
;
TPDJAttractor
=
class
private
Fx
,
Fy
:
Double
;
FParamA
,
FParamB
,
FParamC
,
FParamD
:
Double
;
public
constructor
Create
(
a
,
b
,
c
,
d
:
Double
)
;
/// Returns the next point in the attractor sequence
function
Iterate
:
TDoublePoint
;
inline
;
/// Reset to initial state (optional)
procedure
Reset
;
inline
;
end
;
implementation
constructor
TPDJAttractor
.
Create
(
a
,
b
,
c
,
d
:
Double
)
;
begin
FParamA
:
=
a
;
FParamB
:
=
b
;
FParamC
:
=
c
;
FParamD
:
=
d
;
Fx
:
=
0
;
Fy
:
=
0
;
end
;
function
TPDJAttractor
.
Iterate
:
TDoublePoint
;
var
newX
,
newY
:
Double
;
begin
newX
:
=
Sin
(
FParamA
*
Fy
)
-
Cos
(
FParamB
*
Fx
)
;
newY
:
=
Sin
(
FParamC
*
Fx
)
-
Cos
(
FParamD
*
Fy
)
;
Fx
:
=
newX
;
Fy
:
=
newY
;
Result
:
=
TDoublePoint
.
Create
(
newX
,
newY
)
;
end
;
procedure
TPDJAttractor
.
Reset
;
begin
Fx
:
=
0
;
Fy
:
=
0
;
end
;
end
.
Then:
Code: Pascal
[Select]
[+]
[-]
procedure
TMyVSTModule
.
ProcessAudioBlock
(
Buffer
:
PSingle
;
SampleCount
:
Integer
)
;
var
i
:
Integer
;
AttractorPoint
:
TDoublePoint
;
ModulationValue
:
Single
;
begin
for
i
:
=
0
to
SampleCount
-
1
do
begin
// Retrieve the current attractor values (could be at a slower modulation rate)
AttractorPoint
:
=
FMyAttractor
.
Iterate
;
// Map the output to a useful modulation range. For example, normalize and scale:
ModulationValue
:
=
(
CSng
(
AttractorPoint
.
X
)
+
2
)
/
4
;
// maps from [-2,2] to [0,1]
// Use ModulationValue to influence a parameter in your DSP code:
// For example, adjust oscillator frequency, filter cutoff, etc.
ApplyModulationToYourDSP
(
ModulationValue
)
;
// Continue processing audio...
Buffer
[
i
]
:
=
ProcessSample
(
Buffer
[
i
]
)
;
end
;
end
;
I think I have a VST to write....This is just a scetch.
You can probably also use this simple unit for your graphics purpose.
«
Last Edit: April 16, 2025, 02:55:37 pm by Thaddy
»
Logged
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.
Boleeman
Hero Member
Posts: 910
Re: Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
«
Reply #2 on:
April 17, 2025, 01:44:08 am »
Wondered how that audio version would sound ?
There are lots of graphic versions about , written in other languages but never thought of audio versions.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
TinyPortal
© 2005-2018