[go: up one dir, main page]

CN104427113A - Method and device for realizing function of metronome on mobile terminal - Google Patents

Method and device for realizing function of metronome on mobile terminal Download PDF

Info

Publication number
CN104427113A
CN104427113A CN201310395456.8A CN201310395456A CN104427113A CN 104427113 A CN104427113 A CN 104427113A CN 201310395456 A CN201310395456 A CN 201310395456A CN 104427113 A CN104427113 A CN 104427113A
Authority
CN
China
Prior art keywords
beat
animation
threads
cycles
user
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201310395456.8A
Other languages
Chinese (zh)
Inventor
荣浩
李文博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University Founder Group Co Ltd
Beijing Founder Electronics Co Ltd
Original Assignee
Peking University Founder Group Co Ltd
Beijing Founder Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peking University Founder Group Co Ltd, Beijing Founder Electronics Co Ltd filed Critical Peking University Founder Group Co Ltd
Priority to CN201310395456.8A priority Critical patent/CN104427113A/en
Publication of CN104427113A publication Critical patent/CN104427113A/en
Pending legal-status Critical Current

Links

Landscapes

  • Telephone Function (AREA)

Abstract

本发明提供一种在移动终端上实现节拍器功能的方法和装置。该方法包括:通过主线程接收用户的参数设置指令,参数设置指令中携带节拍、拍频和循环次数,循环次数与节拍中的小节数相等;通过主线程接收用户的启动指令,并根据节拍读取对应的音频文件,根据节拍、拍频和循环次数依次控制至少两个声音子线程播放音频文件,声音子线程的数量根据节拍中每小节的拍子数确定。本发明提供的在移动终端上实现节拍器功能的方法和装置,可以在移动终端上实现节拍器功能,携带方便。

The invention provides a method and device for realizing the metronome function on a mobile terminal. The method includes: receiving a user's parameter setting instruction through the main thread, the parameter setting instruction carrying beat, beat frequency and cycle number, and the cycle number is equal to the number of bars in the beat; receiving the user's start instruction through the main thread, and reading according to the beat Get the corresponding audio file, and control at least two sound sub-threads to play the audio file sequentially according to beat, beat frequency and cycle times, and the number of sound sub-threads is determined according to the number of beats in each bar in the beat. The method and device for realizing the metronome function on the mobile terminal provided by the present invention can realize the metronome function on the mobile terminal, and is convenient to carry.

Description

在移动终端上实现节拍器功能的方法和装置Method and device for realizing metronome function on mobile terminal

技术领域technical field

本发明涉及移动终端技术领域,尤其涉及一种在移动终端上实现节拍器功能的方法和装置。The present invention relates to the technical field of mobile terminals, in particular to a method and device for realizing a metronome function on a mobile terminal.

背景技术Background technique

节拍器是一种能在各种速度中发出一种稳定节拍的机械、电动或电子装置,用来培养速度概念,使演奏更完整平稳,节奏更均匀。节拍器包括两个重要参数:节拍和拍频。节拍通常用分数形式的拍号来表示,分子用于表示每小节的拍子数,分母用于表示拍子的时值,例如:2/4拍用于表示4分音符为一个拍子,每小节2个拍子,即每小节有2个4分音符。拍频用于表示每分钟的拍子数,例如:60拍/分用于表示每分钟60个拍子。A metronome is a mechanical, electric or electronic device that can emit a stable beat at various speeds. It is used to cultivate the concept of speed, make the performance more complete and stable, and the rhythm more uniform. A metronome includes two important parameters: tempo and beat frequency. The beat is usually represented by a fractional time signature, the numerator is used to represent the number of beats per measure, and the denominator is used to represent the time value of the beat, for example: 2/4 time is used to represent a quarter note as a beat, 2 per measure The beat, that is, there are 2 quarter notes per measure. Beat frequency is used to represent the number of beats per minute, for example: 60 beats per minute is used to represent 60 beats per minute.

现有的节拍器主要包括机械节拍器和电子节拍器,但由于现有的节拍器均为实体装置,无法应用在移动终端中,因此携带不方便。Existing metronomes mainly include mechanical metronomes and electronic metronomes, but because the existing metronomes are all physical devices, they cannot be applied to mobile terminals, so they are inconvenient to carry.

发明内容Contents of the invention

本发明提供一种在移动终端上实现节拍器功能的方法和装置,用以解决现有的节拍器无法应用在移动终端中,携带不方便的问题。The present invention provides a method and device for realizing the function of a metronome on a mobile terminal to solve the problem that the existing metronome cannot be applied to the mobile terminal and is inconvenient to carry.

一方面,本发明提供一种在移动终端上实现节拍器功能的方法,包括:In one aspect, the present invention provides a method for implementing a metronome function on a mobile terminal, including:

通过主线程接收用户的参数设置指令,所述参数设置指令中携带节拍、拍频和循环次数,所述循环次数与所述节拍中包括的小节数相等;Receive the user's parameter setting instruction through the main thread, the parameter setting instruction carries the beat, the beat frequency and the number of cycles, and the number of cycles is equal to the number of bars included in the beat;

通过主线程接收用户的启动指令,并根据所述节拍读取对应的音频文件,根据所述节拍、所述拍频和所述循环次数依次控制至少两个声音子线程播放所述音频文件,所述声音子线程的数量根据所述节拍中每小节的拍子数确定。Receive the user's startup instruction through the main thread, and read the corresponding audio file according to the beat, and sequentially control at least two sound sub-threads to play the audio file according to the beat, the beat frequency and the number of cycles, so that The number of sound sub-threads is determined according to the number of beats per bar in the beat.

另一方面,本发明提供一种在移动终端上实现节拍器功能的装置,包括:On the other hand, the present invention provides a device for implementing a metronome function on a mobile terminal, including:

第一接收模块,用于通过主线程接收用户的参数设置指令,所述参数设置指令中携带节拍、拍频和循环次数,所述循环次数与所述节拍中包括的小节数相等;The first receiving module is used to receive the user's parameter setting instruction through the main thread, the parameter setting instruction carries beat, beat frequency and number of cycles, and the number of cycles is equal to the number of bars included in the beat;

第二接收模块,用于通过主线程接收用户的启动指令,并根据所述节拍读取对应的音频文件,根据所述节拍、所述拍频和所述循环次数依次控制至少两个声音子线程播放所述音频文件,所述声音子线程的数量根据所述节拍中每小节的拍子数确定。The second receiving module is used to receive the user's startup instruction through the main thread, and read the corresponding audio file according to the beat, and sequentially control at least two sound sub-threads according to the beat, the beat frequency and the number of cycles The audio file is played, and the number of the sound sub-threads is determined according to the beat number of each bar in the beat.

本发明提供的在移动终端上实现节拍器功能的方法和装置,可以在移动终端上实现节拍器功能,携带方便。The method and device for realizing the metronome function on the mobile terminal provided by the present invention can realize the metronome function on the mobile terminal, and is convenient to carry.

附图说明Description of drawings

图1为本发明提供的在移动终端上实现节拍器功能的方法一个实施例的流程示意图;FIG. 1 is a schematic flowchart of an embodiment of a method for realizing a metronome function on a mobile terminal provided by the present invention;

图2为本发明提供的在移动终端上实现节拍器功能的方法又一个实施例的流程示意图;FIG. 2 is a schematic flowchart of another embodiment of a method for realizing a metronome function on a mobile terminal provided by the present invention;

图3为本发明提供的在移动终端上实现节拍器功能的方法又一个实施例的流程示意图;FIG. 3 is a schematic flowchart of another embodiment of a method for implementing a metronome function on a mobile terminal provided by the present invention;

图4为本发明提供的在移动终端上实现节拍器功能的装置一个实施例的结构示意图。FIG. 4 is a schematic structural diagram of an embodiment of a device for implementing a metronome function on a mobile terminal provided by the present invention.

具体实施方式Detailed ways

下面通过具体的实施例及附图,对本发明的技术方案做进一步的详细描述。The technical solution of the present invention will be described in further detail below through specific embodiments and accompanying drawings.

图1为本发明提供的在移动终端上实现节拍器功能的方法一个实施例的流程示意图。如图1所示,以下方法实施例中各步骤的执行主体具体可以为现有的各种移动终端设备,例如:手机、个人电脑,PAD等。该方法具体可以包括:FIG. 1 is a schematic flowchart of an embodiment of a method for implementing a metronome function on a mobile terminal provided by the present invention. As shown in FIG. 1 , the execution subject of each step in the following method embodiments may specifically be various existing mobile terminal devices, such as mobile phones, personal computers, PADs, and the like. The method may specifically include:

S101,通过主线程接收用户的参数设置指令,参数设置指令中携带节拍、拍频和循环次数,循环次数与节拍中包括的小节数相等。S101, receiving a user's parameter setting instruction through the main thread, the parameter setting instruction carries beat, beat frequency and cycle number, and the cycle number is equal to the number of bars included in the beat.

具体的,本实施例通过主线程控制各个声音子线程播放音频文件。在实际应用中,用户可以通过移动终端的按键、触摸屏等设置节拍、拍频和循环次数等参数并生成参数设置指令,还可以预先设置与每种节拍对应的音频文件。节拍可以设置为1/4拍、2/4拍等,拍频可以设置为60拍/分、120拍/分等,若节拍中包括n个小节,则循环次数可以设置为n次。Specifically, in this embodiment, the main thread controls each sound sub-thread to play audio files. In practical applications, users can set parameters such as beat, beat frequency, and cycle times through the buttons and touch screen of the mobile terminal, and generate parameter setting instructions, and can also preset audio files corresponding to each beat. The beat can be set to 1/4 beat, 2/4 beat, etc., the beat frequency can be set to 60 beats/min, 120 beats/min, etc. If the beat includes n bars, the number of cycles can be set to n times.

S102,通过主线程接收用户的启动指令,并根据节拍读取对应的音频文件,根据节拍、拍频和循环次数依次控制至少两个声音子线程播放音频文件,声音子线程的数量根据节拍中每小节的拍子数确定。S102, receive the user's startup instruction through the main thread, and read the corresponding audio file according to the beat, and sequentially control at least two sound sub-threads to play the audio file according to the beat, beat frequency and cycle times, and the number of sound sub-threads is based on each beat in the beat. The number of beats for a measure is determined.

其中,当节拍中每小节的拍子数等于1时,声音子线程的数量为两个;当节拍中每小节的拍子数大于1时,声音子线程的数量与节拍中每小节的拍子数相同。Wherein, when the beat number of each bar in the beat is equal to 1, the number of sound sub-threads is two; when the beat number of each bar in the beat is greater than 1, the number of sound sub-threads is the same as the beat number of each bar in the beat.

具体的,为避免各个拍子之间播放音频文件的互相影响,可以通过切换不同的声音子线程实现拍子之间播放音频文件的切换。Specifically, in order to avoid the mutual influence of playing audio files between beats, the switching of playing audio files between beats can be realized by switching different sound sub-threads.

下面以节拍为1/4拍,拍频为60拍/分,循环次数为n次(即小节数为n)为例,对本步骤的具体过程进行说明:The following takes the beat as 1/4 beat, the beat frequency as 60 beats per minute, and the number of cycles as n times (that is, the number of measures is n) as an example to illustrate the specific process of this step:

读取与1/4拍对应的音频文件,1/4拍中每小节包括1个拍子,因此只需两个声音子线程(第一声音子线程和第二声音子线程)即可。在第一小节中,可以控制第一声音子线程在距离初始时间1秒时播放读取的音频文件,之后进入第二小节,可以控制第二声音子线程在距离初始时间2秒时播放读取的音频文件,之后进入第三小节,可以控制第一声音子线程在距离初始时间3秒时播放读取的音频文件,如此循环下去,直至完成第n小节音频文件的播放。Read the audio file corresponding to 1/4 beat, and each measure in 1/4 beat includes 1 beat, so only two sound sub-threads (the first sound sub-thread and the second sound sub-thread) are required. In the first section, you can control the first sound sub-thread to play the read audio file when it is 1 second away from the initial time, and then enter the second section, you can control the second sound sub-thread to play the read audio file when it is 2 seconds away from the initial time After entering the third section, the first sound sub-thread can be controlled to play the read audio file at 3 seconds from the initial time, and this loop continues until the playback of the nth section audio file is completed.

下面以节拍为2/4拍,拍频为60拍/分,循环次数为n次(即小节数为n)为例,对本步骤的具体过程进行说明:The following takes the beat as 2/4, the beat frequency as 60 beats/min, and the number of cycles as n times (that is, the number of measures is n) as an example to illustrate the specific process of this step:

读取与2/4拍对应的音频文件,2/4拍中每小节包括2个拍子,因此只需两个声音子线程(第三声音子线程和第四声音子线程)即可。在第一小节中,可以控制第三声音子线程在距离初始时间1秒时播放读取的音频文件,控制第四声音子线程在距离初始时间2秒时播放读取的音频文件,之后进入第二小节,可以控制第三声音子线程在距离初始时间3秒时播放读取的音频文件,控制第四声音子线程在距离初始时间4秒时播放读取的音频文件,之后进入第三小节,如此循环下去,直至完成第n小节音频文件的播放。Read the audio file corresponding to the 2/4 beat, and each measure in the 2/4 beat includes 2 beats, so only two sound sub-threads (the third sound sub-thread and the fourth sound sub-thread) are required. In the first section, you can control the third sound sub-thread to play the read audio file at 1 second from the initial time, control the fourth sound sub-thread to play the read audio file at 2 seconds from the initial time, and then enter the first In the second section, you can control the third sound sub-thread to play the read audio file when it is 3 seconds away from the initial time, and control the fourth sound sub-thread to play the read audio file when it is 4 seconds away from the initial time, and then enter the third section. The loop goes on like this until the playback of the nth bar audio file is completed.

本实施例提供的在移动终端上实现节拍器功能的方法,可以在移动终端上实现节拍器功能,携带方便。The method for realizing the metronome function on the mobile terminal provided in this embodiment can realize the metronome function on the mobile terminal and is easy to carry.

图2为本发明提供的在移动终端上实现节拍器功能的方法又一个实施例的流程示意图。如图2所示,以下方法实施例中各步骤的执行主体具体可以为现有的各种移动终端设备,例如:手机、个人电脑,PAD等。该方法具体可以包括:Fig. 2 is a schematic flowchart of another embodiment of the method for realizing the metronome function on the mobile terminal provided by the present invention. As shown in FIG. 2 , the execution subject of each step in the following method embodiments may specifically be various existing mobile terminal devices, such as mobile phones, personal computers, PADs, and the like. The method may specifically include:

S201,通过主线程接收用户的参数设置指令,参数设置指令中携带节拍、拍频和循环次数,循环次数与节拍中包括的小节数相等。S201. Receive a user's parameter setting instruction through the main thread. The parameter setting instruction carries a beat, a beat frequency, and a number of cycles, and the number of cycles is equal to the number of bars included in the beat.

具体的,本步骤可以参见图1所示实施例步骤S101中的相关描述,此处不再赘述。Specifically, for this step, reference may be made to the relevant description in step S101 of the embodiment shown in FIG. 1 , and details are not repeated here.

S202,通过主线程接收用户的启动指令。S202. Receive a user's startup instruction through the main thread.

具体的,接收用户的启动指令之后,可以同时控制声音子线程播放声音和控制动画子线程播放动画,即可以同时执行以下步骤S203和S204,实现动画和声音的同步。Specifically, after receiving the start instruction from the user, the sound sub-thread can be controlled to play the sound and the animation sub-thread can be controlled to play the animation at the same time, that is, the following steps S203 and S204 can be executed simultaneously to realize the synchronization of the animation and the sound.

其中,动画效果可以通过播放动画视频文件或执行动画代码文件实现。本实施例中以播放动画视频文件为例进行说明。Wherein, the animation effect can be realized by playing an animation video file or executing an animation code file. In this embodiment, playing an animation video file is taken as an example for illustration.

S203,根据节拍读取对应的音频文件,根据节拍、拍频和循环次数依次控制至少两个声音子线程播放音频文件,声音子线程的数量根据节拍中每小节的拍子数确定。S203, read the corresponding audio file according to the beat, and sequentially control at least two sound sub-threads to play the audio file according to the beat, beat frequency and cycle times, and the number of sound sub-threads is determined according to the number of beats per section in the beat.

其中,当节拍中每小节的拍子数等于1时,声音子线程的数量为两个;当节拍中每小节的拍子数大于1时,声音子线程的数量与节拍中每小节的拍子数相同。Wherein, when the beat number of each bar in the beat is equal to 1, the number of sound sub-threads is two; when the beat number of each bar in the beat is greater than 1, the number of sound sub-threads is the same as the beat number of each bar in the beat.

具体的,本步骤可以参见图1所示实施例步骤S102中的相关描述,此处不再赘述。Specifically, for this step, reference may be made to the relevant description in step S102 of the embodiment shown in FIG. 1 , and details are not repeated here.

S204,读取动画视频文件,根据节拍、拍频和循环次数控制动画子线程依次播放动画视频文件。S204, read the animation video file, and control the animation sub-thread to play the animation video file sequentially according to the tempo, the beat frequency and the number of cycles.

具体的,为使移动终端中实现节拍器功能时的用户界面更加美观,可以在界面上显示具有周期性的动画,例如上下循环往复的动画或像单摆一样左中右循环往复的动画。对应的,用户可以预先设置2个或4个动画视频文件,例如:在上下循环往复的动画中,向上和向下过程分别对应一个动画视频文件(第一动画视频文件和第二动画视频文件);在像单摆一样左中右循环往复的动画中,从中间向左的过程、从左向中间的过程、从中间向右的过程和从右向左的过程分别对应一个动画视频文件(第三动画视频文件、第四动画视频文件、第五动画视频文件和第六动画视频文件)。对于不同拍频,只需调整动画视频文件的播放速度即可。Specifically, in order to make the user interface more beautiful when the metronome function is implemented in the mobile terminal, periodic animations can be displayed on the interface, such as animations that cycle up and down, or animations that cycle left, middle, and right like a pendulum. Correspondingly, the user can pre-set 2 or 4 animation video files, for example: in the up-and-down animation, the upward and downward processes correspond to an animation video file (the first animation video file and the second animation video file) ; In an animation that reciprocates left, middle and right like a simple pendulum, the process from the middle to the left, the process from the left to the middle, the process from the middle to the right and the process from the right to the left correspond to an animation video file respectively (p. three animation video files, fourth animation video files, fifth animation video files, and sixth animation video files). For different beat frequencies, just adjust the playback speed of the animation video file.

下面以节拍为1/4拍,拍频为60拍/分,循环次数为n次(即小节数为n),像单摆一样左中右循环往复的动画为例,对本步骤的具体过程进行说明:The following is an example of an animation with a beat of 1/4, a beat frequency of 60 beats/min, and a number of cycles of n times (that is, the number of bars is n). illustrate:

读取与1/4拍对应的动画视频文件,1/4拍中每小节包括1个拍子。在第一小节中,可以控制动画子线程在初始时间到距离初始时间0.5秒的时间范围内,播放第三动画视频文件,在距离初始时间0.5秒到1秒的时间范围内,播放第四动画视频文件,之后进入第二小节,可以控制动画子线程在距离初始时间1秒到1.5秒的时间范围内,播放第五动画视频文件,在距离初始时间1.5秒到2秒的时间范围内,播放第六动画视频文件,之后进入第三小节,可以控制动画子线程在距离初始时间2秒到2.5秒的时间范围内,播放第三动画视频文件,在距离初始时间2.5秒到3秒的时间范围内,播放第四动画视频文件,如此循环下去,直至完成第n小节动画视频文件的播放。Read the animation video file corresponding to 1/4 beat, and each measure in 1/4 beat includes 1 beat. In the first section, you can control the animation sub-thread to play the third animation video file within the time range from the initial time to 0.5 seconds from the initial time, and play the fourth animation within the time range from 0.5 seconds to 1 second from the initial time Video file, then enter the second section, you can control the animation sub-thread to play the fifth animation video file within the time range of 1 second to 1.5 seconds from the initial time, and play the fifth animation video file within the time range of 1.5 seconds to 2 seconds from the initial time The sixth animation video file, and then enter the third section, which can control the animation sub-thread to play the third animation video file within the time range of 2 seconds to 2.5 seconds from the initial time, within the time range of 2.5 seconds to 3 seconds from the initial time Inside, play the fourth animation video file, and so on, until finishing the playback of the nth section animation video file.

下面以节拍为2/4拍,拍频为60拍/分,循环次数为n次(即小节数为n),像单摆一样左中右循环往复的动画为例,对本步骤的具体过程进行说明:The following is an example of an animation with a beat of 2/4, a beat frequency of 60 beats/min, and a number of cycles of n times (that is, the number of bars is n), reciprocating left, middle and right like a single pendulum, to describe the specific process of this step. illustrate:

读取与2/4拍对应的动画视频文件,2/4拍中每小节包括2个拍子。在第一小节中,可以控制动画子线程在初始时间到距离初始时间0.5秒的时间范围内,播放第三动画视频文件,在距离初始时间0.5秒到1秒的时间范围内,播放第四动画视频文件,在距离初始时间1秒到1.5秒的时间范围内,播放第五动画视频文件,在距离初始时间1.5秒到2秒的时间范围内,播放第六动画视频文件,之后进入第二小节,可以控制动画子线程在距离初始时间2秒到2.5秒的时间范围内,播放第三动画视频文件,在距离初始时间2.5秒到3秒的时间范围内,播放第四动画视频文件,在距离初始时间3秒到3.5秒的时间范围内,播放第五动画视频文件,在距离初始时间3.5秒到4秒的时间范围内,播放第六动画视频文件,之后进入第三小节,如此循环下去,直至完成第n小节动画视频文件的播放。Read the animation video file corresponding to 2/4 beat, and each measure in 2/4 beat includes 2 beats. In the first section, you can control the animation sub-thread to play the third animation video file within the time range from the initial time to 0.5 seconds from the initial time, and play the fourth animation within the time range from 0.5 seconds to 1 second from the initial time For video files, play the fifth animation video file within the time range of 1 second to 1.5 seconds from the initial time, play the sixth animation video file within the time range of 1.5 seconds to 2 seconds from the initial time, and then enter the second section , the animation sub-thread can be controlled to play the third animation video file within the time range of 2 seconds to 2.5 seconds from the initial time, and to play the fourth animation video file within the time range of 2.5 seconds to 3 seconds from the initial time. Within the time range of 3 seconds to 3.5 seconds from the initial time, play the fifth animation video file, and within the time range of 3.5 seconds to 4 seconds from the initial time, play the sixth animation video file, and then enter the third section, and so on. Until the playback of the nth section animation video file is completed.

本实施例提供的在移动终端上实现节拍器功能的方法,可以在移动终端上实现节拍器功能,携带方便。The method for realizing the metronome function on the mobile terminal provided in this embodiment can realize the metronome function on the mobile terminal and is easy to carry.

图3为本发明提供的在移动终端上实现节拍器功能的方法又一个实施例的流程示意图。如图3所示,以下方法实施例中各步骤的执行主体具体可以为现有的各种移动终端设备,例如:手机、个人电脑,PAD等。该方法具体可以包括:Fig. 3 is a schematic flowchart of another embodiment of the method for realizing the metronome function on the mobile terminal provided by the present invention. As shown in FIG. 3 , the execution subject of each step in the following method embodiments may specifically be various existing mobile terminal devices, such as mobile phones, personal computers, PADs, and the like. The method may specifically include:

S301,通过主线程接收用户的参数设置指令,参数设置指令中携带节拍、拍频和循环次数,循环次数与节拍中包括的小节数相等。S301. Receive a user's parameter setting instruction through the main thread. The parameter setting instruction carries beat, beat frequency and cycle number, and the cycle number is equal to the number of bars included in the beat.

具体的,本步骤可以参见图1所示实施例步骤S101中的相关描述,此处不再赘述。Specifically, for this step, reference may be made to the relevant description in step S101 of the embodiment shown in FIG. 1 , and details are not repeated here.

S302,通过主线程接收用户的启动指令。S302. Receive a user's startup instruction through the main thread.

具体的,接收用户的启动指令之后,可以同时控制声音子线程播放声音和控制动画子线程播放动画,即可以同时执行以下步骤S303和S304,实现动画和声音的同步。Specifically, after receiving the start instruction from the user, the sound sub-thread can be controlled to play the sound and the animation sub-thread can be controlled to play the animation at the same time, that is, the following steps S303 and S304 can be executed simultaneously to realize the synchronization of the animation and the sound.

其中,动画效果可以通过播放动画视频文件或执行动画代码文件实现。本实施例中以执行动画代码文件为例进行说明。Wherein, the animation effect can be realized by playing an animation video file or executing an animation code file. In this embodiment, execution of an animation code file is taken as an example for illustration.

S303,根据节拍读取对应的音频文件,根据节拍、拍频和循环次数依次控制至少两个声音子线程播放音频文件,声音子线程的数量根据节拍中每小节的拍子数确定。S303, read the corresponding audio file according to the beat, and sequentially control at least two sound sub-threads to play the audio file according to the beat, beat frequency and cycle times, and the number of sound sub-threads is determined according to the number of beats in each measure in the beat.

其中,当节拍中每小节的拍子数等于1时,声音子线程的数量为两个;当节拍中每小节的拍子数大于1时,声音子线程的数量与节拍中每小节的拍子数相同。Wherein, when the beat number of each bar in the beat is equal to 1, the number of sound sub-threads is two; when the beat number of each bar in the beat is greater than 1, the number of sound sub-threads is the same as the beat number of each bar in the beat.

具体的,本步骤可以参见图1所示实施例步骤S102中的相关描述,此处不再赘述。Specifically, for this step, reference may be made to the relevant description in step S102 of the embodiment shown in FIG. 1 , and details are not repeated here.

S304,读取动画代码文件,根据节拍和拍频对动画代码文件进行编辑;根据循环次数依次执行编辑后的动画代码文件。S304, read the animation code file, edit the animation code file according to the tempo and beat frequency; execute the edited animation code file in sequence according to the number of cycles.

具体的,为使移动终端中实现节拍器功能时的用户界面更加美观,可以在界面上显示具有周期性的动画,例如上下循环往复的动画或像单摆一样左中右循环往复的动画。对应的,用户可以预先设置2个或4个动画代码文件,例如:在上下循环往复的动画中,向上和向下过程分别对应一个动画代码文件(第一动画代码文件和第二动画代码文件);在像单摆一样左中右循环往复的动画中,从中间向左的过程、从左向中间的过程、从中间向右的过程和从右向左的过程分别对应一个动画代码文件(第三动画代码文件、第四动画代码文件、第五动画代码文件和第六动画代码文件)。对于不同节拍和拍频,只需对动画代码文件中的相关参数进行设置即可。Specifically, in order to make the user interface more beautiful when the metronome function is implemented in the mobile terminal, periodic animations can be displayed on the interface, such as animations that cycle up and down, or animations that cycle left, middle, and right like a pendulum. Correspondingly, the user can pre-set 2 or 4 animation code files, for example: in the up and down animation, the upward and downward processes correspond to an animation code file (the first animation code file and the second animation code file) ;In an animation that reciprocates left, middle and right like a pendulum, the process from the middle to the left, the process from the left to the middle, the process from the center to the right and the process from the right to the left correspond to an animation code file (p. Three Animation Code Files, Fourth Animation Code Files, Fifth Animation Code Files, and Sixth Animation Code Files). For different beats and beat frequencies, you only need to set the relevant parameters in the animation code file.

下面以节拍为1/4拍,拍频为60拍/分,循环次数为n次(即小节数为n),像单摆一样左中右循环往复的动画为例,对本步骤的具体过程进行说明:The following is an example of an animation with a beat of 1/4, a beat frequency of 60 beats/min, and a number of cycles of n times (that is, the number of bars is n). illustrate:

读取与1/4拍对应的动画代码文件,1/4拍中每小节包括1个拍子。根据节拍和拍频,对动画代码文件中的相关参数进行设置。在第一小节中,可以控制动画子线程在初始时间到距离初始时间0.5秒的时间范围内,执行第三动画代码文件,在距离初始时间0.5秒到1秒的时间范围内,执行第四动画代码文件,之后进入第二小节,可以控制动画子线程在距离初始时间1秒到1.5秒的时间范围内,执行第五动画代码文件,在距离初始时间1.5秒到2秒的时间范围内,执行第六动画代码文件,之后进入第三小节,可以控制动画子线程在距离初始时间2秒到2.5秒的时间范围内,执行第三动画代码文件,在距离初始时间2.5秒到3秒的时间范围内,执行第四动画代码文件,如此循环下去,直至完成第n小节动画代码文件的执行。Read the animation code file corresponding to 1/4 beat, and each measure in 1/4 beat includes 1 beat. According to the beat and beat frequency, set the relevant parameters in the animation code file. In the first section, you can control the animation sub-thread to execute the third animation code file within the time range from the initial time to 0.5 seconds from the initial time, and execute the fourth animation within the time range from 0.5 seconds to 1 second from the initial time Code file, then enter the second section, you can control the animation sub-thread to execute the fifth animation code file within the time range of 1 second to 1.5 seconds from the initial time, and execute within the time range of 1.5 seconds to 2 seconds from the initial time The sixth animation code file, and then enter the third section, which can control the animation sub-thread to execute the third animation code file within the time range of 2 seconds to 2.5 seconds from the initial time, within the time range of 2.5 seconds to 3 seconds from the initial time Inside, the fourth animation code file is executed, and the cycle continues until the execution of the nth section animation code file is completed.

下面以节拍为2/4拍,拍频为60拍/分,循环次数为n次(即小节数为n),像单摆一样左中右循环往复的动画为例,对本步骤的具体过程进行说明:The following is an example of an animation with a beat of 2/4, a beat frequency of 60 beats/min, and a number of cycles of n times (that is, the number of bars is n), reciprocating left, middle and right like a single pendulum, to describe the specific process of this step. illustrate:

读取与2/4拍对应的动画代码文件,2/4拍中每小节包括2个拍子。根据节拍和拍频,对动画代码文件中的相关参数进行设置。在第一小节中,可以控制动画子线程在初始时间到距离初始时间0.5秒的时间范围内,执行第三动画代码文件,在距离初始时间0.5秒到1秒的时间范围内,执行第四动画代码文件,在距离初始时间1秒到1.5秒的时间范围内,执行第五动画代码文件,在距离初始时间1.5秒到2秒的时间范围内,执行第六动画代码文件,之后进入第二小节,可以控制动画子线程在距离初始时间2秒到2.5秒的时间范围内,执行第三动画代码文件,在距离初始时间2.5秒到3秒的时间范围内,执行第四动画代码文件,在距离初始时间3秒到3.5秒的时间范围内,执行第五动画代码文件,在距离初始时间3.5秒到4秒的时间范围内,执行第六动画代码文件,之后进入第三小节,如此循环下去,直至完成第n小节动画代码文件的执行。Read the animation code file corresponding to the 2/4 beat, and each measure in the 2/4 beat includes 2 beats. According to the beat and beat frequency, set the relevant parameters in the animation code file. In the first section, you can control the animation sub-thread to execute the third animation code file within the time range from the initial time to 0.5 seconds from the initial time, and execute the fourth animation within the time range from 0.5 seconds to 1 second from the initial time Code file, within the time range of 1 second to 1.5 seconds from the initial time, execute the fifth animation code file, within the time range of 1.5 seconds to 2 seconds from the initial time, execute the sixth animation code file, and then enter the second section , you can control the animation sub-thread to execute the third animation code file within the time range of 2 seconds to 2.5 seconds from the initial time, and execute the fourth animation code file within the time range of 2.5 seconds to 3 seconds from the initial time. Within the time range of 3 seconds to 3.5 seconds from the initial time, execute the fifth animation code file, and within the time range of 3.5 seconds to 4 seconds from the initial time, execute the sixth animation code file, and then enter the third section, and so on. Until the execution of the animation code file of the nth section is completed.

本实施例提供的在移动终端上实现节拍器功能的方法,可以在移动终端上实现节拍器功能,携带方便。The method for realizing the metronome function on the mobile terminal provided in this embodiment can realize the metronome function on the mobile terminal and is easy to carry.

图4为本发明提供的在移动终端上实现节拍器功能的装置一个实施例的结构示意图。如图4所示,本实施例提供的装置为执行上述在移动终端上实现节拍器功能的方法的特定执行主体,具体可以设置在现有的各种移动终端设备,例如:手机、个人电脑,PAD等中。该装置具体可以包括:第一接收模块41和第二接收模块42,其中:FIG. 4 is a schematic structural diagram of an embodiment of a device for implementing a metronome function on a mobile terminal provided by the present invention. As shown in Figure 4, the device provided by this embodiment is a specific execution subject that executes the method for implementing the metronome function on the mobile terminal, and can be specifically installed in various existing mobile terminal devices, such as mobile phones, personal computers, PAD etc. The device may specifically include: a first receiving module 41 and a second receiving module 42, wherein:

第一接收模块41,用于通过主线程接收用户的参数设置指令,参数设置指令中携带节拍、拍频和循环次数,循环次数与节拍中包括的小节数相等。The first receiving module 41 is used to receive the user's parameter setting instruction through the main thread. The parameter setting instruction carries the beat, the beat frequency and the number of cycles, and the number of cycles is equal to the number of bars included in the beat.

第二接收模块42,用于通过主线程接收用户的启动指令,并根据节拍读取对应的音频文件,根据节拍、拍频和循环次数依次控制至少两个声音子线程播放音频文件,声音子线程的数量根据节拍中每小节的拍子数确定。The second receiving module 42 is used to receive the user's startup instruction through the main thread, and read the corresponding audio file according to the beat, and control at least two sound sub-threads to play the audio file in sequence according to the beat, beat frequency and number of cycles, and the sound sub-thread The number of is determined by the number of beats per bar in the beat.

其中,当节拍中每小节的拍子数等于1时,声音子线程的数量为两个;当节拍中每小节的拍子数大于1时,声音子线程的数量与节拍中每小节的拍子数相同。Wherein, when the beat number of each bar in the beat is equal to 1, the number of sound sub-threads is two; when the beat number of each bar in the beat is greater than 1, the number of sound sub-threads is the same as the beat number of each bar in the beat.

进一步的,第二接收模块42还用于:Further, the second receiving module 42 is also used for:

在通过主线程接收用户的启动指令之后,读取动画视频文件,根据节拍、拍频和循环次数控制动画子线程依次播放动画视频文件。或者,After receiving the user's startup command through the main thread, read the animation video file, and control the animation sub-thread to play the animation video file in sequence according to the beat, beat frequency and cycle times. or,

在通过主线程接收用户的启动指令之后,读取动画代码文件,根据节拍和拍频对动画代码文件进行编辑;根据循环次数依次执行编辑后的动画代码文件。After receiving the user's startup instruction through the main thread, read the animation code file, edit the animation code file according to the beat and beat frequency; execute the edited animation code file in sequence according to the number of cycles.

具体的,各个模块实现其功能的具体过程可以参见图1、图2或图3所示实施例中的相关描述,此处不再赘述。Specifically, for the specific process of each module realizing its function, refer to the related description in the embodiment shown in FIG. 1 , FIG. 2 or FIG. 3 , which will not be repeated here.

本实施例提供的在移动终端上实现节拍器功能的装置,可以在移动终端上实现节拍器功能,携带方便。The device for realizing the metronome function on the mobile terminal provided in this embodiment can realize the metronome function on the mobile terminal and is easy to carry.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.

Claims (8)

1.一种在移动终端上实现节拍器功能的方法,其特征在于,包括:1. A method for realizing a metronome function on a mobile terminal, characterized in that, comprising: 通过主线程接收用户的参数设置指令,所述参数设置指令中携带节拍、拍频和循环次数,所述循环次数与所述节拍中包括的小节数相等;Receive the user's parameter setting instruction through the main thread, the parameter setting instruction carries the beat, the beat frequency and the number of cycles, and the number of cycles is equal to the number of bars included in the beat; 通过主线程接收用户的启动指令,并根据所述节拍读取对应的音频文件,根据所述节拍、所述拍频和所述循环次数依次控制至少两个声音子线程播放所述音频文件,所述声音子线程的数量根据所述节拍中每小节的拍子数确定。Receive the user's startup instruction through the main thread, and read the corresponding audio file according to the beat, and sequentially control at least two sound sub-threads to play the audio file according to the beat, the beat frequency and the number of cycles, so that The number of sound sub-threads is determined according to the number of beats per bar in the beat. 2.根据权利要求1所述的方法,其特征在于,所述声音子线程的数量根据所述节拍中每小节的拍子数确定,包括:2. The method according to claim 1, wherein the number of the sound sub-threads is determined according to the number of beats of each bar in the beat, comprising: 当所述节拍中每小节的拍子数等于1时,所述声音子线程的数量为两个;When the number of beats per bar in the beat is equal to 1, the number of the sound sub-threads is two; 当所述节拍中每小节的拍子数大于1时,所述声音子线程的数量与所述节拍中每小节的拍子数相同。When the number of beats per measure in the beat is greater than 1, the number of the sound sub-threads is the same as the number of beats in each measure in the beat. 3.根据权利要求1或2所述的方法,其特征在于,所述主线程接收用户的启动指令之后,还包括:3. The method according to claim 1 or 2, characterized in that, after the main thread receives the user's startup instruction, it further comprises: 读取动画视频文件,根据所述节拍、所述拍频和所述循环次数控制动画子线程依次播放所述动画视频文件。Read the animation video file, and control the animation sub-thread to play the animation video file sequentially according to the tempo, the beat frequency and the number of cycles. 4.根据权利要求1或2所述的方法,其特征在于,所述主线程接收用户的启动指令之后,还包括:4. The method according to claim 1 or 2, characterized in that, after the main thread receives the user's startup instruction, it further comprises: 读取动画代码文件,根据所述节拍和所述拍频对所述动画代码文件进行编辑;Reading the animation code file, editing the animation code file according to the beat and the beat frequency; 根据所述循环次数依次执行编辑后的所述动画代码文件。The edited animation code files are sequentially executed according to the number of cycles. 5.一种在移动终端上实现节拍器功能的装置,其特征在于,包括:5. A device for realizing a metronome function on a mobile terminal, characterized in that it comprises: 第一接收模块,用于通过主线程接收用户的参数设置指令,所述参数设置指令中携带节拍、拍频和循环次数,所述循环次数与所述节拍中包括的小节数相等;The first receiving module is used to receive the user's parameter setting instruction through the main thread, the parameter setting instruction carries beat, beat frequency and number of cycles, and the number of cycles is equal to the number of bars included in the beat; 第二接收模块,用于通过主线程接收用户的启动指令,并根据所述节拍读取对应的音频文件,根据所述节拍、所述拍频和所述循环次数依次控制至少两个声音子线程播放所述音频文件,所述声音子线程的数量根据所述节拍中每小节的拍子数确定。The second receiving module is used to receive the user's startup instruction through the main thread, and read the corresponding audio file according to the beat, and sequentially control at least two sound sub-threads according to the beat, the beat frequency and the number of cycles The audio file is played, and the number of the sound sub-threads is determined according to the beat number of each bar in the beat. 6.根据权利要求5所述的装置,其特征在于,所述声音子线程的数量根据所述节拍中每小节的拍子数确定,包括:6. The device according to claim 5, wherein the number of the sound sub-threads is determined according to the number of beats of each bar in the beat, comprising: 当所述节拍中每小节的拍子数等于1时,所述声音子线程的数量为两个;When the number of beats per bar in the beat is equal to 1, the number of the sound sub-threads is two; 当所述节拍中每小节的拍子数大于1时,所述声音子线程的数量与所述节拍中每小节的拍子数相同。When the number of beats per measure in the beat is greater than 1, the number of the sound sub-threads is the same as the number of beats in each measure in the beat. 7.根据权利要求5或6所述的装置,其特征在于,所述第二接收模块还用于:7. The device according to claim 5 or 6, wherein the second receiving module is also used for: 在所述通过主线程接收用户的启动指令之后,读取动画视频文件,根据所述节拍、所述拍频和所述循环次数控制动画子线程依次播放所述动画视频文件。After receiving the user's starting instruction through the main thread, the animation video file is read, and the animation sub-thread is controlled to play the animation video file sequentially according to the tempo, the beat frequency and the number of cycles. 8.根据权利要求5或6所述的装置,其特征在于,所述第二接收模块还用于:8. The device according to claim 5 or 6, wherein the second receiving module is also used for: 在所述通过主线程接收用户的启动指令之后,读取动画代码文件,根据所述节拍和所述拍频对所述动画代码文件进行编辑;After receiving the user's startup instruction through the main thread, read the animation code file, and edit the animation code file according to the beat and the beat frequency; 根据所述循环次数依次执行编辑后的所述动画代码文件。The edited animation code files are sequentially executed according to the number of cycles.
CN201310395456.8A 2013-09-03 2013-09-03 Method and device for realizing function of metronome on mobile terminal Pending CN104427113A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310395456.8A CN104427113A (en) 2013-09-03 2013-09-03 Method and device for realizing function of metronome on mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310395456.8A CN104427113A (en) 2013-09-03 2013-09-03 Method and device for realizing function of metronome on mobile terminal

Publications (1)

Publication Number Publication Date
CN104427113A true CN104427113A (en) 2015-03-18

Family

ID=52974987

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310395456.8A Pending CN104427113A (en) 2013-09-03 2013-09-03 Method and device for realizing function of metronome on mobile terminal

Country Status (1)

Country Link
CN (1) CN104427113A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106327949A (en) * 2015-06-14 2017-01-11 刘英山 Method and device for training music rhythm
CN110415669A (en) * 2019-07-19 2019-11-05 北京字节跳动网络技术有限公司 A kind of implementation method of metronome, device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1104209A2 (en) * 1999-11-29 2001-05-30 Yamaha Corporation Communication apparatus, control method therefor and storage medium storing program for executing the method
CN1941071A (en) * 2005-07-27 2007-04-04 索尼株式会社 Beat extraction and detection apparatus and method, music-synchronized image display apparatus and method
CN1984407A (en) * 2006-06-07 2007-06-20 华为技术有限公司 Method for realizing beat function on mobile terminal and mobile terminal
CN101198111A (en) * 2006-12-05 2008-06-11 乐金电子(中国)研究开发中心有限公司 Mobile phone with simple metronome and its implementing method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1104209A2 (en) * 1999-11-29 2001-05-30 Yamaha Corporation Communication apparatus, control method therefor and storage medium storing program for executing the method
CN1941071A (en) * 2005-07-27 2007-04-04 索尼株式会社 Beat extraction and detection apparatus and method, music-synchronized image display apparatus and method
CN1984407A (en) * 2006-06-07 2007-06-20 华为技术有限公司 Method for realizing beat function on mobile terminal and mobile terminal
CN101198111A (en) * 2006-12-05 2008-06-11 乐金电子(中国)研究开发中心有限公司 Mobile phone with simple metronome and its implementing method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106327949A (en) * 2015-06-14 2017-01-11 刘英山 Method and device for training music rhythm
CN110415669A (en) * 2019-07-19 2019-11-05 北京字节跳动网络技术有限公司 A kind of implementation method of metronome, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
KR102792043B1 (en) Video generating apparatus and method, electronic device, and computer readable medium
CN104049743B (en) For making touch feedback call synchronous system and method
EP4231282A1 (en) Special effect display method and apparatus, electronic device, and computer-readable medium
EP2760014A1 (en) Method for making audio file and terminal device
CN104703036B (en) A method, device and system for synchronizing media file playback progress
KR20170019242A (en) Method and apparatus for providing user interface in an electronic device
US9478202B2 (en) Sound effect data generating apparatus
WO2018103344A1 (en) Method and device for presenting information, and media player
JP6721570B2 (en) Music reproduction system, data output device, and music reproduction method
CN115167680A (en) Vibration reminding method, related equipment and computer storage medium
CN103197967A (en) A method and device for automatically switching working modes
WO2021103653A1 (en) Video and audio synthesis method, terminal, and storage medium
CN111142659A (en) Implementation method, device, terminal and storage medium of touch signal
CN104427113A (en) Method and device for realizing function of metronome on mobile terminal
CN118633355A (en) Determine global and local light effect parameter values
CN104517306A (en) Method and device for playing animation
CN104468980A (en) A method and device for controlling the playback of terminal startup animation and ringtones
US20250239275A1 (en) Video processing method, apparatus, electronic device, and storage medium
JP2015079218A (en) Music reproduction device and music reproduction program
CN112017261A (en) Sticker generation method and device, electronic equipment and computer readable storage medium
US9176610B1 (en) Audiovisual sampling for percussion-type instrument with crowd-sourced content sourcing and distribution
CN105869614B (en) Audio file deriving method and device
JP5898355B1 (en) Sound playback program and sound playback system
KR102347392B1 (en) Method for providing user interface and electronic device the same
CN108170181A (en) Control method, control device and electronic cigarette

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20150318

RJ01 Rejection of invention patent application after publication