After bitbanging a quick library, and some head scratching, i seemed to have solved all my problems for now...
Electronics, Synth, Sound effects, Microcontrollers, , Digital signal processing,AVR, PIC, PIC32,ARM, etc
Showing posts with label Dub. Show all posts
Showing posts with label Dub. Show all posts
Friday, 20 July 2018
Tuesday, 5 May 2015
Wednesday, 29 April 2015
chipKIT DP32 Simple dub Siren Code
Sampling Rate 22.050 kHz, with 12 bit DAC MCP4725 ( breakout board)
Using button 2(Pin 17) on DP32 and Variable pot (A2).
For the signal out, the ac coupling circuit from previous post is necessary.
*Check also I2C Speed post HERE
#include <sys/attribs.h> #include <Wire.h> #define MCP4725_DID 96 // define device id - see datasheet // #define SYS_FREQ (40000000L) #define PB_DIV 4 #define PRESCALE 2 #define FRQ 22050 //21504 #define T1_TICK (SYS_FREQ/PB_DIV/PRESCALE/FRQ) #define WAVE_SAMPLES 256 const int buttonPin = 17; // variables will change: int buttonState = 0; // variable to read the pushbutton status uint8_t playOn=0; // Variable of play state/button state volatile uint16_t a; uint16_t b; uint16_t d; uint16_t e=0; uint16_t inc; uint8_t statedown=0; boolean c; boolean togg; uint16_t sineData [WAVE_SAMPLES]; // void setup() { // Serial.begin(57600); initTmr(); pinMode(A2, INPUT); // pinMode(13, OUTPUT); // //set pins to output because they are addressed in the main loop sine (); Wire.begin() ; } void loop() { uint16_t aIn =analogRead(A2); inc=aIn >>4; buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { playOn=1; // play is On } else{ playOn=0; // play is Off } if(c !=togg){ if(playOn==1){ a = a++ ; a+= (inc+(e >>4)); if(a>=WAVE_SAMPLES){ a-=WAVE_SAMPLES; // ramp up or down variables if (statedown==0){ e++; if(e>=1023){ statedown=1; e--; } } else{ e--; if (e==0){ statedown=0; e++; } } } // Wire.beginTransmission(MCP4725_DID); //device adress Wire.send(64); // cmd to update the DAC Wire.send(sineData[a] >> 4); // the 8 most significant bits... Wire.send((sineData[a] & 15) << 4); /* the 4 least significant bis...*/ Wire.endTransmission(); /* */ } }// c=togg; } // call interrupt handling vector extern "C" { void __ISR(16, ipl6) int1Handler(void) { togg= !togg; // // IFS0CLR = 0x80000;// Clear the T4 interrupt flag Bit 19 // } } void initTmr(){ // T4CON=0x0; //Stop timer and clear registers T4CONSET = 0x0010; // set prescalar 1:2 ox60 to experiment TMR4 = 0x0; //Clear Timer 4 register PR4 = T1_TICK ; //0x17; // set timer to 23 IFS0CLR = 0x80000;// Clear the T4 interrupt flag Bit 19 IPC4SET = 0x00000016;// Interrupt priority 5, 2 IEC0SET = 0x80000;// Enable T4 interrupt Bit 19 T4CONSET = 0x8000;// Enable Timer4 } void sine (){ uint16_t i; for(i=0;i<WAVE_SAMPLES;i++){ b = 2047*sin((2*PI/WAVE_SAMPLES)*i); b+=2047; sineData [i]=b; } }
Monday, 4 August 2014
Arduino miniDUBsiren - compact pocket-sized dub siren
While i have to wait for some bits && pots to finish the other prototype, i decided to go back to Arduino Uno and do something quick; Ended up creating the Pocket sized miniDubSiren.
* I have even seen some 3D-printed cases for it here .
LCD Keypad Shield, Arduino Uno and you'd only have to worry about filtering the output. Cant get easier than that .
So, that makes it a shirt-pocket sized Dub Siren.
LFO is linear, for simplicity.
LCD displays top frequency/range and rate of LFO ( both with a minus - and a plus+ button for selection) and when sound is ON (triggered by the SELECT button: toggle action - one click ON , another OFF).
Also made a quick sounds FX generator for it, code to come soon ( even a "slightly slanted" sound wave LCD Char to go with it).
It was nice to work around the limitations of the available buttons and the frequency range in the tone function. Parameters can be changed during play, which creates some nice musical artifacts . A nice little toy.
While at it, developed a nice way of creating menus with this shield( despite not using it in this particular project, where simplicity was needed).
Button arrangement is : Trigger Toggle=Select ; Freq= left/right ; Rate LFO=up/down .
//Sample using LiquidCrystal library
#include < LiquidCrystal.h >
//
byte wavform2[8] = {
B01100,
B10001,
B10001,
B00001,
B00000,
B00000,
B00000,
};
byte wavform[8] = {
B00000,
B00000,
B00000,
B00001,
B10001,
B10010,
B01100,
};
/*******************************************************
miniDubSiren by
Dubworks- Aug 2014
LCD KeyPad Code original by
Mark Bramwell- Jul 2010
********************************************************/// select the pins used on the LCD panel
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
uint16_t i = 100; // tone minimum
boolean play = false;
boolean down = false;
uint16_t topFreq = 864;
uint16_t rate = 0;
int outPin = 3; // define number of output pin
// define some values used by the panel and buttons
int lcd_key = 0;
int adc_key_in = 0;
#define btnRIGHT 0
#define btnUP 1
#define btnDOWN 2
#define btnLEFT 3
#define btnSELECT 4
#define btnNONE 5
// read the buttons
int read_LCD_buttons()
{
adc_key_in = analogRead(0); // read the value from the sensor
// my buttons when read are centered at these valies: 0, 144, 329, 504, 741
// we add approx 50 to those values and check to see if we are close
if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
//
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 250) return btnUP;
if (adc_key_in < 450) return btnDOWN;
if (adc_key_in < 650) return btnLEFT;
if (adc_key_in < 850) return btnSELECT;
return btnNONE; // when all others fail, return this...
}
void setup()
{
// Serial.begin(9600);
pinMode(outPin, OUTPUT);
lcd.begin(16, 2); // start the library
lcd.createChar(0, wavform );
lcd.createChar(1, wavform2 );
lcdInit();
}
void loop()
{
lcd_key = read_LCD_buttons(); // read the buttons
switch (lcd_key) // depending on which button was pushed, we perform an action
{
case btnRIGHT:
{
topFreq += 13;
if (topFreq > 4000)
topFreq = 4000;
lcdFnct();
delay(40);
break;
}
case btnLEFT:
{
if (topFreq < 100)
topFreq = 100;
else
topFreq -= 13 ;
lcdFnct();
delay(40);
break;
}
case btnUP:
{
rate += 1 ;
if (rate > 150) {
rate = 150;
}
lcdFnct();
delay(40);
break;
}
case btnDOWN:
{
if (rate < 1)
rate = 0;
else
rate -= 1 ;
delay(40);
lcdFnct();
break;
}
case btnSELECT:
{
play = !play;
if (play == false) {
i = 100;
noTone(3);
delay(50);
}
delay(100);
lcdFnct();
break;
}
case btnNONE:
{
break;
}
}
if (play == true) {
tone(outPin, i);
delay(5); // !!
}
else if (play == false) {
i = 100;
noTone(3);
delay(50);
}
if (down == false) {
i++;
i += rate;
}
else if (down == true) {
i--;
i -= rate;
}
if (i > topFreq) {
down = true;
i = topFreq;
}
else if (i < 180) {
down = false;
i = 180;
}
}
void lcdFnct() {
lcd.clear();
lcd.setCursor(0, 0); //
lcd.print("F= ");
lcd.setCursor(4, 0);
lcd.print(topFreq);
lcd.setCursor(0, 1);
lcd.print("R= ");
lcd.setCursor(4, 1);
lcd.print(rate);
if (play == 1) {
lcd.setCursor(10, 0);
lcd.write(byte(0)); //
lcd.setCursor(11, 0);
lcd.write(byte(1));
lcd.setCursor(10, 1);
lcd.print("ON");
}
}
void lcdInit() {
lcd.setCursor(0, 0);
lcd.print(" = DubWorks = "); //
lcd.setCursor(0, 1);
lcd.print(" mini Dub Siren ");
// scroll 12 positions to the right
// to move it offscreen left:
for (int positionCounter = 0; positionCounter < 12; positionCounter++) {
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(50);
}
// scroll 26 positions to the right
// to move it offscreen right:
for (int positionCounter = 0; positionCounter < 26; positionCounter++) {
// scroll one position right:
lcd.scrollDisplayRight();
// wait a bit:
delay(50);
}
// scroll 14 positions to the left
// to move it back to center:
for (int positionCounter = 0; positionCounter < 14; positionCounter++) {
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(50);
}
// delay at the end of the full loop:
delay(500);
}
3D-Printed case : http://apcmag.com/arduino-project-digital-clock.htm
LCD KEYPAD : http://www.dfrobot.com/wiki/index.phptitle=Arduino_LCD_KeyPad_Shield_(SKU:_DFR0009)
Labels:
Arduino,
Dub,
DubWorks,
fx,
mini dub siren,
miniDUBsiren,
open source
Tuesday, 29 July 2014
Dub && Wise Synth
*some decoupling capacitors 100nFclose to the analog pins should be added.
My initial intention was to create something focused for the soundsystem culture. This turned out to be much more difficult than i thought .
Dub siren/Elec tom synth/And oscilattor+ MAD Lfos (some trying to recreate some of the sounds in a synare that Jah Shaka got us all used to)...All this synthesized on the fly with the help of some wavetables (all created during the start up)
.
Pots for :
-Oscillator wave selector ( Sine,cosine Saw, Inverted Saw, Square wave, triangle and 1 extra slots for now )
-LFO rate
-LFO modulator type select ( Any of the above tables, plus a few more specific and tailored options)
-Attack
-Release
* Both attack and release can interact with the LFO
- Mode selector ( Dub Siren, Sound effects " a la Synare", Elec-Tom synth)
This video is just as an update on the proceedings.
Here i am using the Arduino Due.
Due to its complexity, i ended up re-writing the whole code from scratch and fresh to suit this specific idea.
Already started porting a similar idea to the chipKit DP32, and Pinguino and an Xmos version also soon to come, subject to availability of spare time.
Labels:
Arduino DUE,
ARM SAM3X,
chipKit,
chipKit DP32,
Dangerous Prototypes,
Decay,
DP32,
Drum Synth,
Dub,
Generator,
PIC32,
Pinguino,
reggae,
Release,
xmos,
XMOS startKIT
Monday, 2 December 2013
Friday, 12 April 2013
Dub siren Midi Controller ( Interruptor VST) Schematic with ATMega 2560
Built and designed to interact with the VST dub siren FX from The Interruptor @ his forum .
The trigger is a button connected to D22 on arduino The rest are 12 pots, that will control the Pitch, Level and Freq of both LFO's, Vol, Time, Feedback,Hp,Lp and noise !
The LCD is connected as usual...
Schematic in PDF, NOT IN BREADBOARD FORMAT
Labels:
Arduino,
AVR,
C Programming,
Dub,
DubWorks,
electronics,
general projects,
Mega,
open source
Tuesday, 19 March 2013
AVR /Arduino ChipTune Synth
Just a video ( sorry for the crap sound, as it was from a phone) showing the Kryo AVR chiptune in action.
And the original below (much better sound) !
Reference : http://www.linusakesson.net/hardware/chiptune.php
And the original below (much better sound) !
Reference : http://www.linusakesson.net/hardware/chiptune.php
Monday, 18 March 2013
Y =a sin b(x-h)+k
Y =a sin b(x-h)+k
Maths is a must when you get into any kind of engineering. And trigonometry has a special relation to Direct Digital Synthesis, and sound synthesis.
And i been studying several uC-based synths code and structure along with some DSP basics .
And as the foundation to all sounds are the pure sinewave, we will star by creating an software oscillator inside a uC.
Therefore i'm preparing a series of basic intro tutorials into some relevant exercises in both maths and code.
Soon come...
Sunday, 11 November 2012
Update in pictures...
Delay ! PT2399, slightly mod'ed for reggae and dub production... Free running feedback "Emergency" toggle switch, modulation and control... LUSH !!

Initial tests to some synth stuff through midi, and of course...MIDI !!
Will be using the Pinguino board with a PIC32 at 80Mhz ...BOOM !
You even get space to add delay and all....
Proverbial Cheat sheet !!
Saturday, 21 July 2012
DubWorks Studio delay for dub and reggae productions
Studio delay ( DubWorks model, based around the Princeton Technologies PT2399, redesigned for dub and reggae productions ) getting ready to leave premises..
This model was redesigned so it could give me all the sounds a good reggae and dub production needs( meaning old school grit and sounds)
This one is going to Brad The Manor, in London .
This model was redesigned so it could give me all the sounds a good reggae and dub production needs( meaning old school grit and sounds)
This one is going to Brad The Manor, in London .
Labels:
Arduino,
delay,
Dub,
DubWorks,
electronics,
general projects,
reggae,
Works
Tuesday, 26 June 2012
DIY DUBSIREN Kits (test PCB Boards)
My test PCB Boards( without ground plane, as they only test boards) just arrived...
So, after my tests, we will finally have available soon the DIY DUBSIREN Kits available !! 2 Diff models !! Nuff works happening !!
So, after my tests, we will finally have available soon the DIY DUBSIREN Kits available !! 2 Diff models !! Nuff works happening !!
Labels:
Alpha II,
Arduino,
Atari,
ATMega328,
AVR,
delay,
Dub,
DubWorks,
electronics,
general projects,
Mega,
open source,
Punk Console,
reggae,
siren
Thursday, 31 May 2012
Basic Dubsiren with basic delay (Rack version analog)
Basic Dubsiren with basic delay (Rack version analog)
Tuesday, 29 May 2012
The Arduino Mega, sent from
Spain, has arrived on the 22nd of May( only now had time, i know)!!
Boosts an Atmel Mega 2560 chip, and just what i needed for some of the designs i want to work on...
If you want to know more about the shop that helped me with this, jump at http://www.ardumania.es/
Boosts an Atmel Mega 2560 chip, and just what i needed for some of the designs i want to work on...
If you want to know more about the shop that helped me with this, jump at http://www.ardumania.es/
Labels:
Alpha II,
Arduino,
Dub,
DubWorks,
electronics,
Mega,
open source,
reggae
Saturday, 5 May 2012
Open source is the key
Friday, 4 May 2012
DubWorks Alpha II Siren Generator with Arduino
©DubWorks Alpha II Siren Generator with Arduino
So, here is one of the first versions of a simple siren, adjustable in rate and speed of ramp-up/down.This is just a initial test and more complex will be, as soon as i finish my tests. Intend to include some drum synth type of sounds through sound synthesis as well as the analog side of it, all with values relayed by the LCD.
Some other effects will also be available through microcontroller side of things( phaser, delay and reverb, etc). Will be a slow pain staking project but its coming in good terms as will be much more modern compared tro what the analog side of things can give us.
Also started to look into some DSP uC's like dsPic series from Microchip ©
Some ideas you can use as starting point
Friday, 27 April 2012
Arduino Alpha II DubWorks
Arduino Alpha II DubWorks
Part of my research into the Arduino and sound generation and effectsSome ideas taken out of A.P.C.
More to come soon (details and code) ...
Thursday, 29 March 2012
After realizing that Arduino has spread all around, despite the fact that i am a PIC man myself, but still i decided to give it a go, and start working on implement it with some of the projects i normally build.
So intention is to develop a way of introducing an LCD, and interface control with the Arduino, and if not enough with the Atmel itself...
Intention is to have a nice graphic display of volume, specific relevant controls, etc, all through it...
So we wuld end up with an analog siren with top notch digital complements that would make them a few steps further in quality and number of sounds and features that a siren ( with or without delay) can offer...
All to make soundsystems, and DJ's armed with up-to-date sound gear.
Gonna take a while to develop the code, experiment etc, but im sure ill love it all the way !!
BOOOM !!!
PS-also seriously thinking of making DIY kits available soon, at least for some of the more basic builds, for those who want to build their own sirens, but dont have much knowledge to do it on their own...
So with nice tutorials, professional built PCB's, and the kit with necessary components, anyone with a steady hand and a bit of patient will be able to do it !!
If anyone has any ideas or opinions they would like to share in this field/question please let me know !!!
Tuesday, 27 March 2012
4 Pots, a momentary push button for triggering style, a toggle switch between permanent on siren and the push button.
two other switches with different capacitance, giving different oscillations.
Sounds like quick rising sirens are abound in this add on siren, that complements the other already shown
Testing it with the delay around the HT8972 IC ( cheap enough to have in a siren, at least if you want a budget thing).
two other switches with different capacitance, giving different oscillations.
Sounds like quick rising sirens are abound in this add on siren, that complements the other already shown
Testing it with the delay around the HT8972 IC ( cheap enough to have in a siren, at least if you want a budget thing).
Subscribe to:
Posts (Atom)



























