Beep Melodies

Sound & music loading, recording, streaming etc.

Beep Melodies

Postby LukasBanana » Sat Mar 06, 2010 1:20 pm

In SPE 1.8 there are some functions called "playMelody" and "setMelodySpeed". On Windows using "Beep" and on Linux using shell program "beep" (must be installed) with the correct frequencies.

Here is a small example playing the SuperMario Overworld Theme begin: :lol:

Code: Select all
// Set the speed of melody (the value is just multiplied be the time and sleep-duration of each note)
sound::setMelodySpeed(2.0f);

#if 1 // 1 or 0 when using the first or the second example

// Note name first (there is also CIS, DIS etc.), Octave, Time, Sleep-duration
sound::playMelody(sound::NOTE_E, 3, 250, 10);
sound::playMelody(sound::NOTE_E, 3, 250, 250);
sound::playMelody(sound::NOTE_E, 3, 250, 250);
sound::playMelody(sound::NOTE_C, 3, 250, 10);
sound::playMelody(sound::NOTE_E, 3, 250, 250);
sound::playMelody(sound::NOTE_G, 3, 250, 500);
sound::playMelody(sound::NOTE_G, 2, 250, 0);

#else

// The same using the second "playMelody" function:
// 'O' is the octave, 'T' the time, 'S' the sleep duration after playing the tone and all the other letters are the Note's name ;-)
sound::playMelody("O3;T250;S10;E;S250;E;E;S10;C;S250;E;S750;G;O2;S0;G;");

#endif


Last bumped by LukasBanana on Sat Mar 06, 2010 1:20 pm.
User avatar
LukasBanana
Site Admin
 
Posts: 217
Joined: Thu Aug 27, 2009 5:33 pm
Location: Germany

Return to Sound & Music

Who is online

Users browsing this forum: No registered users and 1 guest