De presentatie wordt gedownload. Even geduld aub

De presentatie wordt gedownload. Even geduld aub

Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  Een (vaste) melodie spelen op de PC speaker 

Verwante presentaties


Presentatie over: "Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  Een (vaste) melodie spelen op de PC speaker "— Transcript van de presentatie:

1 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  Een (vaste) melodie spelen op de PC speaker  MIDI variable-length integers interpreteren

2 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 2 Geluid maken (werkt alleen op XP!) #include Beep( Frequency, Milliseconds ); _sleep( Milliseconds );

3 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 3 noten : naam (= toon hoogte)

4 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 4 noten : duur

5 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 5 nootnaam  frequentie

6 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 6 een geinitialiseerd array int Prime[ 9 ] = { 1, 2, 3, 5, 7, 11, 13, 17, 19 }; int Square[] = { 1, 4, 9, 16, 25, 36 };

7 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 7 een geinitialiseerd array (2) typedef struct { char naam[ 10 ]; float cijfer; } Student; Student Info[] = { { " hans ", 6.7 }, { " johan ", 3.2 }, { " michiel ", 7.8 }, { "", 0.0 } };

8 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 8 gebruik van #define (1) play( 4567, 400 ); play( 4793, 200 ); play( 4567, 400 ); play( 4793, 200 ); play( 4567, 400 ); play( 4793, 200 );

9 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 9 gebruik van #define (2) #define A 4567 #define B 4793 #define HALF 400 #define KWART 200 play( A, HALF ); play( B, KWART ); play( A, HALF ); play( B, KWART ); play( A, HALF ); play( B, KWART );

10 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 10 Opdracht 1 Maak een functie die je aanroept met -het MIDI noot nummer -de duur in milliseconden De functie moet dus het noot nummer vertalen naar de frequentie. De functie moet (voor debugging) ook de noot naam, nummer en duur afdrukken. Schrijf hiermee een programma dat een liedje laat horen. Gebruik #defines voor de lengtes (duur) van noten en eventueel voor de noten zelf. Gebruik een geinitialiseerd array om het liedje op te slaan.

11 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 11 MIDI variable-length integer format -7 ‘data’ bits per byte -hoogste bit 0 voor ‘laatste’ byte -maximum is 4 bytes (dus 4x7=28 bits)

12 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 12 MIDI variable-length integer format

13 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 13 Opdracht 2 Schrijf een functie met de volgende definitie: int MIDI_Int( unsigned char **p ); Deze functie wordt aangeroepen met een pointer naar een pointer naar een (reeks) MIDI variable-length integers. De functie lees de eerste MIDI integer, veschuift de pointer tot net na die integer, en geeft die integer waarde terug. Test je functie.


Download ppt "Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  Een (vaste) melodie spelen op de PC speaker "

Verwante presentaties


Ads door Google