8bit Mix Tape: Difference between revisions

From SGMK-SSAM-WIKI
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
==Overview==
==Overview==
The 8bit MixTape is an arduino compatible sound gadget, based on the [[Babygnusbuino]] ([http://www.anyma.ch/blogs/research/ anyma]) and [http://youtube.com/watch?v=GtQdIYUtAHg Viznut's "Algorithmic symphonies from one line of code"], put together by dusjagr, [http://lifepatch.org/ ucok] and iyok...
The 8bit MixTape is an arduino compatible sound gadget, based on the [[Babygnusbuino]] ([http://www.anyma.ch/blogs/research/ anyma]) and [http://youtube.com/watch?v=GtQdIYUtAHg Viznut's "Algorithmic symphonies from one line of code"], put together by dusjagr, [http://lifepatch.org/ ucok] and iyok...
Line 16: Line 15:
New version, v0.2, nicely fits into a tape, with battery, USB programming interface, LEDs and a button to choose different codes.
New version, v0.2, nicely fits into a tape, with battery, USB programming interface, LEDs and a button to choose different codes.


===What needs to be done===


===Code===
===Code===
Line 172: Line 173:


===Schematics===
===Schematics===
===Parts===
'''Babygnusbuino Parts:'''
* 1 Atmel Attiny85 microprocessor
* 2 resistors 68 Ohms
* 2 zeners 3.3V
* 1 resistor 1k6
* 1 capacitor 100n
'''8bit MixTape:'''
* 1 potentiometer 20kOhm lin
* 1 potentiometer 10kOhm log
* 1 bushbutton (the flat ones that fit on a breadboard)
* 1 mini Jack with switch, 3.5mm (mono in v0.2, stereo comes later)
* 2 LEDs (smd or 5mm), including resistors as wished
* 1 mini-speaker
* 2 CR2032 batteries
* 2 clips for batteries
* 1 switch on/off
* 1 mini-USB connector (u can also make your own USB cable, scavenging or get a USB plug)
* (1 capacitor, 0.1 - 1µF for low-pass filter if needed)
* (1 read/write head for magnetic tape)





Revision as of 06:49, 4 February 2013

Overview

The 8bit MixTape is an arduino compatible sound gadget, based on the Babygnusbuino (anyma) and Viznut's "Algorithmic symphonies from one line of code", put together by dusjagr, ucok and iyok...

Prototypes

v0.1

{{#widget:Vimeo|id=58727965}}

First version using a BabyGnusbuino attached to a card-board tape dummy

v0.2

{{#widget:Vimeo|id=58831051}}

New version, v0.2, nicely fits into a tape, with battery, USB programming interface, LEDs and a button to choose different codes.


What needs to be done

Code

8bit MixTape with button selector

/* Crazy shit 8-bit symphony generator                   */
/*     */
 
/*
 * inspired by:
 *  http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
 */
 
int speakerPin = 0;
int buttonPin = 2;
int potiPin3 = A3;
int potiPin4 = A2;
 
int buttonState = 0; 
int lastButtonState = 0;
int count = 0;

unsigned long int pulseWidthOFF = 0;
unsigned long int pulseWidthON = 0;
unsigned long int pulseWidthPart = 0;

int samplingDelay;
unsigned long int reg;

long t = 0; 
int v = 0; 
unsigned int c3 = 0;
unsigned int c4 = 0;

unsigned int analogValue;
 
void setup () {
  
  TCCR0B = TCCR0B & 0b11111001;
  
  pinMode (speakerPin, OUTPUT);
  pinMode(buttonPin, INPUT);
  pinMode (potiPin3, INPUT);
  pinMode (potiPin4, INPUT);

  reg = 0x551155aaL;
 
}
 
 
void loop () {
  // read the state of the switch into a local variable:
  buttonState = digitalRead(buttonPin);
  
  if (buttonState != lastButtonState && buttonState == HIGH) {
    // if the state has changed, increment the counter
      count++;
      t = 0; 
      delay(10000); 
      if (count > 5) {
        count = 0;
      } 
    
  } 
  
  lastButtonState = buttonState;
 

 switch(count) {
   
 case 0: // a classic
     c4 = ((analogRead(potiPin4)>>6) + 1); 
     c3 = (analogRead(potiPin3)>>0);
     v = (t*(t>>8|t>>4))>>(t>>c4);
    analogWrite (speakerPin, v);
    delayMicroseconds(c3>>2);
    t++;
 
    break;
    
 case 1: // ding dong
 
     c4 = ((1023-(analogRead(potiPin4))>>6) + 1); 
     c3 = (analogRead(potiPin3)>>0);
     v = t * ((t>>15|t>>c4)&83&t>>(c4>>3));
     digitalWrite (speakerPin, v);
     delayMicroseconds(c3<<2);
     t++;
 
    break;
    
 case 2: // experimental 8 bit
 
     c4 = ((1023-(analogRead(potiPin4))>>6) + 1); 
     c3 = (analogRead(potiPin3)>>0);
     v = t * ((t>>15|t>>c4)&83&t>>(c4>>3));
     analogWrite (speakerPin, v);
     delayMicroseconds(c3);
     t++;
 
    break;
  
  
 case 3: // PWM modulation
 
     c3 = (analogRead(potiPin3));
     c4 = (analogRead(potiPin4) + 1);


     pulseWidthPart++;
     
     pulseWidthON = (c3 * pulseWidthPart / 255);
     pulseWidthOFF = (c3 - pulseWidthON);
          
     digitalWrite(speakerPin, HIGH);
     delay(pulseWidthOFF);
     digitalWrite(speakerPin, LOW);  
     delay(pulseWidthON); 

    if (pulseWidthPart == 255) {
      pulseWidthPart = 254 - (c4>>3);
    }
     break;
    
 case 4: //white noise
 
     unsigned long int newr;
     unsigned char lobit;
     unsigned char b31, b29, b25, b24;
 
     b31 = (reg & (1L << 31)) >> 31;
     b29 = (reg & (1L << 29)) >> 29;
     b25 = (reg & (1L << 25)) >> 25;
     b24 = (reg & (1L << 24)) >> 24;
 
    lobit = b31 ^ b29 ^ b25 ^ b24;
 
    newr = (reg << 1) | lobit;
   
    reg = newr;
  
    digitalWrite (speakerPin, reg & 1);
    samplingDelay = 1 + (2*(analogRead(potiPin3)>>0));
 
    delayMicroseconds (samplingDelay);
    
    break;
 }

}

Schematics

Parts

Babygnusbuino Parts:

  • 1 Atmel Attiny85 microprocessor
  • 2 resistors 68 Ohms
  • 2 zeners 3.3V
  • 1 resistor 1k6
  • 1 capacitor 100n

8bit MixTape:

  • 1 potentiometer 20kOhm lin
  • 1 potentiometer 10kOhm log
  • 1 bushbutton (the flat ones that fit on a breadboard)
  • 1 mini Jack with switch, 3.5mm (mono in v0.2, stereo comes later)
  • 2 LEDs (smd or 5mm), including resistors as wished
  • 1 mini-speaker
  • 2 CR2032 batteries
  • 2 clips for batteries
  • 1 switch on/off
  • 1 mini-USB connector (u can also make your own USB cable, scavenging or get a USB plug)
  • (1 capacitor, 0.1 - 1µF for low-pass filter if needed)
  • (1 read/write head for magnetic tape)


Links

http://youtube.com/watch?v=GtQdIYUtAHg http://wurstcaptures.untergrund.net/music/ http://wiki.sgmk-ssam.ch/index.php/Babygnusbuino