Re: [LAU] Theramin oscillator for LADSPA?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Fons Adriaensen <fons@...>
Cc: Linux Audio User <linux-audio-user@...>
Date: Sunday, October 6, 2013 - 9:12 pm

--001a11c379ecb36f5b04e818fc29
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Oct 6, 2013 at 9:59 PM, Fons Adriaensen wrote:

> #!/usr/bin/python

Wauw, that's a golden nugget of Python! Cheers, -Harry

--001a11c379ecb36f5b04e818fc29
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On S=
un, Oct 6, 2013 at 9:59 PM, Fons Adriaensen <fons@linuxaudio.org&g=
t; wrote:

#!/usr/bin/python

from math import *

X =3D [ 0.00, =A00.70, =A01.30, =A02.00, =A02.70, =A03.25, =A04.00, =A04.65=
, =A05.15, =A05.85,
=A0 =A0 =A0 6.35, =A06.95, =A07.40, =A07.95, =A08.30, =A08.75, =A09.10, =A0=
9.55, 10.00, 10.25,
=A0 =A0 =A010.55, 10.90, 11.20, 11.53, 11.70, 11.40, 10.98, 10.10, =A09.10,=
=A08.00,
=A0 =A0 =A0 6.90, =A05.75, =A04.45, =A03.20, =A02.10, =A01.01, =A00.00, -1.=
00, -1.98, -2.90,
=A0 =A0 =A0-3.70, -4.25, -5.00, -5.60, -6.10, -6.60, -7.02, -7.35, -7.80, -=
8.00,
=A0 =A0 =A0-8.15, -8.30, -8.40, -8.46, -8.50, -8.50, -8.47, -8.45, -8.27, -=
8.10,
=A0 =A0 =A0-7.99, -7.80, -7.55, -7.25, -7.00, -6.67, -6.35, -6.05, -5.65, -=
5.30,
=A0 =A0 =A0-4.98, -4.50, -4.05, -3.60, -3.05, -2.60, -2.00, -1.45, -0.80 ]<=
br>

N =3D len(X)

def analyse(f):
=A0 =A0 sx =3D 0
=A0 =A0 sy =3D 0
=A0 =A0 w =3D f * 2 * pi / N
=A0 =A0 for i in range(N):
=A0 =A0 =A0 =A0 sx +=3D X [i] * sin (i * w)
=A0 =A0 =A0 =A0 sy +=3D X [i] * cos (i * w)
=A0 =A0 m =3D hypot (sx, sy)
=A0 =A0 a =3D atan2(sy, sx) * 180 / pi
=A0 =A0 return m, a

for i in range (1, 11):
=A0 =A0 m, a =3D analyse (i)
=A0 =A0 if i =3D=3D 1: m1 =3D m
=A0 =A0 print ("%3d %10.3f %8.1f" % (i, m / m1, a))
Wauw, that's a golden nugget of Python=
! Cheers, -Harry=A0

--001a11c379ecb36f5b04e818fc29--

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] Theramin oscillator for LADSPA?, Ken Restivo, (Sun Oct 6, 8:59 am)
Re: [LAU] Theramin oscillator for LADSPA?, Fons Adriaensen, (Sun Oct 6, 10:55 am)
Re: [LAU] Theramin oscillator for LADSPA?, Ken Restivo, (Sun Oct 6, 8:29 pm)
Re: [LAU] Theramin oscillator for LADSPA?, Lorenzo Sutton, (Tue Oct 8, 2:50 pm)
Re: [LAU] Theramin oscillator for LADSPA?, Fons Adriaensen, (Sun Oct 6, 8:59 pm)
Re: [LAU] Theramin oscillator for LADSPA?, Lieven Moors, (Mon Oct 7, 7:38 pm)
Re: [LAU] Theramin oscillator for LADSPA?, Harry van Haaren, (Sun Oct 6, 9:12 pm)
Re: [LAU] Theramin oscillator for LADSPA?, Will Godfrey, (Sun Oct 6, 8:38 pm)
Re: [LAU] Theramin oscillator for LADSPA?, David Santamauro, (Sun Oct 6, 11:25 am)