Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
tranvu
/
iax583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
03356f9e
authored
Nov 05, 2018
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stuff
parent
41092e9c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
0 deletions
main.c
main.c
0 → 100644
View file @
03356f9e
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <windows.h>
#include <pthread.h>
#define beatLength 250
#define a3f 208
#define b3f 233
#define b3 247
#define c4 261
#define c4s 277
#define e4f 311
#define f4 349
#define a4f 415
#define b4f 466
#define b4 493
#define c5 523
#define c5s 554
#define e5f 622
#define f5 698
#define f5s 740
#define a5f 831
#define rest 0
void
playSound
();
int
main
()
{
playSound
();
}
void
playSound
()
{
// Intro of song----------------------------------------------------------------------
int
intro_melody
[]
=
{
c5s
,
e5f
,
e5f
,
f5
,
a5f
,
f5s
,
f5
,
e5f
,
c5s
,
e5f
,
rest
,
a4f
,
a4f
};
int
intro_rhythmn
[]
=
{
6
,
10
,
6
,
6
,
1
,
1
,
1
,
1
,
6
,
10
,
4
,
2
,
10
};
// Part 3 or 5 of song----------------------------------------------------------------
int
verse1_melody
[]
=
{
rest
,
c4s
,
c4s
,
c4s
,
c4s
,
e4f
,
rest
,
c4
,
b3f
,
a3f
,
rest
,
b3f
,
b3f
,
c4
,
c4s
,
a3f
,
a4f
,
a4f
,
e4f
,
rest
,
b3f
,
b3f
,
c4
,
c4s
,
b3f
,
c4s
,
e4f
,
rest
,
c4
,
b3f
,
b3f
,
a3f
,
rest
,
b3f
,
b3f
,
c4
,
c4s
,
a3f
,
a3f
,
e4f
,
e4f
,
e4f
,
f4
,
e4f
,
c4s
,
e4f
,
f4
,
c4s
,
e4f
,
e4f
,
e4f
,
f4
,
e4f
,
a3f
,
rest
,
b3f
,
c4
,
c4s
,
a3f
,
rest
,
e4f
,
f4
,
e4f
};
int
verse1_rhythmn
[]
=
{
2
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
1
,
5
,
1
,
1
,
1
,
1
,
3
,
1
,
2
,
1
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
1
,
1
,
3
,
1
,
1
,
1
,
1
,
2
,
1
,
1
,
1
,
1
,
1
,
1
,
4
,
5
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
2
,
2
,
2
,
1
,
1
,
1
,
3
,
1
,
1
,
1
,
3
};
// Part 4 or 6 of song-----------------------------------------------------------------
int
chorus_melody
[]
=
{
b4f
,
b4f
,
a4f
,
a4f
,
f5
,
f5
,
e5f
,
b4f
,
b4f
,
a4f
,
a4f
,
e5f
,
e5f
,
c5s
,
c5
,
b4f
,
c5s
,
c5s
,
c5s
,
c5s
,
c5s
,
e5f
,
c5
,
b4f
,
a4f
,
a4f
,
a4f
,
e5f
,
c5s
,
b4f
,
b4f
,
a4f
,
a4f
,
f5
,
f5
,
e5f
,
b4f
,
b4f
,
a4f
,
a4f
,
a5f
,
c5
,
c5s
,
c5
,
b4f
,
c5s
,
c5s
,
c5s
,
c5s
,
c5s
,
e5f
,
c5
,
b4f
,
a4f
,
rest
,
a4f
,
e5f
,
c5s
,
rest
};
int
chorus_rhythmn
[]
=
{
1
,
1
,
1
,
1
,
3
,
3
,
6
,
1
,
1
,
1
,
1
,
3
,
3
,
3
,
1
,
2
,
1
,
1
,
1
,
1
,
3
,
3
,
3
,
1
,
2
,
2
,
2
,
4
,
8
,
1
,
1
,
1
,
1
,
3
,
3
,
6
,
1
,
1
,
1
,
1
,
3
,
3
,
3
,
1
,
2
,
1
,
1
,
1
,
1
,
3
,
3
,
3
,
1
,
2
,
2
,
2
,
4
,
8
,
4
};
// Start playing--------------------------------------------------------------------
int
currentVerse
=
0
;
int
currentNote
=
0
;
while
(
currentVerse
<
6
)
{
if
(
currentVerse
==
0
||
currentVerse
==
1
)
{
if
(
currentNote
<
sizeof
(
verse1_rhythmn
)
/
sizeof
(
int
))
{
Beep
(
verse1_melody
[
currentNote
],
verse1_rhythmn
[
currentNote
]
*
beatLength
);
currentNote
++
;
}
else
{
currentVerse
++
;
currentNote
=
0
;
printf
(
"Current Verse: %d
\n
"
,
currentVerse
);
}
}
else
if
(
currentVerse
==
2
||
currentVerse
==
4
)
{
if
(
currentNote
<
sizeof
(
intro_rhythmn
)
/
sizeof
(
int
))
{
Beep
(
intro_melody
[
currentNote
],
intro_rhythmn
[
currentNote
]
*
beatLength
);
currentNote
++
;
}
else
{
currentVerse
++
;
currentNote
=
0
;
printf
(
"Current Verse: %d
\n
"
,
currentVerse
);
}
}
else
if
(
currentVerse
==
3
||
currentVerse
==
5
)
{
if
(
currentNote
<
sizeof
(
chorus_rhythmn
)
/
sizeof
(
int
))
{
Beep
(
chorus_melody
[
currentNote
],
chorus_rhythmn
[
currentNote
]
*
beatLength
);
currentNote
++
;
}
else
{
currentVerse
++
;
currentNote
=
0
;
printf
(
"Current Verse: %d
\n
"
,
currentVerse
);
}
}
else
currentVerse
++
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment