human sensing beam 2014. low resolution image and sound image 8 x 8 pixels sound: 8 notes in an...

21
Human Sensing Beam 2014

Upload: godwin-jefferson

Post on 28-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Human SensingBeam 2014

Low resolution image and Sound

• Image 8 x 8 pixels• Sound: 8 notes in an octave (13)•

http://www.youtube.com/watch?v=ljGMhDSSGFU&feature=relmfu

Musical Scale

• Notes are specific sounds• A melody is a sequence of these sounds

• Melody has “meaning”• Note sequence• Rythm

• Brain does a good job “remembering” sequences specific sounds

Sound Scapes

• “unspecific sounds” and iconic sounds– Noise– Background “canvas” of life– Uncontrolled sound– No coding sound

– But also “meaning”: bird sound, water sound, wind, applause: “iconic” sounds

Difference melody - iconic

• Melody is coded: can be low res– MIDI, very low filesize

• Iconic is uncoded: high res– HD, lots of memory

• Arduino can do – melody, – a bit of clicking, – but no really bird sounds, no MP3

Arduino Sound

• Quality: 8 bits (Arcade game sound)• If coded (melody): length no problem• If random clicks:no problem• If MP3: not possible (few seconds bad quality)– That is without extra electronics

Reinforced Arduino

• Sound Shields 1– Attach amplifier– Improve Volume– No improvement in Quality (still 8 bits)

• Sound Shields 2– Attach external memory– Improve volume, storage capacity– Improve quality

This Workshop Arduino

• Just attach an 8 Ohm speaker– With a capacitor to avoid short cutting a PIN

• Sound library, sound scale: melody• Sound click: some random sounds

• Tone• Sirene

Melody Script

• Arduino script environment• Examples, Melody

Script

MelodyNOTE sequenceNOT duration

PIN 8 for speaker

But speaker has 2 PINS:

Add:Pinmode(9, OUTPUT);digitalWrite(9, LOW);In setup(){ }

Hardware

• Speaker• Capacitor• To digital PIN 8 +• To digital PIN 9 GND

(coded GND PIN)

Experiment with Melody script

• Add Notes• Change note duration• Change speed

• Make different melodies (search internet)– Short– Significant, eg Beethoven 5th theme

• Experiment with fast “texture”, upbeat style

Sound 2

• Use Click: digitalWrite(8, HIGH) and LOW• In between delay(milliseconds) command

• See script in next slide:

Sound scape Code• for (int i= 0; i< 1000; i++) {• clickSound();• }

• clickSound(){• digitalWrite(8, HIGH);• delay(1);• digitalWrite(8, LOW);• delay(1);• }

Problem:

• delay(1) = 1 millisecond, not fast enough• Special fastest command: • __asm__("nop\n\t"); • But this is too fast! Toooooo high notes.• Make this command slower with another for

loop:• for(int i2 = 0 ; i2<beats ;i2++)• __asm__("nop\n\t");

No you can go high pitch:

• for(int i2 = 0 ; i2<beats ;i2++)• __asm__("nop\n\t");

• Instead of “delay( .. )”

• (double for loops)• Change “beats” inside the loop for obtaining

sirenes

Experiments• Alternate melody with sirenes

• Sequential programming• Block 1: melody1• Block 2: sirene1, say “up”• Block 3: melody2• Block 4: sirene2, say “down”

• Try to make “sense” sound

If statement

• Forking possibilities• Instead of 4 blocks repeating: choice

• Choice can be: – human input, push button, paper button– Sensor input, digital or analog

• Needed for us: analog input

Analog PINS, 6 of them

• Input range 0-1023

• Normally used for sensors – light (LDR)– Temperature– Pollution

• Capacitive sensor: electrostatic charge

Breadboard

Smart Connections

• Standardized!