Csound Csound-dev Csound-tekno Search About

[Csnd] playing with the superformula

Date2018-07-22 14:52
FromRichard
Subject[Csnd] playing with the superformula
I have been playing with the superformula to generate a table in Csound. 
It was most easy to use ctcsound inside csound to generate this. See 
also: https://bl.ocks.org/mbostock/1021103
Here is a quick tryout:
You can change the parameters (a,b,m, n1,..) to make interesting sounds...



   -odac3



sr     = 48000
ksmps  = 100
nchnls = 2
0dbfs = 1

pyinit ;Start python interpreter

pyruni {{
import ctcsound
import sys
import numpy as np

# Get an opaque pointer to the running Csound instance
# and print Python version number
p = _CSOUND_
print("\\n  --> Python version number: {}\\n".format(sys.version_info[0]))
# Create an object called cs from the ctcsound.Csound class
# using the opaque pointer to the Csound instance
cs = ctcsound.Csound(pointer_=p)
}}

instr 1
   ; Use the cs python object
   pyruni {{
print("\\n  --> Sample Rate: {}, Control Rate: {}\\n".format(cs.sr(), 
cs.kr()))
l = cs.tableLength(1)
print("\\n  --> TableGet: {}, len:{}\\n".format(cs.tableGet(1,0), l))

def R(rho, a, b, m, n1, n2, n3):
     r = np.abs(np.abs(np.cos(m * rho / 4.0)) / a) ** n2 + 
np.abs(np.abs(np.sin(m * rho / 4.0)) / b) ** n3
     r = np.abs(r) ** (-1 / n1)
     return r

i = 0
while i

f1 0 16384 10 1

i1 0 2
i2 2 4



Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here