Jump to content
You must now use your email address to sign in [click for more info] ×

How do I write the equation for a sine wave?


Recommended Posts

Ok, I have a straight line, and I need to write the equation to make it into a sine wave. Now sine waves are reasonable easy to understand, but I’m afraid the syntax on the Affinity Photo filter is escaping me.

anybody?

 

 

iPad Mini 6.  256GB.

Publisher. Designer. Photo for Mac, PC & iOS 

@Affinity-Inspiration

 

Link to comment
Share on other sites

9 minutes ago, HarryMcGovern said:

Ok, I have a straight line, and I need to write the equation to make it into a sine wave. Now sine waves are reasonable easy to understand, but I’m afraid the syntax on the Affinity Photo filter is escaping me.

anybody?

 

I always read John’s work when trying to remember how these work, perhaps it will help

 

 

My dad always told me, a bad workman always blames their tools….

Just waiting for Ronny Pickering…..

Affinity Photo, Designer, Publisher 1.10 and 2.4 on macOS Sonoma 14 on M1 Mac Mini 16GB 1TB
Affinity Photo, Designer, Publisher 1.10 and 2.4 on Windows 10 Pro. Deceased
Affinity Photo, Designer, Publisher 2.4 on M1 iPad Pro 11” on iPadOS 17.4 
 

https://www.facebook.com/groups/AffinityForiPad

https://www.facebook.com/groups/AffinityPhoto/

The hardest link to find https://affinity.help

Link to comment
Share on other sites

@HarryMcGovern, @Paul Mudditt, you might like to look at my tutorial on using Trig functions in Equations. Use the search box for: distort trig functions. This should find my tutorial.

Note that the Filter > Distort > Equations affects the entire image (pixel layer). If you want to distort a single line, then you would need to select it, along with sufficient elbow room; copy this to the clipboard; then select New from clipboard; then you can apply the filter.

John

Windows 10, Affinity Photo 1.10.5 Designer 1.10.5 and Publisher 1.10.5 (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Link to comment
Share on other sites

Thanks guys. The one on labels will certainly come in handy when doing the labels for my vineyard.

and the second one also very useful. this is what I’m after...

 

“ basic sine function, f (t) = sin(t). This function has an amplitude of 1 because the graph goes one unit up and one unit down from the midline of the graph. This function has a period of because the sine wave repeats every  units.

The graph looks like this:

graph of sine wave, from -2pi to +4pi

 

iPad Mini 6.  256GB.

Publisher. Designer. Photo for Mac, PC & iOS 

@Affinity-Inspiration

 

Link to comment
Share on other sites

Ok, Thanks for all the input folks. I still don't understand the math - but I'm making it work. Thanks especially to @Carl123. His equation got me started. Photo has upgraded since that was done but esentially the same.

The fist image is my version of Revival,

The second image is setting up the sine wave.

 

 

Carl123-Revival 01.png

Carl123-Revival SineWave 01.png

 

iPad Mini 6.  256GB.

Publisher. Designer. Photo for Mac, PC & iOS 

@Affinity-Inspiration

 

Link to comment
Share on other sites

I have just tried to create a sine wave using equations as I have done before. The argument of the sine function now seems to be in radians, where it was degrees before. I presume this is a change in 1.8.

I created a straight line in a blank document 250 px high and 800 wide.

1420267656_StraightLine.png.9e154196c26c882ca2bd7ffa988a5008.png

I wished to create a sine wave of three cycles, so the multiplier in the sine function is three times two pi, or 6*pi.

In Filters > Distort > Equations,  I entered

x=x
y+100*sin(6*pi*x/w)

13949607_SineWave.png.e5ffe6e1a205da8bc802c3907fe7a40c.png

John

Windows 10, Affinity Photo 1.10.5 Designer 1.10.5 and Publisher 1.10.5 (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Link to comment
Share on other sites

6 hours ago, John Rostron said:

I have just tried to create a sine wave using equations as I have done before. The argument of the sine function now seems to be in radians, where it was degrees before. I presume this is a change in 1.8.

I created a straight line in a blank document 250 px high and 800 wide.

1420267656_StraightLine.png.9e154196c26c882ca2bd7ffa988a5008.png

I wished to create a sine wave of three cycles, so the multiplier in the sine function is three times two pi, or 6*pi.

In Filters > Distort > Equations,  I entered

x=x
y+100*sin(6*pi*x/w)

13949607_SineWave.png.e5ffe6e1a205da8bc802c3907fe7a40c.png

John

Thanks John,

Great stuff. Lots of experimentation ahead.

Screenshot 2020-04-02 16.05.48.png

 

iPad Mini 6.  256GB.

Publisher. Designer. Photo for Mac, PC & iOS 

@Affinity-Inspiration

 

Link to comment
Share on other sites

23 hours ago, John Rostron said:

wished to create a sine wave of three cycles, so the multiplier in the sine function is three times two pi, or 6*pi.

In Filters > Distort > Equations,  I entered

x=x
y+100*sin(6*pi*x/w)

On the iPad their is simply an Equations filter, so the process is Filters/Equations after which I then entered x=x and y+100*sin(6*pi*x/w) but the line remained straight. I changed the x=x to simply x and then the sine wave appeared. Perhaps I simply misunderstood John's directions or is this a difference between desktop and iPad?

 

M1 IPad Air 10.9/256GB   lpadOS 17.1.1 Apple Pencil (2nd gen).
Affinity Photo 1.10.5 Affinity Design 1.10.5 
Affinity Publisher 2, Affinity Designer 2, Affinity Photo 2 and betas.

Official Online iPad Help documents (multi-lingual) here: https://affinity.https://affinity.help/ 

 

Link to comment
Share on other sites

2 minutes ago, DM1 said:

On the iPad their is simply an Equations filter, so the process is Filters/Equations after which I then entered x=x and y+100*sin(6*pi*x/w) but the line remained straight. I changed the x=x to simply x and then the sine wave appeared. Perhaps I simply misunderstood John's directions or is this a difference between desktop and iPad?

 

Thanks for that heads up. I truly suspect that the ipad version is broken. For a start - part of the Equations editor is missing entirely. You are right about the x=x bit. Just leave that out. I'll experiment more with the ipad version anyway, as it's interesting anyway.

 

iPad Mini 6.  256GB.

Publisher. Designer. Photo for Mac, PC & iOS 

@Affinity-Inspiration

 

Link to comment
Share on other sites

@HarryMcGovern, The 'x=' and 'y='' are already part of the equations dialogue. When I make a text record of a macro, I include these prefixes. I had not realised this when I posted these formulas above.

Sorry for the confusion. Mea culpa.

John

Windows 10, Affinity Photo 1.10.5 Designer 1.10.5 and Publisher 1.10.5 (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Link to comment
Share on other sites

2 hours ago, HarryMcGovern said:

I truly suspect that the ipad version is broken. For a start - part of the Equations editor is missing entirely.

Comparing the iPad equation filter to your posted image of desktop panel,  the switch to choose angular units (degrees or radians) Is missing, however switching from Cartesian to Polar in the Context menu automatically sets the equation parameters to 'r' (radius) and theta (polar angle). In practice Polar angles may be expressed either in degrees or radians. Given the missing switch I'm not sure which is applicable for this equations filter.  The help file is not particularly helpful either.

D26BA293-F5F8-4E6D-80B9-813B31A8F008.png

M1 IPad Air 10.9/256GB   lpadOS 17.1.1 Apple Pencil (2nd gen).
Affinity Photo 1.10.5 Affinity Design 1.10.5 
Affinity Publisher 2, Affinity Designer 2, Affinity Photo 2 and betas.

Official Online iPad Help documents (multi-lingual) here: https://affinity.https://affinity.help/ 

 

Link to comment
Share on other sites

  • 2 weeks later...
4 hours ago, HarryMcGovern said:

Is it possible to create an audio equation like this?

That pattern does not look like something that was generated by an equation, so my guess is that you would not be able to write an equation for it.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

34 minutes ago, HarryMcGovern said:

No, it’s an audio wave, but audio waves can be shown in equation form but I just don’t know the math 😞 It’s shown on Wikipedia under Sine Waves I think it was. Back to the books...

Yes in theory you could generate this but doing a Fourier analysis to give you the harmonic values would be very complex over just manually drawing it if real accuracy is not required. Can I ask why you would want something so visibly complex?

 

My dad always told me, a bad workman always blames their tools….

Just waiting for Ronny Pickering…..

Affinity Photo, Designer, Publisher 1.10 and 2.4 on macOS Sonoma 14 on M1 Mac Mini 16GB 1TB
Affinity Photo, Designer, Publisher 1.10 and 2.4 on Windows 10 Pro. Deceased
Affinity Photo, Designer, Publisher 2.4 on M1 iPad Pro 11” on iPadOS 17.4 
 

https://www.facebook.com/groups/AffinityForiPad

https://www.facebook.com/groups/AffinityPhoto/

The hardest link to find https://affinity.help

Link to comment
Share on other sites

29 minutes ago, Paul Mudditt said:

Yes in theory you could generate this but doing a Fourier analysis to give you the harmonic values would be very complex over just manually drawing it if real accuracy is not required. Can I ask why you would want something so visibly complex?

Why? Well I guess I’m always trying to push great software like this to its limits. See just what is possible. I mean equations. That speaks of someone behind the scenes interested in more than just ‘nice patterns’.

A fixed sine wave is as we know a graph of a specific frequency, but audio is not fixed and the sine wave fluctuates. I just want to see if I can graph it. But probably not possible.

 

iPad Mini 6.  256GB.

Publisher. Designer. Photo for Mac, PC & iOS 

@Affinity-Inspiration

 

Link to comment
Share on other sites

I think there are really two questions, Harry:

  1. Do you know an equation to generate a waveform like that.
  2. Can you write that equation in Affinity.

#1 is something to be researched elsewhere. But given an answer to it, #2 may be interesting to readers of this forum :)

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

Generating a random sign wave (audio wave) is difficult.  It would be easier if the expressions you can use in the equations filter included a random number generator.

y+200*sin(a*0.1*x)+(200*sin(b*0.1*x))+(200*sin(c*0.1*x))

 

speech.png

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Link to comment
Share on other sites

2 hours ago, carl123 said:

Generating a random sign wave (audio wave) is difficult.  It would be easier if the expressions you can use in the equations filter included a random number generator.

y+200*sin(a*0.1*x)+(200*sin(b*0.1*x))+(200*sin(c*0.1*x))

 

speech.png

That’s really interesting, thank you so much. It’s a struggle on the iPad... but desktop good. This allows me to create some really random, unique designs. 

 

iPad Mini 6.  256GB.

Publisher. Designer. Photo for Mac, PC & iOS 

@Affinity-Inspiration

 

Link to comment
Share on other sites

11 hours ago, HarryMcGovern said:

This allows me to create some really random, unique designs. 

Please share any additional interesting equation formulas you discover. The Equations Filter is quite powerful but there is very little documentation for it so the only way for some people to understand what it can do and to experiment more is via this forum

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Link to comment
Share on other sites

  • 1 year later...

iMac 27" 2019 Somona 14.3.1, iMac 27" Affinity Designer, Photo & Publisher V1 & V2, Adobe, Inkscape, Vectorstyler, Blender, C4D, Sketchup + more... XP-Pen Artist-22E, - iPad Pro 12.9  
B| (Please refrain from licking the screen while using this forum)

Affinity Help - Affinity Desktop Tutorials - Feedback - FAQ - most asked questions

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.