首先重温一下任务的三大要素:
·做何事(函数)
·栈(每个任务都应该有自己独享的栈)
·优先级(非必要的因素,但是有了优先级可以处理更多的任务)
一、如何创建任务:
当一个任务被切换出去之后,要想再找到他,应该去到某个链表里边分别取找到任务A、任务B和任务C等
链表中存放的是任务结构体(任务控制块TCB - Task Control Block)
穿件任务的时候,栈和TCB可以通过malloc动态分配,也可以事先通过静态分配
如下代码是动态分配内存
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode, // 函数指针, 任务函数
const char * const pcName, // 任务的名字
const configSTACK_DEPTH_TYPE usStackDepth, // 栈大小,单位为word,10表示40字节
void * const pvParameters, // 调用任务函数时传入的参数
UBaseType_t uxPriority, // 优先级
TaskHandle_t * const pxCreatedTask ); // 任务句柄, 以后使用它来操作这个任务
如下代码是静态分配内存
TaskHandle_t xTaskCreateStatic (
TaskFunction_t pxTaskCode, // 函数指针, 任务函数
const char * const pcName, // 任务的名字
const uint32_t ulStackDepth, // 栈大小,单位为word,10表示40字节
void * const pvParameters, // 调用任务函数时传入的参数
UBaseType_t uxPriority, // 优先级
StackType_t * const puxStackBuffer, // 静态分配的栈,就是一个buffer
StaticTask_t * const pxTaskBuffer // 静态分配的任务结构体的指针,用它来操作这个任务
);
上述两个函数一开始第一个参数都会传入函数指针,
动态分配内存的第三个参数传入了栈的大小,则会分配这个大小的栈,当我们提供了栈的大小,那么在函数的内部会自动分配一块指定大小的内存作为栈,这个传入的参数是整数,且他的单位是word,加入传入10则分配40字节的栈;第四个参数的参数是给第一个参数的函数用的
静态分配内存的第三个参数也是栈,也需要指定栈的大小,因为在后边的时候提供了一块buffer(第六个参数),得告知这块buffer有多大,通过我们设置的栈的大小去告知静态分配内存函数这个buffer有多大;同样第四个参数也是给第一个参数的函数使用的
在管理这些任务的时候,我们使用链表进行管理,每一个任务都有一个TCB结构体。
在动态分配内存这个函数里边,会分配栈、任务对应的TCB结构体;
在静态分配内存这个函数里边,需要我们事先准备好栈和TCB结构体,如函数中第七个参数就是TCB结构体的指针
二、代码编写
四个任务:
1.播放音乐
2.LED闪烁
3.RGB-LED呼吸灯
4.OLED显示红外遥控键值
首先打开资料里的空白模板,打开freertos.c,在115行处有一个默认的任务,我们在默认的任务里边执行接受红外显示键值的任务,
在编写新的任务之前,先对此函数进行跳转
函数中对栈指定了大小,但是并没有提供栈的空间,使用的是动态分配内存,
所以创建任务我们使用动态分配内存的函数 xTaskCreat();
xTaskCreate(PlayMusic,"SoundTask",128,NULL,osPriorityNormal,&xSoundTaskHandle);
第一个参数是函数,第二个参数是我们自己给他的命名,第三个参数是栈的大小,第四个参数是传入第一个参数这个函数的参数,我们不需要给我们playmusic这个函数传入参数,所以给null,第五个参数给默认优先级,第六个参数返回任务句柄,传入结构体的地址
同时创建任务需要有返回值,使用返回值能判断任务是否创建成功,在rtos初始化中进行返回值
void MX_FREERTOS_Init(void) {
/* USER CODE BEGIN Init */
TaskHandle_t xSoundTaskHandle;
TaskHandle_t xLedTaskHandle;
BaseType_t ret;
/* USER CODE END Init */
...
...
}
然后使用该返回值进行接收
ret = xTaskCreate(PlayMusic,"SoundTask",128,NULL,osPriorityNormal,&xSoundTaskHandle);
接下来是依葫芦画瓢创建自己的第二个任务,不过使用的是静态分配内存的函数,
/* 创建任务: 闪烁LED灯 */
xLightTaskHandle = xTaskCreateStatic(Led_Test,"LightTask",128,NULL,osPriorityNormal,g_pucStackOfLightTask,&g_TCBofLightTask);
/* 创建任务: RGB呼吸灯 */
xColorLedTaskHandle = xTaskCreateStatic(ColorLED_Test,"ColorTask",128,NULL,osPriorityNormal,g_pucStackOfColorLedTask,&g_TCBofColorLedTask); /* USER CODE END RTOS_THREADS */
前边5个参数和动态分配内存的没什么差别,第六个参数需要我们提供一个栈的buffer,在私有变量这里进行添加。
原本在这里使用uint8_t的时候需要128*4,因为传入的参数的大小是4字节,如果想传入128的话则需要写128*4
后来修改为StackType_t,这个的定义是uint32_t,从8位 -> 32位,所以不需要*4,
第7个参数需要提供一个TCB结构体,并&进行取址
第三个自己创建的任务同上,不过需要注意的一点有:需要将LCD的函数进行注释,原因是默认的任务中已经对LCD的函数进行调用,多个任务同时访问会出现问题,需要增加一些保护措施
静态任务写好之后也需要和前边动态任务一样,使用句柄接收返回值,但是略有差别
static TaskHandle_t xLightTaskHandle;
static TaskHandle_t xColorLedTaskHandle; //任务句柄
/* 创建任务: 闪烁LED灯 */
xLightTaskHandle = xTaskCreateStatic(Led_Test,"LightTask",128,NULL,osPriorityNormal,g_pucStackOfLightTask,&g_TCBofLightTask);
/* 创建任务: RGB呼吸灯 */
xColorLedTaskHandle = xTaskCreateStatic(ColorLED_Test,"ColorTask",128,NULL,osPriorityNormal,g_pucStackOfColorLedTask,&g_TCBofColorLedTask); /* USER CODE END RTOS_THREADS */
现在完成了这些任务的编写之后,补充上我们欠缺的music.c的文件
孤勇者源码链接:https://github.com/Lesterbor/GuYongZhe_PassiveBuzzer_STM32/blob/main/Music.c
点击链接进入github将源码进行下载,不过需要做一些微调,函数的变更
根据我们所拥有的蜂鸣器驱动文件, 将原函数(下列注释的)替换成驱动文件中的(未注释的)
//BSP_Buzzer_SetFrequency(Tone_Index[Music_Lone_Brave[i][0]][Music_Lone_Brave[i][1]]);
PassiveBuzzer_Set_Freq_Duty(Tone_Index[Music_Lone_Brave[i][0]][Music_Lone_Brave[i][1]],50);
//HAL_Delay(MusicSpeed/Music_Lone_Brave[i][2]);
mdelay(20);
如果要调用这些函数还需要对头文件进行引用
三、源码附上
freertos.c的代码
/* USER CODE BEGIN Header */
#include "driver_led.h"
#include "driver_lcd.h"
#include "driver_mpu6050.h"
#include "driver_timer.h"
#include "driver_ds18b20.h"
#include "driver_dht11.h"
#include "driver_active_buzzer.h"
#include "driver_passive_buzzer.h"
#include "driver_color_led.h"
#include "driver_ir_receiver.h"
#include "driver_ir_sender.h"
#include "driver_light_sensor.h"
#include "driver_ir_obstacle.h"
#include "driver_ultrasonic_sr04.h"
#include "driver_spiflash_w25q64.h"
#include "driver_rotary_encoder.h"
#include "driver_motor.h"
#include "driver_key.h"
#include "driver_uart.h"
/**
******************************************************************************
* File Name : freertos.c
* Description : Code for freertos applications
******************************************************************************
* @attention
*
* Copyright (c) 2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "FreeRTOS.h"
#include "task.h"
#include "main.h"
#include "cmsis_os.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN Variables */
static StackType_t g_pucStackOfLightTask[128];
static StaticTask_t g_TCBofLightTask;
static TaskHandle_t xLightTaskHandle;
static StackType_t g_pucStackOfColorLedTask[128];
static StaticTask_t g_TCBofColorLedTask;
static TaskHandle_t xColorLedTaskHandle; //任务句柄
/* USER CODE END Variables */
/* Definitions for defaultTask */
osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
.name = "defaultTask",
.stack_size = 128 * 4,
.priority = (osPriority_t) osPriorityNormal,
};
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN FunctionPrototypes */
/* USER CODE END FunctionPrototypes */
void StartDefaultTask(void *argument);
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
/**
* @brief FreeRTOS initialization
* @param None
* @retval None
*/
void MX_FREERTOS_Init(void) {
/* USER CODE BEGIN Init */
TaskHandle_t xSoundTaskHandle;
BaseType_t ret;
/* USER CODE END Init */
/* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */
/* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */
/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
/* Create the thread(s) */
/* creation of defaultTask */
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* 创建任务: 播放音乐 */
extern void PlayMusic(void *params);
ret = xTaskCreate(PlayMusic,"SoundTask",128,NULL,osPriorityNormal,&xSoundTaskHandle);
/* 创建任务: 闪烁LED灯 */
xColorLedTaskHandle = xTaskCreateStatic(Led_Test,"LightTask",128,NULL,osPriorityNormal,g_pucStackOfLightTask,&g_TCBofLightTask);
/* 创建任务: RGB呼吸灯 */
xColorLedTaskHandle = xTaskCreateStatic(ColorLED_Test,"ColorTask",128,NULL,osPriorityNormal,g_pucStackOfColorLedTask,&g_TCBofColorLedTask); /* USER CODE END RTOS_THREADS */
/* USER CODE BEGIN RTOS_EVENTS */
/* add events, ... */
/* USER CODE END RTOS_EVENTS */
}
/* USER CODE BEGIN Header_StartDefaultTask */
/**
* @brief Function implementing the defaultTask thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_StartDefaultTask */
void StartDefaultTask(void *argument)
{
/* USER CODE BEGIN StartDefaultTask */
/* Infinite loop */
LCD_Init();
LCD_Clear();
for(;;)
{
//Led_Test();
//LCD_Test();
//MPU6050_Test();
//DS18B20_Test();
//DHT11_Test();
//ActiveBuzzer_Test();
//PassiveBuzzer_Test();
//ColorLED_Test();
IRReceiver_Test();
//IRSender_Test();
//LightSensor_Test();
//IRObstacle_Test();
//SR04_Test();
//W25Q64_Test();
//RotaryEncoder_Test();
//Motor_Test();
//Key_Test();
//UART_Test();
}
/* USER CODE END StartDefaultTask */
}
/* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */
/* USER CODE END Application */
music.c代码
#include "driver_passive_buzzer.h"
#include "driver_timer.h"
#define Bass 0
#define Alto 1
#define Teble 2
#define One_Beat 1
#define One_TWO_Beat 2
#define One_FOUR_Beat 4
uint16_t Tone_Index[8][3]={
{0 ,0 ,0 },
{262,523,1046},
{294,587,1175},
{330,659,1318},
{349,698,1397},
{392,784,1568},
{440,880,1760},
{494,988,1976}
};
//
//中速代表乐曲速度术语里的Moderato,或称中板,每分钟在88到104拍。
//中速 每分钟100拍 一拍600ms
//两只老虎简谱,没有细调
uint16_t Music_Two_Tigers[][3]={
{0,0,570},
{1,Alto,One_Beat},
{2,Alto,One_Beat},
{3,Alto,One_Beat},
{1,Alto,One_Beat},
{0,Alto,24},
{1,Alto,One_Beat},
{2,Alto,One_Beat},
{3,Alto,One_Beat},
{1,Alto,One_Beat},
//{0,Alto,3},
{3,Alto,One_Beat},
{4,Alto,One_Beat},
{5,Alto,One_Beat},
{0,Alto,One_Beat},
{3,Alto,One_Beat},
{4,Alto,One_Beat},
{5,Alto,One_Beat},
{0,Alto,One_Beat},
{5,Alto,One_TWO_Beat},
{6,Alto,One_TWO_Beat},
{5,Alto,One_TWO_Beat},
{4,Alto,One_TWO_Beat},
{3,Alto,One_Beat},
{1,Alto,One_Beat},
//{0,Alto,3},
{5,Alto,One_TWO_Beat},
{6,Alto,One_TWO_Beat},
{5,Alto,One_TWO_Beat},
{4,Alto,One_TWO_Beat},
{3,Alto,One_Beat},
{1,Alto,One_Beat},
{0,Alto,24},
{1,Alto,One_Beat},
{5,Bass,One_Beat},
{1,Alto,One_Beat},
{0,Alto,One_Beat},
{1,Alto,One_Beat},
{5,Bass,One_Beat},
{1,Alto,One_Beat},
{0,Alto,One_Beat},
};
//曲信息
//中速 每分钟65拍 一拍920ms
uint16_t Music_Lone_Brave[][3]={
{0,0,920},
// #define Bass 0
// #define Alto 1
// #define Teble 2
// #define One_Beat 1
// #define One_TWO_Beat 2
// #define One_FOUR_Beat 4
//第一小节
{2,Alto,One_TWO_Beat} ,{7,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,
{2,Alto,One_TWO_Beat} ,{7,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,
//第二小节
{2,Alto,One_TWO_Beat} ,{7,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,
{2,Alto,One_TWO_Beat} ,{7,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,
//第三小节
{2,Alto,One_TWO_Beat} ,{7,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,
{2,Alto,One_TWO_Beat} ,{7,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,
//第四小节
{2,Alto,One_TWO_Beat} ,{7,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,
{2,Alto,One_TWO_Beat} ,{7,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,
//第五小节
{2,Alto,One_TWO_Beat} ,{7,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,
{2,Alto,One_TWO_Beat} ,{7,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,
//第六小节
{3,Alto,One_Beat} ,{3,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_FOUR_Beat} ,
{1,Alto,One_FOUR_Beat} ,{2,Alto,One_FOUR_Beat} ,{1,Alto,One_FOUR_Beat} ,
//第七小节
{3,Alto,One_Beat} ,{3,Alto,One_Beat} ,{0,Alto,One_TWO_Beat} ,{1,Alto,One_FOUR_Beat} ,
{2,Alto,One_FOUR_Beat} ,{1,Alto,One_FOUR_Beat} ,{2,Alto,One_FOUR_Beat} ,{3,Alto,One_FOUR_Beat} ,
//第八小节
{6,Bass,One_TWO_Beat} ,{1,Alto,One_FOUR_Beat} ,{6,Bass,One_TWO_Beat} ,{1,Alto,One_FOUR_Beat} ,
{6,Bass,One_TWO_Beat} ,{1,Alto,One_FOUR_Beat} ,{2,Alto,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,
//第九小节
{7,Bass,One_TWO_Beat} ,{7,Bass,One_FOUR_Beat},{0,Alto,One_TWO_Beat} ,{0,Alto,One_FOUR_Beat} ,
//第十小节
{3,Alto,One_Beat} ,{3,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_FOUR_Beat} ,
{1,Alto,One_FOUR_Beat} ,{2,Alto,One_FOUR_Beat},{1,Alto,One_FOUR_Beat} ,
//第十一小节
{3,Alto,One_Beat} ,{3,Alto,One_Beat} ,{0,Alto,One_TWO_Beat} ,{1,Alto,One_FOUR_Beat} ,
{2,Alto,One_FOUR_Beat} ,{1,Alto,One_FOUR_Beat},{2,Alto,One_FOUR_Beat} ,{3,Alto,One_FOUR_Beat} ,
//第十二小节
{6,Bass,One_TWO_Beat} ,{1,Alto,One_FOUR_Beat},{6,Bass,One_TWO_Beat} ,{1,Alto,One_FOUR_Beat} ,
{6,Bass,One_TWO_Beat} ,{1,Alto,One_FOUR_Beat},{3,Alto,One_TWO_Beat} ,{2,Alto,One_TWO_Beat} ,
//第十三小节
{7,Bass,One_TWO_Beat} ,{7,Bass,One_FOUR_Beat},{0,Alto,One_TWO_Beat} ,{0,Alto,One_FOUR_Beat} ,
//第十四小节
{6,Bass,One_FOUR_Beat} ,{1,Alto,One_FOUR_Beat},{6,Alto,One_TWO_Beat} ,{6,Alto,One_FOUR_Beat} ,
{0,Alto,20 /*小衔接*/} ,{6,Alto,One_FOUR_Beat},{6,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,
{6,Alto,One_TWO_Beat} ,{6,Alto,One_FOUR_Beat},{5,Alto,One_FOUR_Beat} ,{6,Alto,One_FOUR_Beat} ,
{5,Alto,One_FOUR_Beat} ,{6,Alto,One_FOUR_Beat},{5,Alto,One_FOUR_Beat} ,
//第十五小节
{3,Alto,One_FOUR_Beat} ,{3,Alto,One_TWO_Beat} ,{3,Alto,One_Beat} ,{0,Alto,20 /*小衔接*/} ,
{0,Alto,One_Beat} ,{0,Alto,One_TWO_Beat} ,{6,Bass,One_FOUR_Beat} ,{1,Alto,One_FOUR_Beat} ,
//第十六小节
{6,Alto,One_TWO_Beat} ,{6,Alto,One_FOUR_Beat},{0,Alto,20 /*小衔接*/} ,{6,Alto,One_FOUR_Beat} ,
{5,Alto,One_FOUR_Beat} ,{6,Alto,One_FOUR_Beat},{5,Alto,One_FOUR_Beat} ,{7,Alto,One_TWO_Beat} ,
{7,Alto,One_FOUR_Beat} ,{0,Alto,20 /*小衔接*/},{7,Alto,One_FOUR_Beat} ,{6,Alto,One_FOUR_Beat} ,
{7,Alto,One_TWO_Beat} ,
//第十七小节
{7,Alto,One_FOUR_Beat} ,{6,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat} ,{3,Alto,One_TWO_Beat} ,
{3,Alto,One_TWO_Beat} ,{0,Alto,One_FOUR_Beat},{3,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,
{3,Alto,One_FOUR_Beat} ,
//第十八小节
{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat},{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat} ,
{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat},{5,Alto,One_FOUR_Beat} ,{3,Alto,One_FOUR_Beat} ,
{5,Alto,One_FOUR_Beat} ,{3,Alto,One_FOUR_Beat},
//第十九小节
{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat},{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat} ,
{2,Alto,One_Beat} ,{0,Alto,One_TWO_Beat} ,{1,Alto,One_FOUR_Beat} ,{2,Alto,One_FOUR_Beat} ,
//第二十小节
{3,Alto,One_TWO_Beat} ,{6,Bass,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{3,Alto,One_TWO_Beat} ,
{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat},{2,Alto,One_FOUR_Beat} ,{1,Alto,One_FOUR_Beat} ,
{1,Alto,One_TWO_Beat} ,
//第二十一小节
{6,Bass,One_Beat} ,{6,Bass,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_TWO_Beat} ,
{6,Alto,One_FOUR_Beat} ,{7,Alto,One_FOUR_Beat},
//第二十二小节
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,
{1,Teble,One_FOUR_Beat},{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
//第二十三小节
{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{5,Teble,One_TWO_Beat} ,{3,Teble,One_TWO_Beat} ,{6,Alto,One_FOUR_Beat} ,
{7,Alto,One_FOUR_Beat} ,
//第二十四小节
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,
{1,Teble,One_FOUR_Beat},{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
//第二十五小节
{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{5,Teble,One_TWO_Beat} ,{3,Teble,One_TWO_Beat} ,{5,Teble,One_TWO_Beat} ,
//第二十六小节
{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{5,Teble,One_FOUR_Beat},{6,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{5,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{5,Teble,One_TWO_Beat} ,
//第二十七小节
{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{5,Teble,One_FOUR_Beat},{6,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{5,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{5,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},
{5,Teble,One_TWO_Beat} ,
//第二十八小节
//{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,
//{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},
//{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},
{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
//第二十九小节
{1,Teble,One_TWO_Beat} ,{0,Alto,One_FOUR_Beat} ,{0,Alto,One_TWO_Beat} ,{0,Alto,One_TWO_Beat} ,
{5,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{5,Teble,One_FOUR_Beat},
//第三十小节
//{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,
//{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},
//{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},
{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
//第三十一小节
{1,Teble,One_TWO_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,
//
// //第三十二小节
// {0,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,
//
// //第三十三小节
// {0,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,
//第三十四小节
{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_TWO_Beat} ,
{6,Teble,One_FOUR_Beat},{5,Alto,One_FOUR_Beat} ,
//第三十五小节
{6,Alto,One_TWO_Beat} ,{5,Alto,One_FOUR_Beat} ,{6,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,
{6,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,{6,Alto,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},
{6,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,{6,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,
{6,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,
//第三十六小节
// {3,Alto,One_FOUR_Beat} ,{3,Alto,One_TWO_Beat} ,{3,Alto,One_Beat} ,{0,Alto,One_Beat} ,
// {0,Alto,One_TWO_Beat} ,{6,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,
{3,Alto,One_TWO_Beat} ,{3,Alto,One_Beat} ,{0,Alto,One_Beat} ,
{0,Alto,One_TWO_Beat} ,{6,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,
//第三十七小节
{6,Alto,One_TWO_Beat} ,{5,Alto,One_FOUR_Beat} ,{6,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,
{6,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,{7,Alto,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/} ,
{7,Alto,One_FOUR_Beat} ,{0,Alto,184 /*小衔接*/} ,{7,Alto,One_FOUR_Beat} ,{6,Alto,One_FOUR_Beat} ,
{7,Alto,One_FOUR_Beat} ,{6,Alto,One_FOUR_Beat} ,
//第三十八小节
// {3,Alto,One_FOUR_Beat} ,{3,Alto,One_TWO_Beat} ,{3,Alto,One_Beat} ,{0,Alto,One_Beat} ,
// {0,Alto,One_FOUR_Beat},{3,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,{3,Alto,One_FOUR_Beat} ,
{3,Alto,One_TWO_Beat} ,{3,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_FOUR_Beat},
{3,Alto,One_FOUR_Beat} ,{5,Alto,One_FOUR_Beat} ,{3,Alto,One_FOUR_Beat} ,
//第三十九小节
{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat},{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat} ,
{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat},{5,Alto,One_FOUR_Beat} ,{3,Alto,One_FOUR_Beat} ,
{5,Alto,One_FOUR_Beat} ,{3,Alto,One_FOUR_Beat},
//第四十小节
{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat},{2,Alto,One_TWO_Beat} ,{3,Alto,One_FOUR_Beat} ,
{2,Alto,One_Beat} ,{0,Alto,One_TWO_Beat} ,{1,Alto,One_FOUR_Beat} ,{2,Alto,One_FOUR_Beat} ,
//第四十一小节
{3,Alto,One_TWO_Beat} ,{6,Alto,One_TWO_Beat} ,{1,Teble,One_TWO_Beat} ,{3,Teble,One_TWO_Beat} ,
{2,Teble,One_TWO_Beat} ,{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat} ,
{1,Teble,One_TWO_Beat} ,
//第四十二小节
{6,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_TWO_Beat} ,
{6,Alto,One_FOUR_Beat} ,{7,Alto,One_FOUR_Beat},
//开始第一遍循环
//第二十二小节
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,
{1,Teble,One_FOUR_Beat},{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
//第二十三小节
{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{5,Teble,One_TWO_Beat} ,{3,Teble,One_TWO_Beat} ,{6,Alto,One_FOUR_Beat} ,
{7,Alto,One_FOUR_Beat} ,
//第二十四小节
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,
{1,Teble,One_FOUR_Beat},{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
//第二十五小节
{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{5,Teble,One_TWO_Beat} ,{3,Teble,One_TWO_Beat} ,{5,Teble,One_TWO_Beat} ,
//第二十六小节
{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{5,Teble,One_FOUR_Beat},{6,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{5,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{5,Teble,One_TWO_Beat} ,
//第二十七小节
{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{5,Teble,One_FOUR_Beat},{6,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{5,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{5,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},
{5,Teble,One_TWO_Beat} ,
//第二十八小节
//{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,
//{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},
//{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},
{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
//第二十九小节
{1,Teble,One_TWO_Beat} ,{0,Alto,One_FOUR_Beat} ,{0,Alto,One_TWO_Beat} ,{0,Alto,One_TWO_Beat} ,
{5,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{5,Teble,One_FOUR_Beat},
//第三十小节
//{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,
//{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},
//{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},
{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
//第一遍循环结束
//第四十三小节
{6,Alto,One_TWO_Beat} ,{6,Alto,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{3,Alto,One_TWO_Beat} ,
{7,Alto,One_Beat},{0,Alto,184 /*小衔接*/},{7,Alto,One_TWO_Beat},{0,Alto,184 /*小衔接*/},
{7,Alto,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{7,Alto,One_FOUR_Beat},
//第四十四小节
//{6,Alto,One_FOUR_Beat} ,{6,Alto,One_TWO_Beat} ,{6,Alto,One_Beat} ,{0,Alto,One_Beat} ,
//{0,Alto,One_Beat},{0,Alto,One_Beat},
{6,Alto,One_TWO_Beat} ,{6,Alto,One_TWO_Beat} ,{6,Alto,One_TWO_Beat} ,{0,Alto,One_Beat} ,
{0,Alto,One_Beat},{0,Alto,One_Beat},
//第四十五小节
{6,Alto,One_TWO_Beat} ,{6,Alto,One_TWO_Beat} ,{1,Alto,One_TWO_Beat} ,{3,Alto,One_TWO_Beat} ,
{7,Alto,One_Beat},{0,Alto,184 /*小衔接*/},{7,Alto,One_TWO_Beat},{0,Alto,184 /*小衔接*/},
{7,Alto,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{7,Alto,One_FOUR_Beat},
//第四十六小节
{7,Alto,One_FOUR_Beat},{6,Alto,One_TWO_Beat},{6,Alto,One_Beat} ,{0,Alto,One_Beat},
{0,Alto,One_TWO_Beat},{6,Alto,One_FOUR_Beat} ,{7,Alto,One_FOUR_Beat},
//第二次循环
//第二十二小节
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,
{1,Teble,One_FOUR_Beat},{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
//第二十三小节
{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{5,Teble,One_TWO_Beat} ,{3,Teble,One_TWO_Beat} ,{6,Alto,One_FOUR_Beat} ,
{7,Alto,One_FOUR_Beat} ,
//第二十四小节
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{7,Alto,One_FOUR_Beat} ,{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{7,Alto,One_FOUR_Beat} ,
{1,Teble,One_FOUR_Beat},{0,Alto,306 /*小衔接*/},{1,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},
{1,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
//第二十五小节
{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{0,Alto,306 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},
{3,Teble,One_TWO_Beat} ,{5,Teble,One_TWO_Beat} ,{3,Teble,One_TWO_Beat} ,{5,Teble,One_TWO_Beat} ,
//第二十六小节
{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{5,Teble,One_FOUR_Beat},{6,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{5,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{5,Teble,One_TWO_Beat} ,
//第二十七小节
{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},{3,Teble,One_TWO_Beat} ,{5,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{5,Teble,One_FOUR_Beat},{6,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{5,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{5,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},
{5,Teble,One_TWO_Beat} ,
//第二十八小节
//{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,
//{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},
//{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},
{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
//第二十九小节
{1,Teble,One_TWO_Beat} ,{0,Alto,One_FOUR_Beat} ,{0,Alto,One_TWO_Beat} ,{0,Alto,One_TWO_Beat} ,
{5,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{5,Teble,One_FOUR_Beat},
//第三十小节
//{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,
//{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{3,Teble,One_FOUR_Beat},{2,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},
//{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},
{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},{3,Teble,One_FOUR_Beat},
{2,Teble,One_TWO_Beat} ,{0,Alto,184 /*小衔接*/},{2,Teble,One_TWO_Beat} ,{1,Teble,One_FOUR_Beat},
{0,Alto,184 /*小衔接*/},{1,Teble,One_FOUR_Beat},
//第二次循环结束
//第四十七小节
{1,Teble,One_TWO_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,{0,Alto,One_Beat} ,
{0,Alto,One_Beat} ,
};
/* USER CODE END PT */
/* Function definition -------------------------------------------------------*/
/* USER CODE BEGIN FD */
/**
* @Function name MUSIC_Begin
* @Introduce 开始播放音乐
* @Return NULL
*/
void MUSIC_Analysis(void){
//切换数组即可更改音乐
uint16_t MusicBeatNum = ((((sizeof(Music_Lone_Brave))/2)/3)-1);
uint16_t MusicSpeed = Music_Lone_Brave[0][2];
for(uint16_t i = 1;i<=MusicBeatNum;i++){
//BSP_Buzzer_SetFrequency(Tone_Index[Music_Lone_Brave[i][0]][Music_Lone_Brave[i][1]]);
PassiveBuzzer_Set_Freq_Duty(Tone_Index[Music_Lone_Brave[i][0]][Music_Lone_Brave[i][1]],50);
//HAL_Delay(MusicSpeed/Music_Lone_Brave[i][2]);
mdelay(20);
}
}
/* USER CODE END FD */
/************************ (C) COPYRIGHT 「千樊」 *****END OF FILE****/
void PlayMusic(void *params)
{
PassiveBuzzer_Init();
while(1)
{
MUSIC_Analysis();
}
}
标签:Alto,衔接,Teble,freeRTOS,Beat,TWO,FOUR,STM32F103C8T6,声光
From: https://blog.csdn.net/weixin_74859061/article/details/141036441