electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Digital Chaos
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [22 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Sat Dec 24, 2011 4:55 pm    Post subject: Digital Chaos Reply with quote  Mark this post and the followings unread

I am inspired by the work Ian Fritz (frijitz) is doing with chaos circuits in the analog domain. I wondered if it might be possible to get useful results using digital methods.

So far, so good. I've written a Lorenz attractor design for FPGA that talks to a DAC and sends the X and Y outputs to an oscilloscope.

My method uses 64 bit fixed point arithmetic and does not seem to suffer.

It does, however, use a large amount of FPGA real estate. Not enough to prevent a monosynth in a small FPGA.

Currently, I'm designing a MIDI FM synth that uses the Lorenz outputs as modulators. The speed of the Lorenz system is controllable from LFO range to well into audio frequency.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JLS



Joined: Nov 05, 2005
Posts: 490
Location: Czech
Audio files: 30
G2 patch files: 316

PostPosted: Sun Dec 25, 2011 7:59 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi JovianPyx

This is very interesting for me.

See my little website about chaos http://jlswbs.blogspot.com

_________________
Sorry my bad English Smile
https://soundcloud.com/1jls
https://soundcloud.com/user-819966312-266044932
https://github.com/jlswbs
Back to top
View user's profile Send private message Visit poster's website
BobTheDog



Joined: Feb 28, 2005
Posts: 4044
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Mon Dec 26, 2011 3:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

And me.
Back to top
View user's profile Send private message
frijitz



Joined: May 04, 2007
Posts: 1734
Location: NM USA
Audio files: 54

PostPosted: Tue Dec 27, 2011 12:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

JLS wrote:
See my little website about chaos http://jlswbs.blogspot.com

Nice work! Where did you learn about all those fourth-order systems? What is the definition of hyperchaos for maps (folded towel). I haven't run into that before.

Very Happy

Ian
Back to top
View user's profile Send private message
JLS



Joined: Nov 05, 2005
Posts: 490
Location: Czech
Audio files: 30
G2 patch files: 316

PostPosted: Thu Dec 29, 2011 1:04 am    Post subject: Reply with quote  Mark this post and the followings unread

Sorry i´m not mathematician. Only fractal and chaos fascinating me Smile

Kamil

_________________
Sorry my bad English Smile
https://soundcloud.com/1jls
https://soundcloud.com/user-819966312-266044932
https://github.com/jlswbs
Back to top
View user's profile Send private message Visit poster's website
frijitz



Joined: May 04, 2007
Posts: 1734
Location: NM USA
Audio files: 54

PostPosted: Thu Dec 29, 2011 10:25 am    Post subject: Reply with quote  Mark this post and the followings unread

JLS wrote:
Sorry i´m not mathematician. Only fractal and chaos fascinating me Smile

Same here! I see now that you have links for most of the systems. Thanks!

Very Happy

Ian
Back to top
View user's profile Send private message
JLS



Joined: Nov 05, 2005
Posts: 490
Location: Czech
Audio files: 30
G2 patch files: 316

PostPosted: Tue Mar 06, 2012 4:59 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi JovianPyx

Not news about your interesting project ?

Very thanks info

Kamil

_________________
Sorry my bad English Smile
https://soundcloud.com/1jls
https://soundcloud.com/user-819966312-266044932
https://github.com/jlswbs
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Tue Mar 06, 2012 6:19 am    Post subject: Reply with quote  Mark this post and the followings unread

Sidetracks... Always sidetracks.

I got involvled with studying the soultion to the wave equation with the finite difference method to implement a string physical model. This has turned out to be more of a math learning experience than a practical exercise. What I discovered is that while the finite difference method can present a more accurate model of piano string (for example), the algorithm requires substantially more computing power and storage than the Karplus-Strong digital waveguide method. It doesn't seem to me that a harp with a large number of strings is possible in a low end FPGA. Perhaps when I get a big fat one...

Anyway, I want to return to the Chaos-FM and see what evolves.

Thanks for reminding me - I wandered off and got lost ... Surprised

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JLS



Joined: Nov 05, 2005
Posts: 490
Location: Czech
Audio files: 30
G2 patch files: 316

PostPosted: Tue Mar 06, 2012 7:14 am    Post subject: Reply with quote  Mark this post and the followings unread

Thanks info Smile

P.S. is possible post your dsPIC project source code or info about it (or fpga code - all code very usefull me - im begginer)? Thanks Kamil

_________________
Sorry my bad English Smile
https://soundcloud.com/1jls
https://soundcloud.com/user-819966312-266044932
https://github.com/jlswbs
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Tue Mar 06, 2012 7:32 am    Post subject: Reply with quote  Mark this post and the followings unread

Heh, I think you must be the "sidetrack cop" or something... Smile

That's another thing I need to get back to.

I'm trying to weigh what would be the best project to do. I don't want to do something that is so complex that it won't fit. I do mental calculations (ok, guesses) as to how much structure and functionality I can implement and I'd like to stay away from marginally large designs because of the shoe-horn tweaking one does to cram it into a device that is almost too small.

It's down to one of several possiblities, an additive flute, a 4 string Karplus-Strong bass synth and a 4 voice FM bell synth.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Fri Mar 09, 2012 6:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

Progress has been made.

My previous Lorenz design used a 64x64=128 bit signed multiplier inferred by ISE for the Lorenz Attractor calculations. Although it could do the multiply in one clock (38.4 MHz), that multiplier used 16 dedicated 18x18=36 hardware multipliers (which also disables the associated BRAMs) and a couple of pretty big adders. That much resource usage would have precluded adding synth hardware to it.

I've just tested new multiplier code that takes 5 clocks instead of 1, but uses only 4 dedicated multipliers for the same precision. I have plenty of clocks per sample, so this isn't a problem. I've got it running on my oscope right now.

The extra FPGA real estate freed up will go to an FM monosynth that will be modulated by the Lorenz outputs.

It's currently running on an Avnet Spartan-3A 400 board. I want to finish development there and then move it to a Spartan-3E board (because the SDRAM echo/delay is way fun and makes a monosynth a lot better)

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Sun Mar 11, 2012 1:54 pm    Post subject: Reply with quote  Mark this post and the followings unread

I've moved the code from the Spartan-3A 400K board to a Spartan-3E Starter Kit. The FPGA is 20% larger and better accomodates the design (so far).

What I have is a version of the 16 voice FM bell synth cut down to monosynth and I added the Lorenz code as a module that the synth can use. As such, the design consumes 74% of slices (which is tight, but appears to compile without timing constraint violations). Because the usage is high, I don't know if I'll be able to apply a lot of external control, but we'll see where it goes. I'm about to attempt a modulation experiment and I'll post a sound file when I get that done.

The Lorenz code is quite fat, using over 30% of slices all by itself. The reason is that this kind of algorithm requires high precision arithmetic. The current design uses a 64x64=128 bit signed multiplier and much of the internal data is stored in 128 bit registers. 10.54 fixed point.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JLS



Joined: Nov 05, 2005
Posts: 490
Location: Czech
Audio files: 30
G2 patch files: 316

PostPosted: Mon Mar 12, 2012 5:28 am    Post subject: Reply with quote  Mark this post and the followings unread

Nice info and nice work Smile

Please is possible post me info about fixed point equation for Lorenz attractor ? (mathematical equation or web page link about it) All my known equation is floating point. Thanks help.

Kamil

_________________
Sorry my bad English Smile
https://soundcloud.com/1jls
https://soundcloud.com/user-819966312-266044932
https://github.com/jlswbs
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Mon Mar 12, 2012 6:55 am    Post subject: Reply with quote  Mark this post and the followings unread

In fact, the equations themselves don't change, but the implementation at a code level is a little different.

In this case and within the FPGA, I used a 10.54 method. This means that of the 64 bits used, the structure of the fixed point binary is 10 bits of integer and 54 bits of fraction. The integer contains the sign, so 9 of the bits describe the actual integer absolute value magnitude.

Fixed point binary is done using integer arithmetic and there is no prescale bit shifting necessary as is the case with floating point. One must be careful that the radix point (binary point in this case) remains aligned when doing adds and subtracts. This is exactly the same sort of thing you do with a pencil and paper when you do arithmetic. The principal is identical.

There is some good information on the internet regarding fixed point binary arithmetic.

I am attaching Lorenz.c, a file which contains a fixed point implementation in C (using 33.31 fixed point). It also contains a commented out portion of code at the bottom that implements the Lorenz Attractor in floating point. The program was used to determine the maxima and minima of the output variables X, Y and Z. This information was used to decided how many integer bits were necessary to represent the output values in fixed point binary properly.

Note that the fixed point implementation is not directly supported in C. I had to craft the implementation using arithmetic right shifting to keep the magnitude to scale. Comparing the fixed point with the float should give you an idea of what needs to be done to convert a float design to fixed point.

The main advantage to fixed point is that adds and subtracts and sometimes even multiplies can be accomplished in only one clock cycle (in an FPGA). Using floating point would require more clocks depending on the operation.


Lorenz.c
 Description:
Lorenz.c

Download
 Filename:  Lorenz.c
 Filesize:  7.12 KB
 Downloaded:  525 Time(s)


_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima

Last edited by JovianPyx on Mon Mar 19, 2012 6:02 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
JLS



Joined: Nov 05, 2005
Posts: 490
Location: Czech
Audio files: 30
G2 patch files: 316

PostPosted: Mon Mar 12, 2012 7:38 am    Post subject: Reply with quote  Mark this post and the followings unread

Many many thanks - this is great example Smile

Kamil

_________________
Sorry my bad English Smile
https://soundcloud.com/1jls
https://soundcloud.com/user-819966312-266044932
https://github.com/jlswbs
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Mon Mar 12, 2012 2:00 pm    Post subject: Reply with quote  Mark this post and the followings unread

I have a working FPGA design of an FM monosynth (4x2op) with 3 of the carrier to modulation ratio parameters modulated by the output of a Lorenz Attractor digital model.

The synth also has echo/delay, so I used some of that too.

Other attractors could be substituted by replacing the Lorenz module with a state machine that does whatever attractor desired.

Here is a demonstration audio file I made while doing my first tests of the system. I made changes to the h parameter and occasionally to the integer setting of the carrier to modulation ratio (which caused what sounds like new notes). The design was pieced together out of other finished designs. I need to add more control over the parameters of the synth, but as a proof of concept, I think it works.


LorenzModulatedFM.mp3
 Description:
Demo of FM Bell Synth with Lorenz Attractor Modulation

Download
 Filename:  LorenzModulatedFM.mp3
 Filesize:  6.02 MB
 Downloaded:  945 Time(s)


_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JLS



Joined: Nov 05, 2005
Posts: 490
Location: Czech
Audio files: 30
G2 patch files: 316

PostPosted: Mon Mar 12, 2012 2:38 pm    Post subject: Reply with quote  Mark this post and the followings unread

Nice meditation sound - many thanks Smile
_________________
Sorry my bad English Smile
https://soundcloud.com/1jls
https://soundcloud.com/user-819966312-266044932
https://github.com/jlswbs
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Mon Mar 12, 2012 4:34 pm    Post subject: Reply with quote  Mark this post and the followings unread

I found some problems with the synth which I've fixed. I also lowered the range of the h parameter. Most of the upper range produces a noise like character, so I gave up some noise range for more of an LFO range.

Here's another sample, it's a drone using only the 3 operator pairs that are affected by the Lorenz Attractor.

EDIT ADD: This is one note held down by a bobbin of solder.


Lorenz_FM_Drone.mp3
 Description:
Lorenz FM Drone

Download
 Filename:  Lorenz_FM_Drone.mp3
 Filesize:  6.02 MB
 Downloaded:  1015 Time(s)


_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Wed Mar 14, 2012 2:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

Another idea:

Generate a band limited sawtooth.

Put the sawtooth through 3 bandpass filters run in parallel with outputs equally mixed. Since state variable filters are easily tuned and easily implemented in an FPGA, I'll try those.

Modulate the Fc input of each bandpass filter with an output of the Lorenz (or other) Attractor.

The BP filters will select different harmonics as Fc changes over time. It should sound pleasant (I would think) because the harmonics are all related being from the same periodic waveform.

Q enhancement may be a problem, but I'm pretty sure I can come up with a compensation scheme if it turns out it likes howl.

Might sound interesting.

Gonna try it...

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JLS



Joined: Nov 05, 2005
Posts: 490
Location: Czech
Audio files: 30
G2 patch files: 316

PostPosted: Thu Mar 22, 2012 5:51 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi JovianPyx

Your idea modulated three band pass filter si great - please make more this great projects. This is very interesting for me.

Kamil

P.S. is possible post me final working lorenz attractor verilog file ? (previous file is only concept - im begginer in verilog and not understand how make final module) - very thanks

_________________
Sorry my bad English Smile
https://soundcloud.com/1jls
https://soundcloud.com/user-819966312-266044932
https://github.com/jlswbs
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Thu Mar 22, 2012 6:15 am    Post subject: Reply with quote  Mark this post and the followings unread

Here is the Verilog source code for the synth and the VB.NET project for the patch editor.

The patch editor is a modified version of the FM Bell Synth Patch Editor and should work with both synths. The 'h' parameter control (lower left corner of the window) was added for the Lorenz version and controls the speed at which the Lorenz Attractor evolves over time. Lower values are more like an LFO. The 'h' parameter does not affect the bell synth.

The synth design is a proof of concept and is somewhat primitive from a control standpoint. I.e., there is only a control for the h parameter. The a, b and c parameters and starting conditions can be changed directly in the Verilog source code or you can modify the patch editor and Verilog source code to allow controlling these from the patch editor.


Lorenz_FM_ver_a.zip
 Description:
Verilog Source for Lorernz Attractor Modulated FM Synth design for Spartan-3E Starter Kit

Download
 Filename:  Lorenz_FM_ver_a.zip
 Filesize:  557.78 KB
 Downloaded:  439 Time(s)


Microtonal_Bell_Synth_Patch_Editor_S-3E.zip
 Description:
Patch Editor Project for Lorenz Attractor Modulated FM Synth - VB.NET Express Edition (legally free)

Download
 Filename:  Microtonal_Bell_Synth_Patch_Editor_S-3E.zip
 Filesize:  240.6 KB
 Downloaded:  450 Time(s)


_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima

Last edited by JovianPyx on Thu Mar 22, 2012 7:26 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
JLS



Joined: Nov 05, 2005
Posts: 490
Location: Czech
Audio files: 30
G2 patch files: 316

PostPosted: Thu Mar 22, 2012 7:05 am    Post subject: Reply with quote  Mark this post and the followings unread

Many thanks today im test it Smile
_________________
Sorry my bad English Smile
https://soundcloud.com/1jls
https://soundcloud.com/user-819966312-266044932
https://github.com/jlswbs
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [22 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use