by [Theo Verelst] It is fun to use [BWise] to create formulas which are intended to be rendered as musical notes, in this case in line with [Making mathematical waves] I use the Maxima syntax for formulas but we could also use C or even [Exp] type of formulea, and because the block approach doesn't require much recompiling of the result or better put formula translation, this shouldn't be too hard. In this case I approach the making of 3 notes forming achord in a straightforward way, the bocks on the bwise canvas are [Maxima] formula rendering blocks, their output pins contain Maxima mathematics which one could change into other languages, even in parallel by adding more than 1 blockfunction (I've made an example of that somewhere, this is written quickly) and using the propagation function which uses the right block functions. There are three tones made with sine shape and exponential decay, and the blocks are made by hand, like this: newproc {set sine1.o "sin((${sine1.freq})*2*%pi*x)"} sine1 freq o newproc {set sine2.o "sin((${sine2.freq})*2*%pi*x)"} sine2 freq o newproc {set sine3.o "sin((${sine3.freq})*2*%pi*x)"} sine3 freq o newproc {set exp1.o "(${exp1.i})*%e^(-3*x)"} exp1 i o newproc {set exp2.o "(${exp2.i})*%e^(-3*2*x)"} exp2 i o newproc {set exp3.o "(${exp3.i})*%e^(-3*6*x)"} exp3 i o newproc {set add1.o "${add1.i1}+${add1.i2}+${add1.i3}"} add1 {i1 i2 i3} newproc {set div1.o "(${div1.i})/3"} div1 i o Which after dragging in plae and conneting looks like this: [http://82.171.148.176/Bwise/chord1bwise.png] (I added a monitor block, too), the canvas can be downloaded here [http://82.171.148.176/Bwise/canchord1.tcl]. The result at the output of div1 can be gotten by propagating all data through the network, this can be done automatically by: foreach i [net_funct div1] {net_funprop $i} and then get the value by right-clicking for an inspector block on div1, or simply using the console: (Math) 24 % puts ${div1.o} ((sin((440/2)*2*%pi*x))*%e^(-3*x)+(sin(((880/2))*2*%pi*x))*%e^(-3*2*x)+(sin(((3*440/2))*2*%pi*x))*%e^(-3*6*x))/3 Which is the required Maxima formula, which in turn can be fed to the formula rending cgi on my server, and then it is pretty printed: [http://82.171.148.176/Wiki/chord1form.gif] Clearly the three components are visible; all an octave apart. Rendering the first 1/10 sec of the resulting graph is like: [http://82.171.148.176/Wiki/chord1graph.gif] And finally the above mentioned tcl server script also creates a 3 seconds sound file, which can be tried out here [http://82.171.148.176/Wiki/chord1.mp3] Of course the blocks could be made to autogenerate from the canvas popup menu, and maybe given a wizard, and then of course and automatic code generator. The fun is the graph is freely changable and flows through the actual mathematical formula (Maxima is a algebraic manipulating package) and at least easy to read. It is also possible to optimize block results by calling maxima in blocks on the canvas, see [Bwise blocks using exec maxima] (I've made an improved verison for the server, I don't think this page was upgraded). Of course more work is possible in various directions. ---- !!!!!! %| enter categories here |% !!!!!!