Author |
Message |
Joel
Joined: Sep 12, 2006 Posts: 97 Location: London, UK
|
Posted: Mon Apr 07, 2008 10:21 am Post subject:
PIC-based fraktal synth |
 |
|
Hi all,
over on circuitbenders.co.uk there's an interesting thread developing about a diy synth using a 18f4620 PIC microcontroller and various algorithms that appear to use fractal maths to generate the patterns.... anyway never mind how it does it, just listen to the samples at http://etecnic.fh-pforzheim.de/~catweazle/F-Synth/ (and more via the thread) and be amazed!! Plus keep watching the thread, as development seems to be ongoing....
Joel |
|
Back to top
|
|
 |
State Machine
Janitor


Joined: Apr 17, 2006 Posts: 2809 Location: New York
Audio files: 24
|
Posted: Mon Apr 07, 2008 4:57 pm Post subject:
|
 |
|
Joel,
Wow, this is really an interesting thread and I like the psychotic sounds this synthesizer makes also !! The "FM Techno" tune is very cool ... I like the 18F4xxx chips. They are cheap and fairly powerful as one can tell by the samples !! I guess it would not be hard to synchronize it to some external source by patching over the parameter pots and using an external LFO (be wary of the voltages) to modulate some of sounds ... The external patched LFO's can be rectified and attenuated if need be.
Thanks.
Bill |
|
Back to top
|
|
 |
ian-s

Joined: Apr 01, 2004 Posts: 2669 Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 626
|
Posted: Mon Apr 07, 2008 5:09 pm Post subject:
|
 |
|
I am embarrassed to say that I can't work out what is going on here. I followed the link to the explanation but it seemed to explain very little.
Is it a pseudo-random (or less than random) number generator? I can't seem to grasp what the basic idea is.  |
|
Back to top
|
|
 |
State Machine
Janitor


Joined: Apr 17, 2006 Posts: 2809 Location: New York
Audio files: 24
|
Posted: Mon Apr 07, 2008 5:27 pm Post subject:
|
 |
|
Quote: | Is it a pseudo-random (or less than random) number generator? I can't seem to grasp what the basic idea is. |
This is about as technical as it got but you get an idea of what some of his methods are:
Quote: | - Two fractal based "music" generators ("predictive digital music synthesizer", it's not random!)
- Step-sequencer (8 steps) with FM(frequency modulation) tone generation
- Cellular Automata (1 dimensional, see "game of life", "critterandguitari") |
If you understand "C" coding, he offers the source code in one of his entries. He used the CCS "C" Compiler. This a popular, cheap, compiler that works well. Hopefully his code is well documented with comments sp you probably want to take a peek at that if your inetrested enough
The Game of Life stuff is really cool and the algorithms result can be used to generate control data for a particular parameter of a sound such as FM Index or something like that.
The bottom line here is, it sound cool !!!
Bill |
|
Back to top
|
|
 |
Joel
Joined: Sep 12, 2006 Posts: 97 Location: London, UK
|
Posted: Wed Apr 09, 2008 4:06 am Post subject:
|
 |
|
I did get hold of the code from the author and there's a bit of commenting but it didn't get me that far to be honest Although I might have a play with the "user interface" side of things if I get a chance!
State Machine wrote: | The bottom line here is, it sound cool !!! |
My feelings exactly!! |
|
Back to top
|
|
 |
okvern
Joined: Feb 05, 2008 Posts: 78 Location: Seattle, Washington
Audio files: 5
|
Posted: Wed Apr 09, 2008 10:40 am Post subject:
|
 |
|
Fellow Builders,
I am definitely building this as soon as the PICs arrive! I have a costume party/rave to go to in a few weeks, and needed a small, battery-powered synth to take as part of my costume ("The Oscillator," a synth-themed superhero). Should be fun.
I'll report here on my experiences with the circuit. I've also successfully built a couple of the Electric Druid PIC-based designs, and will post my boards and notes in the other thread as soon as I can put it into a form that makes sense to someone other than me.
Thanks,
Ole |
|
Back to top
|
|
 |
Joel
Joined: Sep 12, 2006 Posts: 97 Location: London, UK
|
Posted: Wed Apr 09, 2008 1:35 pm Post subject:
|
 |
|
okvern wrote: | "The Oscillator," a synth-themed superhero |
If we don't get to see some photos of this outfit, I will feel VERY let down  |
|
Back to top
|
|
 |
catweazle
Joined: Feb 25, 2008 Posts: 28 Location: germany
Audio files: 3
|
Posted: Wed Apr 09, 2008 4:17 pm Post subject:
|
 |
|
Hello everyone!
I've developed that thing with the intention to have a versataile
simple lofi audio hardware to realize some unusual sounds.
Hardware:
- a cheap (yes, samples) 8bit microcontroller to be real lofi
- 8 analog inputs / pots for parameters (CV in 0..5Volt)
- 1 analog output (Pulse with modulation) / audio out
(output is not filtered very well, add additional Filter / EQ + FX)
Software:
(sourcecode is available) http://etecnic.fh-pforzheim.de/~catweazle/F-Synth/
Documentation:
Ok, sourcecode could have more comments
ask if questions
however it really makes crazy sounds
and I'm very interested of your experiences (pics/sounds) ...
gtz
Eric
Edit:
use this schematic if you build it
http://etecnic.fh-pforzheim.de/~catweazle/F-Synth/PICsynth_V11_schematic.JPG |
|
Back to top
|
|
 |
Blue Hell
Site Admin

Joined: Apr 03, 2004 Posts: 24042 Location: The Netherlands, Enschede
Audio files: 276
G2 patch files: 320
|
Posted: Wed Apr 09, 2008 4:43 pm Post subject:
|
 |
|
Eric,
I once tried to make some sounds on a pic 12 and was not very impressed by myself then. This is diferent, you did some cool stuff there  _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
Back to top
|
|
 |
State Machine
Janitor


Joined: Apr 17, 2006 Posts: 2809 Location: New York
Audio files: 24
|
Posted: Wed Apr 09, 2008 5:05 pm Post subject:
|
 |
|
Quote: | Hello everyone!
I've developed that thing with the intention to have a versataile
simple lofi audio hardware to realize some unusual sounds. |
First, welcome to the forum !!! Glad you posted here and secondly, I ordered 3 samples of this MCU from Microchip and will definitely put one together. It's a quick build and I really do like the concept of this synthesizer. Sometimes things like this are just plain fun ! I suppose along these same lines of fractal and randomized approaches to sound design, some "granular" synthesis techniques can be added to your device .....
Perhaps if you can, you can talk a bit about more of the technical details of your code or talk a about about the "patches" or modes you have created for this device ...
Bill |
|
Back to top
|
|
 |
State Machine
Janitor


Joined: Apr 17, 2006 Posts: 2809 Location: New York
Audio files: 24
|
Posted: Wed Apr 09, 2008 5:08 pm Post subject:
|
 |
|
Quote: | I once tried to make some sounds on a pic 12 and was not very impressed by myself then. |
Well Jan, I would say without hesitation, that if you had a more powerful processor than the 12x and spent more time, I am most sure yours would be cranking out the cool sounds also !!
Bill |
|
Back to top
|
|
 |
Blue Hell
Site Admin

Joined: Apr 03, 2004 Posts: 24042 Location: The Netherlands, Enschede
Audio files: 276
G2 patch files: 320
|
Posted: Wed Apr 09, 2008 5:19 pm Post subject:
|
 |
|
State Machine wrote: | I am most sure yours would be cranking out the cool sounds also !!  |
My boss wanted a "more interesting" beeper ... and he got that ... but 58 ct was too expensive ... or maybe it was too interesting  _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
Back to top
|
|
 |
catweazle
Joined: Feb 25, 2008 Posts: 28 Location: germany
Audio files: 3
|
Posted: Wed Apr 09, 2008 6:46 pm Post subject:
|
 |
|
ok, where to begin?
User interface (pots)
Potentiometers / analog inputs:
1 =select Synth (1..x) -> "DSP_xxx"
2 =speed/pitch
3..8 = DSP/Synth parameters (depending on selected synth)
Play/Stop switch
Forward/Reverse switch
LED display showing selected synth / synth parameter
Synth 1: "fraktal synth"
16bit counter, hi and lo byte is multiplied/xored ...
results in some sort of sirpinsky triangle (known in chaos theory)
(parameters are not from this earth
Synth 2: "fraktal synth"
same as Synth1 but different math
Synth 3: "sequencer"
8 step stepsequencer with 2 oscillator FM synth
Paramters:
3 = select step 1..8
4 = pitch for step
5 = vol envelope
6 = pitch envelope
7 = osc A pitch
8 = osc B pitch
Synth 4: "WSG"
inspired by the MFOS WSG wired sound generator
FM and AM modulation
Code:
I've tried to greate a simple framework sort of a plugin system.
"PICsynth" is the main entry point, inits the uC and calls the application
"APP task".
The "application" manages the user inputs and calls the "DSP_Alg" functions according to a software timer (maybe this should be done with the hardware timers but I don't want to use interupts.
"api" gets the analog inputs and puts out PWM sound.
The sound is created in the "DSP_xx_Alg" function
Cellular automata (1 dimensional) code is there but not included in
the application, should be worked out more.
Taken from www.critterandguitari.com/
There is a lot of room left in the uC ...
much more synths can be added. Since the framework is there
only the "DSP_xxx" sound calculation has to be created.
Maybe some of you get interested in writing some synth-plugins.
So not much C programming knowledge is needed (only the math).
thanks Joel for mailing me and the positive feedback! |
|
Back to top
|
|
 |
okvern
Joined: Feb 05, 2008 Posts: 78 Location: Seattle, Washington
Audio files: 5
|
Posted: Thu Apr 10, 2008 5:57 pm Post subject:
|
 |
|
Hi Eric, Fellow Builders,
The PICs were on my doorstep when I got home. I breadboarded the circuit, programmed it with my PICkit2, and...it works.
Eric, my hat is off to you--this is a very cool little synth. Some amazing and quite insane sounds are possible. My neighbor came downstairs to see if something was wrong with the washing machine. Thanks for sharing it with the synth DIY community!
I'll have pictures and (maybe) sounds once I get it onto a board and into an enclosure--the plan is to wear it/play it on my chest.
Thanks again,
Ole |
|
Back to top
|
|
 |
State Machine
Janitor


Joined: Apr 17, 2006 Posts: 2809 Location: New York
Audio files: 24
|
Posted: Fri Apr 11, 2008 12:00 pm Post subject:
|
 |
|
Quote: | Hi Eric, Fellow Builders,
The PICs were on my doorstep when I got home. I breadboarded the circuit, programmed it with my PICkit2, and...it works. |
I should be getting 3 chips by next week I hope !!
Bill |
|
Back to top
|
|
 |
volare
Joined: Jul 31, 2006 Posts: 6 Location: Portland, OR USA
|
Posted: Fri Apr 11, 2008 1:11 pm Post subject:
|
 |
|
I have 3 chips ordered from Microchip. They shipped so I'll have them by
4/14. Look like it will be a fun project, And it does sound Cool .
Dave |
|
Back to top
|
|
 |
State Machine
Janitor


Joined: Apr 17, 2006 Posts: 2809 Location: New York
Audio files: 24
|
Posted: Sat Apr 12, 2008 12:38 pm Post subject:
|
 |
|
Wow, maybe if enough "plug-ins" or "patches" are developed, the 7 segment LED display may need to be replaced with a small alpha-numeric LCD display to show patch names and other information instead of a criptic display on the LED's ... I realize this started as a small project but it seems it has room to grow
I see that a serial pin is available on the MCU, seems a good place to hang a serial LCD of some type off this?? Not a very expensive one. Maybe 2 x 20 is all that may be needed.
Bill |
|
Back to top
|
|
 |
catweazle
Joined: Feb 25, 2008 Posts: 28 Location: germany
Audio files: 3
|
Posted: Sat Apr 12, 2008 3:53 pm Post subject:
|
 |
|
I'm glad you got it working Ole.
Quote: | neighbor came downstairs to see if something was wrong with the washing machine |
yes, that would be cool if a little "open source community" evolves,
sharing patches/plugins (or whatever we call them)
The UART (serial port Rx/Tx, also usable for MIDI
and SPI-/I2C-Bus pins are free for use. Connecting
a SPI EEPROM 25LCxx or MMC/SD card if a lot memory is needed.
2 analog input ports are free for use, too. one word: audio input...
I've choosen the LED display because of easy/cheapness and it needs very little performance to interface (compared to an LCD).
allways remember:
the PIC is no PC nor DSP, all should be kept as simple as possible.
One word (or more) about the programming language choosen
Why C ? - Assembly is much more efficent.
- code is readable and can be understood a few years later
- structurized code (not "sphagetti code" with a lot of jumps and gotos)
- much more faster development (idea to algorithm)
- coding a PIC in assembly is not funny
- porting algorithms to other microcontrollers (code recycling)
if much more performance is needed better choose a faster controller
like ARM, Propeller, PIC32, DSP ... Nintendo GBA/DS, PSP, PocketPC ...
but inline assembly packed in a C function is a good idea to
gain maximum performance out of an time critical part of a
synth plugin.
in the moment the PIC is running with the internal oscillator (32MHz),
I had overclocked a PIC up to 100MHz (factor 2.5 , 40MHz is normal)
and it worked
but this is not recommended because some of the internal periphericals (RAM...) cannot operate at that clock rate, missfunctions occur ...
Maximum clockrate may vary from device, temperature, shielding...
but that can be very interessting thinking of circuitbending.
Errors can be very musical  |
|
Back to top
|
|
 |
catweazle
Joined: Feb 25, 2008 Posts: 28 Location: germany
Audio files: 3
|
|
Back to top
|
|
 |
Joel
Joined: Sep 12, 2006 Posts: 97 Location: London, UK
|
Posted: Sun Apr 13, 2008 11:29 am Post subject:
|
 |
|
hi all,
I put this together this afternoon, sounds great!!
One issue: the sequencer program (#3) didn't work at all - all I got was a series of rhythmic clicks, no tones? I bought a couple of 18f4620s from ebay but the wonderful royal mail mislaid them so the guy sent me an 18f4520 and 18f4685 instead. I've tried each (recompiling the code with the appropriate header in each case, and for the 4520 removing a couple of unused variables as it said there wasn't enough ram) and get the same problem on both.
Anyone had a similar problem?
Joel |
|
Back to top
|
|
 |
catweazle
Joined: Feb 25, 2008 Posts: 28 Location: germany
Audio files: 3
|
Posted: Sun Apr 13, 2008 1:03 pm Post subject:
|
 |
|
In the "Application.c" a 2kByte Buffer is allocated (array), this is not needed yet. You can of course delete this lines or comment them out if another PIC is used.
Code: | #define BUFFER_SIZE 2047
int8 BUFFER[BUFFER_SIZE+1]; |
Sequencer usage:
If you change the Step-number pot, the Step-value pot is locked.
To unlock it you have to fetch the old value with the Step-value pot.
Turn pot from left to right (or in the other direction).
If the pot-value and the stored value (old value at the selected step)
are the same the Step-value is unlocked and the Step-value-pot
changes now the selected step value.
Be sure if you use another PIC that it has a internal 8MHz oscillator. |
|
Back to top
|
|
 |
State Machine
Janitor


Joined: Apr 17, 2006 Posts: 2809 Location: New York
Audio files: 24
|
Posted: Sun Apr 13, 2008 2:32 pm Post subject:
|
 |
|
Quote: | allways remember:
the PIC is no PC nor DSP, all should be kept as simple as possible. |
Sure, agree there !
Quote: | One word (or more) about the programming language choosen
Why C ? - Assembly is much more efficent.
- code is readable and can be understood a few years later
- structurized code (not "sphagetti code" with a lot of jumps and gotos)
- much more faster development (idea to algorithm)
- coding a PIC in assembly is not funny
- porting algorithms to other microcontrollers (code recycling)
|
I agree, well commented code is very welcome when taking a peek at code months later. I am use to PIC assembly and had written fairly large applications using just that so no problems there. I have noticed though that even when using a HLL's like "C" or Pic Basic Pro for 8 or 16 bit MCU's. there is still a fair amount of work to be done if one needs to port over to another MCU type, especially if you put lots of inline assembly to control on board peripherals like USARTS and A/D converters, etc ... The "C" code does not really remove you that far away from the hardware. I like that anyways
I am curious why you stayed away from interrupt driven code. It make life so much easier ?? The 18Fxxx has so many hardware timers to do the task management or to set sample rates.
Quote: | if much more performance is needed better choose a faster controller
like ARM, Propeller, PIC32, DSP ... Nintendo GBA/DS, PSP, PocketPC ... |
That multi core "Propeller" chip from Parallex looks really cool don't it? Something like 8 32 Bit COGS all doing different things You can still squeeze more performance from what you have by using a base oscillator of 10MHz and enabling the 4x PLL in this chip. Then you can go to 10 MIPS. Another possibility are the DSPic or 24Fxxx chips that go to 40 MIPS and are 16 bit machines. The PIC32 (MIPS) and ARM are a bit overkill I think
Quote: | but inline assembly packed in a C function is a good idea to
gain maximum performance out of an time critical part of a
synth plugin. |
Yes, thats the best way I think also.
Quote: | in the moment the PIC is running with the internal oscillator (32MHz),
I had overclocked a PIC up to 100MHz (factor 2.5 , 40MHz is normal)
and it worked Cool
but this is not recommended because some of the internal periphericals (RAM...) cannot operate at that clock rate, missfunctions occur ...
Maximum clockrate may vary from device, temperature, shielding...
but that can be very interessting thinking of circuitbending.
Errors can be very musical Wink |
Wow, never even crossed my mind to overclock PIC MCU's ........ I don't really agree with all this over clocking garbage anyways. You see so much of that in the PC industry and you get some of these tweakers thinking they know all this and that about hardware than wonder why their stuff is not working very well or is intermittent in some way ...... geez ! You are wise in your recommendation not to do it bt maybe fun as an experiment
Bill |
|
Back to top
|
|
 |
Sam_Zen

Joined: Mar 08, 2008 Posts: 251 Location: NL
|
Posted: Sun Apr 13, 2008 10:00 pm Post subject:
|
 |
|
Very nice examples made with this PICsynth!
As far as fractal 2 sound is concerned (on PC that is), I've used FractMus.
It renders fractal algorithms into MIDI format. I'm not a MIDI fan, but it can be transformed into a sound file. (sorry if OT). _________________ 0.618033988 |
|
Back to top
|
|
 |
State Machine
Janitor


Joined: Apr 17, 2006 Posts: 2809 Location: New York
Audio files: 24
|
Posted: Wed Apr 16, 2008 12:04 pm Post subject:
|
 |
|
got three 18F4620 MCU's in the mail today !!!
Bill |
|
Back to top
|
|
 |
okvern
Joined: Feb 05, 2008 Posts: 78 Location: Seattle, Washington
Audio files: 5
|
|
Back to top
|
|
 |
|