tetris melodie with speaker

29 Oct 2012

/media/uploads/bfsl_7/unbenannt.png

Can sombody who can C++ programat an make music the Tetris melodie or an other melodie on a speaker play. You must after a time change the frequence of the speaker.

Writt it her if you would like to do this. Thank you

31 Oct 2012

Hi,..

wire one side of a piezo buzzer to pin 23, and the other side to ground. (one of those little disc piezo buzzers that can run from 3v3, that cost £0.12 will do)

and import and compile and run this program

http://mbed.org/users/DaveStyles/code/popcorn/

have fun..

Dave.

05 Nov 2012

Nice Programm thank you

07 Nov 2012

Are there any other melodys??

08 Nov 2012

Well..

all the notes are listed in the play() method so that you can make up new melodies like this..

void aMelody(){
play("b")
play("c")
play("f#")
etc....
}

If you look on the internet for melodies, you can then make a new method like the popcorn() method.

Have fun.

08 Nov 2012

I cant read notes. I dont know wath "a" "b" or "c" means. But is it a hard work to make the melodie for the Tetris sound http://de.wikipedia.org/w/index.php?title=Datei:Korobeiniki.jpg&filetimestamp=20100502134829 here is a link to the notes. Thanks again for the popcorn sound. :-)

Daniel

08 Nov 2012

I'm afraid I can't read notes either.. but I looked up "guitar tabs" or "keyboard tabs" and got them from there. Have a google around, see if you can find a list of the notes, then you can change the program.

09 Nov 2012

I'm guessing that if it's up on wikipedia, it's public domain, so this isn't illegal or anything. To play this you'd need to add a function that enables you to change the duration of the notes, seeing as the very first note (one quarter note) of the song is as long as the next two (two eighth notes) combined. I'm not sure how fast this is supposed to be, but common times are 60 BPM, 90 BPM, and 120 BPM, with the quarter note being one beat. At 60 this would make a quarter note a full second, and an eighth note half a second long, at 120 the quarter note would be half a second and the eighth a quarter second long and at 90 it's right between those values. There's a very high C in the song, so I'd halve all the frequencies from the popcorn example and add another C and call it Chigh or something like that and make that 1024Hz. Otherwise you'd have to make it 2048Hz, which I'm not sure the buzzer could produce.

Anyway, here's the names of the notes in order: G D Eb | F Eb D | C C Eb | G F Eb | D Eb | F G | Eb C | C [QR] | [ER] F Ab | Chigh Bb Ab | G Eb | G F Eb | D D Eb | F G | Eb C | C [QR]. | isn't a letter, it's a vertical line to keep track of the measures. If you halve all the frequencies from the popcorn example, the Ab's in this case would be at 830 Hz, judging from this: http://www.phy.mtu.edu/~suits/notefreqs.html.

All the notes that are by themselves are quarter notes, the ones that are tied together at the bottom are eighths. [QR] is supposed to represent a quarter rest: you don't play anything for the duration of a quarter note. [ER] is an eighth rest: don't play anything for the duration of an eighth note. In the fifth measure (measures are divided bij straight vertical lines) I wrote one D and then an Eb, even though there are two D's in a row. This is because of the little arc over them, which means you play them as one continued note. In the case of 60 BPM this would mean you hould that note for 1,5 seconds. Same with the G in the eleventh measure.

09 Nov 2012

I made some revisions to David Styles' Popcorn program and library. You can find it here: http://mbed.org/users/wsjoukes/code/Tetris/ This should play fine (it does for me), although I would make some small changes to the duration of the notes, so that the values in buzzer.beepTime() are slightly shorter than the values in wait(). That should help make the notes more distinctive, rather than sounding like they're all tied together. I just tried subtracting .05 (so that Q, for example, now looks like buzzer.beepTime(0.45); wait (0.5);) and that sounds better already. I'm sure there must be an easier and more efficient way to get this working, but I wouldn't know how to do that.

14 Nov 2012

Thank you this program is thet wath i ve search. Its verry beautifull. (With 0.05 sec lesser beep the sound is better)

Thank you