EIE4-FYP/demo/note

89 lines
1.5 KiB
Plaintext

#include <stdint.h>
#pragma once
// Function Definition
#ifdef CSR_AUDIO_BASE
void note(uint32_t frequency, unsigned int duration_ms);
void wave(uint32_t wave);
#endif
// Notes
#define NOTE_NONE 0
#define NOTE_C2 65
#define NOTE_C2S 69
#define NOTE_D2 73
#define NOTE_D2S 78
#define NOTE_E2 82
#define NOTE_F2 87
#define NOTE_F2S 93
#define NOTE_G2 98
#define NOTE_G2S 104
#define NOTE_A2 110
#define NOTE_A2S 117
#define NOTE_B2 123
#define NOTE_C3 131
#define NOTE_C3S 139
#define NOTE_D3 147
#define NOTE_D3S 156
#define NOTE_E3 165
#define NOTE_F3 175
#define NOTE_F3S 185
#define NOTE_G3 196
#define NOTE_G3S 208
#define NOTE_A3 220
#define NOTE_A3S 233
#define NOTE_B3 247
#define NOTE_C4 262
#define NOTE_C4S 277
#define NOTE_D4 294
#define NOTE_D4S 311
#define NOTE_E4 330
#define NOTE_F4 349
#define NOTE_F4S 370
#define NOTE_G4 392
#define NOTE_G4S 415
#define NOTE_A4 440
#define NOTE_A4S 466
#define NOTE_B4 494
#define NOTE_C5 523
#define NOTE_C5S 554
#define NOTE_D5 587
#define NOTE_D5S 622
#define NOTE_E5 659
#define NOTE_F5 698
#define NOTE_F5S 740
#define NOTE_G5 784
#define NOTE_G5S 831
#define NOTE_A5 880
#define NOTE_A5S 932
#define NOTE_B5 988
#define NOTE_C6 1047
#define NOTE_C6S 1109
#define NOTE_D6 1175
#define NOTE_D6S 1245
#define NOTE_E6 1319
#define NOTE_F6 1397
#define NOTE_F6S 1480
#define NOTE_G6 1568
#define NOTE_G6S 1661
#define NOTE_A6 1760
#define NOTE_A6S 1865
#define NOTE_B6 1976
#define NOTE_C7 2093
// Waves
#define WAVE_SAW 0
#define WAVE_SQUARE 1
#define WAVE_TRIANGLE 2
#define WAVE_SINE 3