This code makes digital noise using a PIC microcontroller (12f683).
Three signals are generated: Random noise on GP0, random triggers GP1, and random gates on GP2.
/*
* File: Noise Generator 2 Routine.c
* Author: Hans Mikelson
*
* Created on March 17, 2016, 1 PM
*/
#if defined(__XC)
#include <xc.h> /* XC8 General Include File */
#elif defined(HI_TECH_C)
#include <htc.h> /* HiTech General Include File */
#endif
#include <stdint.h> /* For uint8_t definition */
#include <stdbool.h> /* For true/false definition */
#include <stdlib.h> /*rand()*/
#pragma config MCLRE=OFF,CP=OFF,WDTE=OFF,FOSC=INTOSCIO
#define _XTAL_FREQ 4000000
uint8_t sGPIO;
int gi,gi1,gr1,gr2,gr3,gi3,gr0,gr4;
void init()
{
//Configure GPIO Port
ANSEL = 0b00000000; //Configure all GPIO pins as digital
TRISIO = 0b11001100; //Set GP# 1=inputs and 0=outputs
OPTION_REGbits.nGPPU = 0;
WPU = 0b00000100; //Enable weak pullups=1
//Configuer AD Convertor
ADCON0 = 0x00; //AD disabled
ADRESH = 0x00; //Init the AD Register
//Configure Comparator
CMCON0 = 0xFF; // Comparator is turned off
CMCON1 = 0x00; // Comparator is turned off
//Interrupt configuration
//INTCON = 0x00; //Disable all interrupts
INTCONbits.INTF = 0; // External interrupt on GP2 only
OPTION_REGbits.INTEDG = 0; // 1=rising edge, 0=falling
INTCONbits.INTE = 1; // Enable external interrupt
INTCONbits.GIE = 1; // Global interrupt enable
}
void vdelay(int n)
{
int i;
for (i=0;i<=n;i++)
{
__delay_us(100);
}
}
void scan_eyes(int n, int m, uint8_t led1, uint8_t led2) // PWM sweep high f to low f
{
int i,j,k;
int i1,i2,i3,pw1,pw2;
uint8_t sGPIO;
i1=1; i2=-1; pw1=0; pw2=n;
sGPIO = GPIO;
for (k=0;k<m;k++)
{
for (j=0;j<n;j++)
{
for (i=0;i<n;i++)
{
if (i>pw1)
{
sGPIO = sGPIO & ~led1;
}
else
{
sGPIO = sGPIO | led1;
}
if (i>pw2)
{
sGPIO = sGPIO & ~led2;
}
else
{
sGPIO = sGPIO | led2;
}
GPIO = sGPIO;
}
pw1 = pw1 + i1;
pw2 = pw2 + i2;
}
i3 = i1; i1 = i2, i2 = i3;
}
}
void noise0(uint8_t r3) // Pulse noise with different frequencies
{
int r1;
r1=rand() | 0b11111110;
sGPIO = GPIO;
//sGPIO = (sGPIO & 0b11111101);
sGPIO = (sGPIO | 0b00000001) & r1;
if (gr1<=0)
{
sGPIO = (sGPIO & 0b11101111);
}
if (gr2<=0)
{
gr0=(rand() & r3)+11;
gr1=(rand() & r3)+11;
gr2=gr1+gr0;
gr3=10;
gi3=-1;
sGPIO = (sGPIO | 0b00010010);
}
gr2--;
gr1--;
if (gr3==0)
{
gi3=0;
sGPIO = (sGPIO & 0b11111101);
}
gr3+=gi3;
GPIO = sGPIO;
}
void noise1(int r3) // Pulse noise
{
int r1;
r1=rand() | 0b11111110;
sGPIO = GPIO;
sGPIO = (sGPIO | 0b00000001) & r1;
if (gr1<=0)
{
sGPIO = (sGPIO & 0b11101111);
}
if (gr2<=0)
{
gr0=(rand() & gr4)+11;
gr1=(rand() & gr4)+11;
gr2=gr1+gr0;
gr3=10;
gi3=-1;
sGPIO = (sGPIO | 0b00010010);
}
gr2--;
gr1--;
if (gr3==0)
{
gi3=0;
sGPIO = (sGPIO & 0b11111101);
}
gr3+=gi3;
GPIO = sGPIO;
}
void main()
{
uint8_t r, d=20, rp=3;
init();
gi=0;
gi3=0; gr3=10;
GPIO = 0b00000000;
gr0=(rand() & 0b1111111111)+11;
gr1=(rand() & 0b1111111111)+11;
gr2=gr1+gr0;
scan_eyes(d,2,2,1);
while(1)
{
switch (gi)
{
case 0:
noise0(1);
break;
case 1:
noise1(rand());
break;
default:
scan_eyes(d,2,1,2);
}
}
}
void interrupt tc_int (void)
{
if (INTCONbits.INTF==1)
{
INTCONbits.INTF = 0;
gi=(gi+1)%3;
vdelay(100);
switch (gi)
{
case 0:
gi3=0; gr3=10;
GPIO = 0b00000000;
gr0=(rand() & 0b1111111111)+11;
gr1=(rand() & 0b1111111111)+11;
gr2=gr1+gr0;
break;
case 1:
gi3=0; gr3=10;
GPIO = 0b00000000;
gr4 = rand();
gr0=(rand() & gr4)+11;
gr1=(rand() & gr4)+11;
gr2=gr1+gr0;
break;
default:
GPIO = 0b00000000;
}
}
}
Showing posts with label DIY. Show all posts
Showing posts with label DIY. Show all posts
Sunday, April 3, 2016
Wednesday, March 11, 2015
UV LED Exposure System
This is the layout for an exposure system based on UV LEDs. Be sure to use the wider angle LEDs (30 degrees). I offset a piece of glass about 1-2 inches from the surface when exposing. I am also using a frosted shower glass over the LEDs. You can delete some of these for a smaller system. This one uses 180 LEDs. There are about 3V per LED so you need at least 18V to make this work. Adjust the resistors so that you have the correct current per LED (~30 mA). A 1 amp supply should work for this. I mounted mine in a picture box from Michael's.
Thursday, November 29, 2012
Very Bizarre Filter Revisited
A while ago I came up with a design for a very bizarre filter which attempted combine a fuzz distortion with resonant low pass filter. Unfortunately the prototype did not pan out. This is a second attempt at a bizarre filter. The idea is not to create a certain type of filter but to deliberately introduce distortion into a filter.
This design is based on the new filter Ray Wilson is using on his Noise Toaster. The Noise Toaster is an excellent sounding box which gives you a lot of options in a small space. I was looking for a simple filter design so that I could try out some experiments without using a whole pile of chips. The advantage of this filter is that it uses only one op amp. I had been experimenting with Ray's Weird Sound Generator filter since it is very simple. This new filter is an improvement over the WSG filter.
The first modification I decided to try was putting in some diodes. I found that putting a diode and a potentiometer that could be switched on and off in the resonance section allowed for a lopsided resonance which should give some unique character to the sound.
The second modification I wanted to do was to subtract a low pass signal from the resonant low pass signal. That should result in just the resonance from the signal. Next I wanted to add some hard edges to the signal so I passed it through the an op amp at high gain. Finally I added another resonant filter at the end to reintroduce resonance on the newly created peaks. Leaving in all of the controls gives nine different controls for messing with resonance and distortion.
The left trace shows Ray's original filter, the next trace shows the diode modified filter, the next trace shows the clipped resonance signal and the next image shows the re-filtered signal.
I have not built this device yet, I will have to wait to see if it works out. If I build it I will post a video. I am hoping to add a filter to a NAND synth so I may use this one.
Sunday, November 25, 2012
Heavily Modified APC
This is a heavily modified Atari Punk Console. Modifications include pitch and mod Cv inputs, resonant low pass filter from the Ray Wilson's Weird Sound Generator, dual low frequency oscillator with cross feedback, selector knob for up to six different capacitor pairs ranging from control frequencies to high pitched oscillator frequencies.
Wednesday, November 21, 2012
Analog Sequencer
I finished an analog 10 step sequencer based on one of Ray Wilson's designs with some modifications. For one thing I made it based on 9V so I could use my standard power supply. I used a 555 for the clock instead of Ray's clock. I ended up leaving most of the gate generating part which I later regretted but I would need to add a daughter board to fix it. I used ten different colored LEDs on this device. The 10 knobs control the voltage sent to the left output. The knob by the left output controls glide, the knob by the right output controls step time. The right output is supposed to be a gate but it only works if you have every other switch up and down.
Another issue is that it outputs a voltage from 4.5 - 9 V rather than 0 - 9V or -4.5 - + 4.5 etc which is problematic with most other synths. In the next revision I would try to change that as well as a few other things.
Anyway, not too bad for a first prototype. The videos demonstrate how it sounds:
And another:
I added a resonance knob to the CS01 as can be seen in the video.
Here are some pictures of the sequencer in progress.
Thursday, September 27, 2012
Thing 2 vs. Steam Drone
In this video I do an improvisation using my Thing 2 NAND/APC/Noise drone box and Steam Drone box.
The Steam Drone is on the left. The system combines a NAND synth with a resonant low pass filter based on the LM13700 OTA. The LEDs use two transistors and capacitors to do flashing lights (yellow and red). The knobs control the frequency of the three NAND oscillators as well as the level of audio sent to the filter. It turns out the filter performance depends somewhat on the input level. the next set of knobs include Q, filter cut-off, and output volume. The knob on the far left is a potentiometer that the input voltage passes through. When this is all the way to the right it passes the voltage unaltered. As you move it to the left the input current has to pass through more and more resistance essentially starving the circuit of voltage. Starve is one of my favorite effects because the circuits get into a mode where they don't behave like they are supposed to, before they shut down completely. Three of the switches control are used to link the NAND oscillators directly to the output, the other switch turns on the power.
The box on the right is the Thing 2 system. This is a board I made by combining the following circuits: NAND synth, Atari Punk Console, low pass filter, zener diode noise source, blinking light circuit. I had a bunch of layouts drawn up so I decided to combine all of these on a single board. The noise part of the circuit was not making any noise so I kept increasing the resistor value over the op amp to increase the gain but it still would not make noise for me. I noticed however that the whole circuit was producing noise so I settled for that. This box has additional inputs for the control voltage of the 556 which basically controls mod and pitch. I also added an input for the filter to process an external signal since the noise wasn't working.
Something interesting occurs on the Thing 2 when you starve the circuit. The noise starts to become enhanced and the LEDs start having a big impact on the sound. I was originally disappointed with the flashing light part of the circuit because the flashing of the lights is not related to the sound the device makes. As you starve the circuit though, each time the lights flash they make a sound. So I ended up really liking this circuit. It was sort of a whim to combine all of these circuits on one board but I like the results a lot. I ended up with two other indicator LEDs, yellow and green, in addition to the flashing ones, blue and red.
I had photo cube from Michael's which was big enough to hold the circuits and the knobs and I had used a photo cube for the Thing 1 device. I came up with the idea to cut pieces of Fresnel lens and mount them on the inside surface of the photocube. This gives a really cool effect when the lights are out.
Friday, September 14, 2012
Thing 2 and Steam Drone
This video demonstrates my Thing 2 device with a Steam Drone device.
Phaser, echo, reverb, and chorus added with a Motif.
Saturday, September 8, 2012
Steam Punk Drone/Noise Box
I found this box at a thrift shop a while ago and was trying to come up with a circuit to put in it. I finally decided on a circuit made from a NAND synth combined with resonant low pass filter. The controls are as follows:
Top row (left to right) Power on, NAND Osc 1 to output, NAND Osc 2 to output, NAND Osc 3 to output
Middle row (L to R): Starve (10 kOhm Pot on supply V), Q, Fco, Output volume
Bottom row (L to R): NAND1 Fqc, NAND2 Fqc, NAND3 Fqc, NAND input level to filter.
Back (not shown) Ext. Audio Input, Fco Cv input, Output.
Note: Below the glass plate are a couple of blinking diodes.
The control voltage mix op amp is to the left. It turns out this section did not function because apparently I forgot to tie some stuff to ground and -V. The NAND gate chip is on the right. In the middle is the VCF based on LM13700. This is the filter schematic. Note this has an error the transistors on the right need to be grounded. I think there is another error too. (The NAND synth section is not shown) The TL972 I am was using did not seem to work in this application. I am replacing it with a TL082 in future versions. Not quite sure why.
Updated circuit diagram and PCB layout. IC pin spacing should be .1".
Saturday, August 18, 2012
Salen-Key VCF
This is a voltage controlled low pass filter with three control voltage inputs and three audio inputs. Designed for 9V but could be higher. This design has not been tested so use at your own risk.
Friday, August 17, 2012
Chaotic Circuits
Ian Fritz has a number of chaotic circuits on his page that look really interesting. I thought I would start with one of the simpler ones. This is my drawing of the Driven Damped Well chaotic oscillator. Unfortunately this does not seem to make any sound when I power it on so I need to trouble shoot it.
Update: I did some trouble shooting but it still does not behave as expected. (chaotically) it seems to be passing the original sound to the output. I am monitoring the NL output so I think I will switch over to the X output.
Update 2: I did more trouble shooting and switched the output to X and now it does indeed behave chaotically although in a not very usable fashion at the moment. One thing I love about chaotic systems is that they depend on prior initial conditions. So as you turn the knobs the circuit may not be making any sound, then you pass a point and here a blip, as you tweak around the blip you gradually bring it into oscillation. Suddenly the oscillation goes away and you get silence again.
I have been feeding the output of an Atari Punk Console in to drive this circuit. At some settings it has been making some overtones and clicks but they are difficult to find.
Thursday, August 16, 2012
Current DIY Projects
These are some pictures of some current DIY synthesizer projects. This first one is a 10 step sequencer with a 555 clock. I used different colored LEDs for each step (not sure if this will mess up functionality yet).
The next one is my DACPOD. This will be mounted in a case and combines a simple resonant VCF with an Atari Punk Console and my blinking light circuit to give it two flashing LEDs.
This circuit is supposedly a snare drum but it needs a couple of capacitors and a transistor yet.
This circuit combines (left to right) a control voltage mixer, a voltage controlled resonant low pass filter, and a NANDsynth oscillator as well as blinking LEDs along the top. This circuit ended up as my Steam Drone box.
The next one is my DACPOD. This will be mounted in a case and combines a simple resonant VCF with an Atari Punk Console and my blinking light circuit to give it two flashing LEDs.
This circuit is supposedly a snare drum but it needs a couple of capacitors and a transistor yet.
This is a Rossler Attractor chaotic oscillator circuit. Should have put some caps on the outputs for this one.
This circuit combines (left to right) a control voltage mixer, a voltage controlled resonant low pass filter, and a NANDsynth oscillator as well as blinking LEDs along the top. This circuit ended up as my Steam Drone box.
Wednesday, August 15, 2012
MFOS Alien Screamer
Ray Wilson has come out with a new circuit the MFOS Alien Screamer:
I really like the sound of this thing and possibly more importantly I like how such a complex sound can be generated by such a simple circuit. Ray has done a great job of extracting the most functionality out of the fewest components here. The only thing missing is an appropriate filter to go with it. I have been working with a couple of VCFs including Ray's Odd Filter from the Weird Sound Generator but I think for this one a LM13700 filter is more appropriate.
I really like the sound of this thing and possibly more importantly I like how such a complex sound can be generated by such a simple circuit. Ray has done a great job of extracting the most functionality out of the fewest components here. The only thing missing is an appropriate filter to go with it. I have been working with a couple of VCFs including Ray's Odd Filter from the Weird Sound Generator but I think for this one a LM13700 filter is more appropriate.
Labels:
Alien Screamer,
DIY,
MFOS,
Synthesizer,
VCF
Saturday, August 11, 2012
Atari Punk Console
This is my layout for my Atari Punk Console. This is about as compact as you can probably make this device without going to surface mount. The + and - go to a switch to the battery. The P+ supplies the positive voltage to the two pots (right side), the PP goes to the wiper of the Pitch Pot, the PM goes to the wiper of the Mod Pot, CvR provides a voltage to the two control voltage RTS 1/4 jacks and should connect to the ring of both jacks. This will allow you to use an expression pedal to sweep pitch or mod. Note the resistor presents too much current from flowing if you short out the connection. The CvP goes to the tip of the pitch control voltage quarter inch, and the CvM goes to the tip of the mod control voltage quarter inch jack. The output goes to the tip of the 1/4 right of an audio pot 10k-100k. The wiper goes to the tip of quarter inch jack. The sleeve of the jacks should all be connected together and grounded.
This design makes use of both modulation connections on the 556 chip so you can modulate pitch and wave shape.
This setup has the following additional components:
2 stereo 1/4 inch jacks for control voltage or expression pedal input
1 mono 1/4 inch jack for output
2 500k - 1M linear taper pots (either work) for pitch and wave form modulation
1 10k-100k audio taper pot (either should work) for volume
1 SPST toggle switch for on/off
1 battery clip or 9V supply connecter (or both)
1 case of some type, a lot of options here but I like the "Really Useful Box" series from Office Depot because they are easy to drill holes in.
Here is a video demonstration of this device:
You can use this to make a PCB. You will have to scale to the correct size. The spacing between the pins on the chip should be 0.1 inch. The output will be the contact on the far right.
Subscribe to:
Posts (Atom)