ls a fraction of music

11
Learning Situation (LS): A fraction of music! Teacher: Carlos Morales Socorro High School: IES El Calero Subject: Maths Interdisciplinary? Music Level: 2º ESO LOE Methodology: TaskBL Driving question: How could we play music with Arduino? Final Product: Arduino program Expert: None Products / Milestones: (a<b, “a” has to be finished before “b”) Test < Score - Table of fractions < Arduino Program Resources needed: Computer Duration: <2 weeks -.- Criterios de Evaluación 2ESO LOE x 1. Resolver problemas que involucren operaciones y propiedades con números enteros, fracciones, decimales y porcentajes relacionados con la vida diaria. 2. Identificar relaciones de proporcionalidad numérica y geométrica y utilizarlas para resolver problemas en situaciones de la vida cotidiana. x 3. Utilizar el lenguaje algebraico para simbolizar, generalizar y resolver problemas sencillos utilizando métodos numéricos, gráficos o algebraicos. 4. Utilizar estrategias de estimación y cálculo para obtener áreas y volúmenes de cuerpos geométricos, expresando el resultado de la estimación o el cálculo en la unidad de medida más adecuada. 5. Utilizar el teorema de Thales y los criterios de semejanza para interpretar relaciones de proporcionalidad geométrica entre segmentos y figuras planas, y para construir figuras semejantes con una razón dada. 6. Obtener información práctica de gráficas sencillas (de trazo continuo) relacionadas con fenómenos naturales y la vida cotidiana. 7. Representar e interpretar tablas y gráficas cartesianas de relaciones funcionales sencillas, basadas en la proporcionalidad directa, y obtener la relación de proporcionalidad entre dos magnitudes a partir del análisis de su tabla de valores y de su gráfica. 8. Planificar y realizar estudios estadísticos sencillos para conocer las características de una población, recoger, organizar y presentar los datos relevantes, utilizando los métodos apropiados y las herramientas informáticas adecuadas. x 9. Utilizar estrategias y técnicas de resolución de problemas, tales como el análisis del enunciado, el ensayo y error sistemático, la división del problema en partes, así como la comprobación de la coherencia de la solución obtenida y expresar, utilizando el lenguaje matemático adecuado a su nivel, el procedimiento que se ha seguido en la resolución. 1

Upload: carlos-morales-socorro

Post on 13-Apr-2017

2.946 views

Category:

Education


0 download

TRANSCRIPT

Page 1: LS A fraction of music

Learning Situation (LS): A fraction of music!Teacher: Carlos Morales Socorro

High School: IES El Calero

Subject: Maths

Interdisciplinary? Music

Level: 2º ESO LOE

Methodology: TaskBL

Driving question: How could we play music with Arduino?

Final Product: Arduino program

Expert: None

Products / Milestones:(a<b, “a” has to be finished before “b”)

Test < Score - Table of fractions < Arduino Program

Resources needed: Computer

Duration: <2 weeks

-.-

Criterios de Evaluación 2ESO LOE

x 1. Resolver problemas que involucren operaciones y propiedades con números enteros, fracciones, decimales y porcentajes relacionados con la vida diaria.

2. Identificar relaciones de proporcionalidad numérica y geométrica y utilizarlas para resolver problemas en situaciones de la vida cotidiana.

x 3. Utilizar el lenguaje algebraico para simbolizar, generalizar y resolver problemas sencillos utilizando métodos numéricos, gráficos o algebraicos.

4. Utilizar estrategias de estimación y cálculo para obtener áreas y volúmenes de cuerpos geométricos, expresando el resultado de la estimación o el cálculo en la unidad de medida más adecuada.

5. Utilizar el teorema de Thales y los criterios de semejanza para interpretar relaciones de proporcionalidad geométrica entre segmentos y figuras planas, y para construir figuras semejantes con una razón dada.

6. Obtener información práctica de gráficas sencillas (de trazo continuo) relacionadas con fenómenos naturales y la vida cotidiana.

7. Representar e interpretar tablas y gráficas cartesianas de relaciones funcionales sencillas, basadas en la proporcionalidad directa, y obtener la relación de proporcionalidad entre dos magnitudes a partir del análisis de su tabla de valores y de su gráfica.

8. Planificar y realizar estudios estadísticos sencillos para conocer las características de una población, recoger, organizar y presentar los datos relevantes, utilizando los métodos apropiados y las herramientas informáticas adecuadas.

x9. Utilizar estrategias y técnicas de resolución de problemas, tales como el análisis del enunciado, el ensayo y error sistemático, la división del problema en partes, así como la comprobación de la coherencia de la solución obtenida y expresar, utilizando el lenguaje matemático adecuado a su nivel, el procedimiento que se ha seguido en la resolución.

-.-

Contenidos

I. Estrategias, habilidades,

destrezas y actitudes generales

II. Números III. Álgebra IV. Geometría V. Funciones y Gráficas

VI. Estadística y Probabilidad

Let there be rock! - AC/DC

1

Page 2: LS A fraction of music

Act 1: How could we play music with Arduino?

Check this out if you don't know Arduino: https://www.youtube.com/watch?v=Kgz0vD1vSxY

Look at the tone instruction, it's the key!!

tone()

-Description

Generates a square wave of the specified frequency (and 50% duty cycle) on a pin. A duration can be specified, otherwise the wave continues until a call to noTone(). The pin can be connected to a piezo buzzer or other speaker to play tones.

NOTE: if you want to play different pitches on multiple pins, you need to call noTone() on one pin before calling tone() on the next pin.

-Syntax

tone(pin, frequency)

tone(pin, frequency, duration)

-Parameters

pin: the pin on which to generate the tone

frequency: the frequency of the tone in hertz

duration: the duration of the tone in milliseconds (optional)

Try to find out how to play this famous tune:

Arduino playing Brahms: https://youtu.be/5wiw20wZobs

Plan:

2

Page 3: LS A fraction of music

Act 2. Let's design the fraction's table:

Measure nº Fractions Addition

3

Page 4: LS A fraction of music

Act 3. Let's find out the notes' table:

-- España United Kingdom - USA

Measure nº Notes (DO, RE, MI, FA, SOL, LA, SI, DO, ...) Notes (C, D, E, F, G, A, B, D, ...)

4

Page 5: LS A fraction of music

Act 4. Look at this frequency-note's table and design a set of tone instructions to play the first three measures of the tune:

/*****************************************************************************

Example: #define NOTE_A4 440 → The frequency of LA4 is 440 hertz

*****************************************************************************/

#define NOTE_B0 31

#define NOTE_C1 33

#define NOTE_CS1 35

#define NOTE_D1 37

#define NOTE_DS1 39

#define NOTE_E1 41

#define NOTE_F1 44

#define NOTE_FS1 46

#define NOTE_G1 49

#define NOTE_GS1 52

#define NOTE_A1 55

#define NOTE_AS1 58

#define NOTE_B1 62

#define NOTE_C2 65

#define NOTE_CS2 69

#define NOTE_D2 73

#define NOTE_DS2 78

#define NOTE_E2 82

#define NOTE_F2 87

#define NOTE_FS2 93

#define NOTE_G2 98

#define NOTE_GS2 104

#define NOTE_A2 110

#define NOTE_AS2 117

#define NOTE_B2 123

#define NOTE_C3 131

#define NOTE_CS3 139

#define NOTE_D3 147

#define NOTE_DS3 156

#define NOTE_E3 165

#define NOTE_F3 175

#define NOTE_FS3 185

#define NOTE_G3 196

#define NOTE_GS3 208

#define NOTE_A3 220

#define NOTE_AS3 233

#define NOTE_B3 247

#define NOTE_C4 262

#define NOTE_CS4 277

#define NOTE_D4 294

#define NOTE_DS4 311

#define NOTE_E4 330

#define NOTE_F4 349

#define NOTE_FS4 370

#define NOTE_G4 392

#define NOTE_GS4 415

#define NOTE_A4 440

#define NOTE_AS4 466

#define NOTE_B4 494

#define NOTE_C5 523

#define NOTE_CS5 554

#define NOTE_D5 587

#define NOTE_DS5 622

#define NOTE_E5 659

#define NOTE_F5 698

#define NOTE_FS5 740

#define NOTE_G5 784

#define NOTE_GS5 831

#define NOTE_A5 880

#define NOTE_AS5 932

#define NOTE_B5 988

#define NOTE_C6 1047

#define NOTE_CS6 1109

#define NOTE_D6 1175

#define NOTE_DS6 1245

#define NOTE_E6 1319

#define NOTE_F6 1397

#define NOTE_FS6 1480

#define NOTE_G6 1568

#define NOTE_GS6 1661

#define NOTE_A6 1760

#define NOTE_AS6 1865

#define NOTE_B6 1976

#define NOTE_C7 2093

#define NOTE_CS7 2217

#define NOTE_D7 2349

#define NOTE_DS7 2489

#define NOTE_E7 2637

#define NOTE_F7 2794

#define NOTE_FS7 2960

#define NOTE_G7 3136

#define NOTE_GS7 3322

#define NOTE_A7 3520

#define NOTE_AS7 3729

#define NOTE_B7 3951

#define NOTE_C8 4186

#define NOTE_CS8 4435

#define NOTE_D8 4699

#define NOTE_DS8 4978

5

Page 6: LS A fraction of music

If we use arduino's pin 8 and a Measure lasts 1200 ms:

tone(pin, frequency, duration)

-.-

tone(8,0,800); delay(800);

tone(8,NOTE_E3,200); delay(200);

tone(

tone(

tone(

tone(

tone(

tone(

tone(

Act 5. Design an Arduino program to play it. Click on Upload!

void setup() {

// put your setup code here, to run once:

int buzzerPin=8;

pinMode(buzzerPin,OUTPUT);

tone(

delay(

tone(

delay(

tone(

delay(

tone(

delay(

tone(

delay(

tone(

delay(

tone(

delay(

tone(

delay(

tone(

6

Page 7: LS A fraction of music

noTone(buzzerPin);

}

Act 6. What could we do to increase the quality of the program?

Key 1: Use the “for” structure to avoid a lot of tone+delay lines.

Key 2: Use Algebra to make it more powerful!

Videotutorial: https://www.youtube.com/watch?v=eH2ozmow2TU

// Basado en el tutorial https://www.arduino.cc/en/Tutorial/ToneMelody?from=Tutorial.Tone

#include "pitches.h"

// Fichero externo con las frecuencias asociadas a cada nota de cada una de las 8 octavas que admite el zumbador.

void setup() {

int i; // variable contadora

float duracionCompas=1200;

// variable que marca la duración en milisegundos de un compás. Cuidado, las variables no admiten tildes.

int numNotas=53; // Número de notas

int pinZumbador=8; // Pin de salida para el zumbador

float tiempo;

float fraccionCompas[]={2.0/3.0, 1.0/6.0, 1.0/6.0,

3.0/6.0, 1.0/6.0, 2.0/6.0,

2.0/3.0, 1.0/6.0, 1.0/6.0,

1.0/3.0, 1.0/3.0, 1.0/6.0, 1.0/6.0,

1.0/3.0, 1.0/3.0, 1.0/6.0, 1.0/6.0,

1.0/3.0, 1.0/3.0, 1.0/6.0, 1.0/6.0,

2.0/3.0, 1.0/6.0, 1.0/6.0,

1.0/6.0, 1.0/6.0, 1.0/3.0, 1.0/3.0,

2.0/3.0, 1.0/6.0, 1.0/6.0,

2.0/3.0, 1.0/6.0, 1.0/6.0,

2.0/3.0, 1.0/6.0, 1.0/6.0,

1.0/3.0, 1.0/3.0, 1.0/3.0,

2.0/3.0, 1.0/6.0, 1.0/6.0,

2.0/3.0, 1.0/6.0, 1.0/6.0,

7

Page 8: LS A fraction of music

2.0/3.0, 1.0/6.0, 1.0/6.0,

1.0/3.0, 1.0/3.0, 1.0/3.0,

3.0/3.0

};

// Tabla-vector con las fracciones de compás que dura cada nota.

// Cada compás debe sumar 1, salvo si tiene ligaduras.

int melodia[] = {0, NOTE_E4, NOTE_E43,

NOTE_G4, NOTE_E4, NOTE_E4,

NOTE_G4, NOTE_E4, NOTE_G4,

NOTE_C5, NOTE_B4, 0, NOTE_A4,

NOTE_A4, NOTE_G4, NOTE_D4, NOTE_E4,

NOTE_F4, NOTE_D4, NOTE_D4, NOTE_E4,

NOTE_F4, NOTE_D4, NOTE_F4,

NOTE_B4, NOTE_A4, NOTE_G4, NOTE_B4,

NOTE_C5, NOTE_C4, NOTE_C4,

NOTE_C5, NOTE_A4, NOTE_F4,

NOTE_G4, NOTE_E4, NOTE_C4,

NOTE_F4, NOTE_G4, NOTE_A4,

NOTE_G4, NOTE_C4, NOTE_C4,

NOTE_C4, NOTE_A4, NOTE_F4,

NOTE_G4, NOTE_E4, NOTE_C4,

NOTE_F4, NOTE_E4, NOTE_D4,

NOTE_C4

};

// Tabla-vector con las alturas de cada nota según tablatura: C: Do, D: Re, E: Mi, F: Fa, G: Sol, A: La, B: Si, C: Do,..

// El 0 se usa para los silencios. El zumbador admite 8 octavas, por lo que se pueda escribir C1, C2, C3, ..., C8.

// Los sostenidos se escriben con una S adicional: Re# en tercera octava: D3S. Recuerda que Mib = Re#.

Serial.begin(9600);

pinMode(pinZumbador,OUTPUT);

for(i=0;i<numNotas;i++)

{

8

Page 9: LS A fraction of music

tiempo = duracionCompas*fraccionCompas[i];

Serial.println(tiempo);

tone(pinZumbador, melodia[i], (int) tiempo); // Emite la nota i con la duracion correspondiente.

delay((int) tiempo); // Espera a que termine esa nota para luego pasar a la siguiente.

}

noTone(pinZumbador); // Desactiva el zumbador.

}

void loop() {

// En esta ocasion no ponemos nada porque hacemos el bucle con N iteraciones (tantas como notas)

}

Act 6. Choose a melody and make Arduino play it!!

Step 1. Fill in your team fraction's table

Step 2. Fill in your team notes' table. Be careful with the octave.

Step 3. Design the Arduino program. Remember to adjust the variables: numNotas, duracionCompas, fraccionCompas and melodia.

9