Go Down

Topic: Synthetiserphone finished !!! (Read 1 time) previous topic - next topic

ikaruga

I just finished building my own synthetiser  ! My first electronic device ever. Was so fun !! It s crazy how many hours i spent making holes and cutting wires, I m not a very craftish person, I like digital stuff more. But this electronic sculpture was a blast to build ! I ve never done any sort of electronics before this, so it was a lot of learning : )

I ve made a sound demo: http://vimeo.com/295157

and here s some pics on Flickr : http://www.flickr.com/photos/12335826@N00/1306528722/in/photostream/

Daniel

that is way cool, can we see the code and schematic?

D

ikaruga

Code: [Select]
// TONES  ==========================================
//       note, period, &  frequency.

#define  R     0
#define  c     3830    // 261 Hz
#define  d     3400    // 294 Hz
#define  e     3038    // 329 Hz
#define  f     2864    // 349 Hz
#define  g     2550    // 392 Hz
#define  a     2272    // 440 Hz
#define  b     2028    // 493 Hz
#define  C     1912    // 523 Hz
#define  SN   10000    // SNARE
#define  KI   13000    // SNARE


// SETUP ============================================
int videoOut = 8;
int speakerOut = 9;
int subOut = 10;
int ledPin = 12;
int potPin = 2;    
int tempoOut = 0;    
int inPin = 7;   // choose the input pin (for a pushbutton)
int val = 0;     // variable for reading the pin status  


// Do we want debugging on serial out? 1 for yes, 0 for no
int DEBUG = 1;

void setup() {
 pinMode(speakerOut, OUTPUT);
 pinMode(subOut, OUTPUT);
 pinMode(videoOut, OUTPUT);
 pinMode(ledPin, OUTPUT);      // sets the digital pin as output
 pinMode(inPin, INPUT);    // declare pushbutton as input
 
 if (DEBUG) {
   Serial.begin(9600); // Set serial out if we want debugging
 }
}

// MELODY and TIMING  =======================================
int melody[] = { KI};
int beats[]  = { 16};
int MAX_COUNT = sizeof(melody) / 2; // Melody length, for looping.

// CONFIG             =======================================
long tempo = 60000;
int pause = 5000;
int rest_count = 0; //<-BLETCHEROUS HACK; See NOTES
int tone = 0;
int beat = 0;
long duration  = 10;

// PLAY TONE  ==============================================
void playTone() {
 long elapsed_time = 0;
 if (tone > 0) {
   while (elapsed_time < duration) {

val = digitalRead(inPin);  // read input value

     digitalWrite(speakerOut,HIGH);
     if (val == HIGH) {     digitalWrite(subOut,HIGH); } else { };
     digitalWrite(videoOut,HIGH);
     digitalWrite(ledPin, HIGH);   // sets the LED on
     delayMicroseconds(tone / 2);

     digitalWrite(speakerOut, LOW);
     if (val == HIGH) {     digitalWrite(subOut,LOW); } else { };
     digitalWrite(videoOut, LOW);
     digitalWrite(ledPin, LOW);    // sets the LED off
     delayMicroseconds(tone / 2);

     // Keep track of how long we pulsed
     elapsed_time += (tone);
   }
 }
 else { // Rest beat; loop times delay
   for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
     delayMicroseconds(duration);  
   }                                
 }                                
}

// LET THE WILD RUMPUS BEGIN =============================
void loop() {
 int potone = analogRead(potPin);    // read the value from the sensor
 // Set up a counter to pull from melody[] and beats[]
 for (int i=0; i<MAX_COUNT; i++) {


   tone = potone*10 ;
   beat = beats[i];


   playTone();
   // A pause between notes...
   delayMicroseconds(potone*1000);

   if (DEBUG) { // If debugging, report loop, tone, beat, and duration
     Serial.print(i);
     Serial.print(":");
     Serial.print(beat);
     Serial.print(" ");    
     Serial.print(tone);
     Serial.print(" ");
     Serial.println(duration);
   }
 }
}





Voila!

I m glad you liek ^_^

For the schematics well .. I ll make them tonight , they re gonna be a asshole to draw, there s 7-8 output pins and a couple more : p


Narbotic

Aah, so that's why you've been so quiet.
Ecellent work!

ikaruga

yay thanks narbotic : ) !!! no need to say you ve been my inspiration on this : ) Sorry bout the quietness ^_^ UPDATE YOUR BLOG !

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy