XNA开发人员的音频分析框架(译文)
By robot-v1.0
本文链接 https://www.kyfws.com/games/an-audio-analysis-framework-for-xna-developers-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 31 分钟阅读 - 15347 个词 阅读量 0XNA开发人员的音频分析框架(译文)
原文地址:https://www.codeproject.com/Articles/593627/An-Audio-Analysis-Framework-for-XNA-Developers
原文作者:Steve Hoult
译文由本站 robot-v1.0 翻译
前言
Creation of an Audio analysis framework to enable developers with little to no understanding of audio analysis to develop audio-driven games.
创建音频分析框架,以使对音频分析了解很少甚至没有的开发人员可以开发音频驱动的游戏.
介绍(Introduction)
对于那些不是该领域专家的人来说,音频分析似乎是一个艰巨的课题.当创建可借鉴主题的软件时,尤其如此.有许多可用的框架可帮助开发音频驱动的软件,但很少有框架可满足那些对音频分析知识了解有限的框架.该项目的目的是开发一个音频分析框架,专门用于在C#XNA项目中实施,这将使对音频分析了解甚少甚至不了解的开发人员能够开发音频驱动的游戏.该项目的结果是完成了一个简单但功能齐全且文档完善的音频分析框架.不需要使用广泛的先验知识,并且可以轻松地在任何XNA项目中实施的工具.该解决方案的含义导致最终框架的进一步开发,推广和完善.因此,未来的XNA开发人员将获得一个简单的替代方案,以替代复杂且毫不原谅的现有音频分析框架.(To those that are not specialists in the area, audio analysis can seem a daunting subject. This is particularly the case when creating software which draws upon the subject. There are many frameworks available which aid in the development of audio-driven software, yet few that cater to those with a limited knowledge of audio analysis. The aim of this project was to develop an audio analysis framework, specifically for implementation into C# XNA projects, which will enable developers with little to no understanding of audio analysis to develop audio-driven games. The result of this project has seen the completion of a simple, yet fully functional and well documented audio analysis framework; one that that does not require an extensive prior knowledge to use, and that’s easily implementable into any XNA project. The implications of this solution lead towards further development, generalisation, and refinement of the final framework; so that XNA developers of the future are provided with a simple alternative to the complex and unforgiving existing audio analysis frameworks.)
背景(Background)
该项目首先研究现有流行游戏的音频同步方面,以加深对预期框架将提供的功能的了解.接下来,对预分析和实时分析技术发展的研究导致决定操纵XNA的现有类,以从当前播放的音频中提取可视化数据;最终成为最终实时音频分析框架的基础.(This project began by delving into the audio-synchronous aspects of existing popular games, to gain understanding towards the capabilities that a framework would be expected to provide. Next, research into the development of both pre-analysis and real-time analysis techniques lead to the decision towards manipulating XNA’s existing classes, to extract visualisation data from currently playing audio; which ultimately became the basis of the final real-time audio analysis framework.)
音频分析概念设计(Audio Analysis Concept Design)
XNA可视化数据提供了从20hz到20khz(MSDN)的频率的对数刻度. Rose,J(2002)解释说听力是对数的.这意味着低频下仅几赫兹(Hz)的偏移听起来与高频下数百赫兹的偏移相同.这相当于1kHz左右的中频带,而不是10kHz的线性中点.因此,在创建音频分析类时,我将使用Rose,J(2002)的著作将Visualization数据数组相应地分为低,中和高频段:(XNA Visualisation data provides a logarithmic scale of frequencies ranging from 20hz to 20khz (MSDN). Rose, J (2002) explains that hearing is logarithmic; This means that a shift of only a few Hertz (Hz) at a low frequency can sound the same as a shift of many hundreds of Hz at a high frequency. This equates to the medium frequency band lying at around 1kHz, as opposed to a linear midpoint of 10kHz. Thus, when creating my audio analysis class I shall split the Visualisation data array into low, medium and high frequency bands accordingly, using Rose, J (2002)’s work as a reference:)
低:20 – 600 Hz-这包括20至100 Hz的极端低音,100至300 Hz的中低音,最后是300-600Hz的低中音.低频段包含低音低音幅度的上限和低音幅度的平均值,这对于跟踪节奏非常重要.(Low: 20 – 600 Hz - This includes extreme bass ranging between 20 and 100 Hz, mid-bass ranging between 100 and 300 Hz, and finally low midrange ranging between 300-600Hz. The low frequency band contains an average of the lower and upper bass amplitudes, which will be extremely important for tracking rhythm.)
中:600 Hz – 2.4 kHz –其中包括对识别对话和谐波至关重要的频率,这些谐波可以识别一台仪器与另一台仪器.中频带可用于监视人类语音样本.(Mid: 600 Hz – 2.4 kHz – This includes the frequencies critical for identifying dialog and harmonics which identify one instrument from another. The mid band can be used to monitor human speech samples.)
高:2.4 kHz – 20 kHz –该频段范围从低到高端.高频段,重点是2.4 kHz至9.6 kHz,主要为音频传递能量,寿命和亮度.(High: 2.4 kHz – 20 kHz – This band ranges from low to top end highs. The high band, with emphasis on 2.4 kHz to 9.6 kHz, primarily conveys energy, life, and brightness to the audio.)
为了创建每个频带,对从可视化数据阵列中包含的每个频率的当前幅度进行采样,然后将其除以采样的频率数,以创建单个平均幅度结果.(To create each frequency band current amplitude of each frequency included from the visualisation data array is sampled, then divide it by the number of frequencies sampled to create a single average amplitude result.)然后将该结果用作计算动态变量的基础(This result is then used as the basis for calculating dynamic variables).(.)
知道可视化数据数组是对数的,可以使用Rm09(2010)发布的以下公式计算每个频带的采样频率:(Knowing that the visualisation data array is logarithmic the number of frequencies to be sampled for each band is calculated using the following equation posted by Rm09 (2010):) 10 ^(arrayPosition * 0.01171875 + 1.30103)其中arrayPosition =VisulisaionData [0..255](10^(arrayPosition * 0.01171875 + 1.30103) where arrayPosition = VisulisaionData[0..255]) 该公式使用对数10返回指定位置的Hz值.使用此公式可以计算出可视化数据数组中创建每个频带所必须采样的频率范围:(This equation uses log 10 to return the Hz value for the specified position. Using this formula the range of frequencies that must be sampled from the visualisation data array to create each band is calculated:)
大号(L)ow(ow):20 – 600赫兹(: 20 – 600 Hz) 10 ^((10^()0(0)* 0.01171875 + 1.30103)=20.00 Hz(** 0.01171875 + 1.30103) = 20.00 Hz*) 10 ^((*10^(*)126(*126*)* 0.01171875 + 1.30103)=599.22 Hz(** 0.01171875 + 1.30103) = 599.22 Hz*)
中(Mid):600 Hz – 2.4 kHz(: 600 Hz – 2.4 kHz) 10 ^((10^()127(127)* 0.01171875 + 1.30103)=615.61 Hz(** 0.01171875 + 1.30103) = 615.61 Hz*) 10 ^((*10^(*)178(*178*)* 0.01171875 + 1.30103)=2437.62 Hz(** 0.01171875 + 1.30103) = 2437.62 Hz*)
高(High):2.4 kHz – 20 kHz(: 2.4 kHz – 20 kHz) 10 ^((10^()179(179)* 0.01171875 + 1.30103)=2504.29 Hz(** 0.01171875 + 1.30103) = 2504.29 Hz*) 10 ^((*10^(*)255(*255*)* 0.01171875 + 1.30103)=19467.54 Hz(** 0.01171875 + 1.30103) = 19467.54 Hz*)
注意(Note):快速数学检查:127 + 52 + 77 =256.这是正确的总频率数(0-255).(: Quick math check: 127+52+77 = 256. This is the correct total number of frequencies (0 - 255).)
对于每个频带,计算包括的振幅之和.然后将总和除以范围以创建平均幅度值.例如.对于中频带,计算出频率127至178的振幅之和,然后除以范围52.(For each frequency band the sum of the amplitudes included is calculated. The sum is then divided by the range to create the average amplitude value. E.g. for the mid frequency band the sum of the amplitudes of frequencies 127 to 178 is calculated, then divided by the range 52.)
使用代码(Using the code)
以下指南仅详细介绍音频分析类的建议设置和使用(The following guide details only the recommended setup and use of the Audio Analysis Class)(AAC)((AAC)).如果开发人员愿意,可以随意偏离这些程序.请使用本文顶部的"下载音频分析类源代码"链接来获取"(. Developers should feel free to stray from these procedures should they feel comfortable to do so. Please use the “Download Audio Analysis Class Source” link at the top of this article to acquire a copy of the “)AudioAnalysisXNAClass.cs(AudioAnalysisXNAClass.cs)”.(".)
安装程序(使用Visual Studio 2010)(Setup (Using Visual Studio 2010))
导入音频分析类(AAC)(Importing the Audio Analysis Class (AAC))
- 创建一个新的XNA 4.0项目. (如果您打算使用现有的XNA 4.0项目,请跳过此步骤).(Create a new XNA 4.0 project. (Skip this step if you plan to use an existing XNA 4.0 Project).)
- 右键单击您的XNA 4.0项目->添加->现有项目…->(Right click on your XNA 4.0 project -> Add -> Existing Item… ->)
- 导航到您的副本(Navigate to your copy of the)AudioAnalysisXNAClass.cs(AudioAnalysisXNAClass.cs)
- 将其添加到您的XNA 4.0项目.(Add it to your XNA 4.0 project.)
- 使用解决方案资源管理器双击新添加的(Using the solution explorer double click on the newly added)**AudioAnalysisXNAClass.cs(AudioAnalysisXNAClass.cs)**打开它并查看其代码.在第8行,将名称空间从" FinalYearProject"更改为您的项目名称空间.(to open it and view its code. On line 8, change the namespace from “FinalYearProject” to your projects namespace.)
- AAC现在已成功添加到您的项目中!(The AAC is now successfully added to your project!)
初始化音频分析类(AAC)(Initialising the Audio Analysis Class (AAC))
1.如果创建了新的XNA 4.0项目,请使用解决方案资源管理器双击打开Game1.cs.如果您正在使用现有的XNA 4.0项目,请打开等效的类. (此类将包含XNA的游戏循环:(1. If you made a new XNA 4.0 project, open the Game1.cs using the solution explorer by double clicking on it. If you’re using an existing XNA 4.0 project, open the equivalent class. (This class will contain XNA’s game loop:) Initialize()
,(,) LoadContent()
,(,) UnloadContent()
,(,) Update(GameTime gameTime)
和(, and) Draw(GameTime gameTime)
.(.)
2.实例化(2. Instantiate) AudioAnalysisXNAClass
在此类的顶部,有关详细信息,请参见图1,第14行.(at the top of this class, see figure 1, line 14, for details.)
图1-实例化AudioAnalysisXNAClass(Figure 1 - Instantiate the AudioAnalysisXNAClass)
3.内部(3. Inside the) Initialize()
方法,初始化(method, initialise the) AudioAnalysisXNAClass
有关详细信息,请参见图2中的第114行. (这将称为(object, see figure 2, line 114, for details. (This will call the) AudioAnalysisXNAClass
类的构造函数,以启用可视化数据).(class’s constructor, enabling visualisation data).)
图2-初始化AudioAnalysisXNAClass(Figure 2 - Initialise the AudioAnalysisXNAClass)4.现在,AAC已成功初始化到您的项目中.(4. The AAC is now successfully initialised into your project.)
更新音频分析类(AAC)(Updating the Audio Analysis Class (AAC))
建议每个游戏循环仅更新一次AAC的可视化数据阵列和频段.这样,可视化数据将与音乐保持足够的同步.在每帧调用AAC的更新功能不止一次时,例如在每次AAC"获取"功能调用之前直接进行,将提供更好的同步性.这也会对性能产生负面影响.因此,在每个游戏循环中多次调用更新功能时应谨慎.(It’s recommended that the AAC’s visualisation data array and frequency bands are updated only once per game loop. This way, the visualisation data will stay sufficiently synchronised with the music. While calling the AAC’s update functions more than once per frame will, e.g. directly before each AAC “get” function call, will provide greater synchronisation. It will also impact negatively upon performance. Therefore, caution is urged when calling the update functions more than once per game loop.)
1.内部(1. Inside) Update(GameTime gameTime)
,请按以下顺序调用AAC的更新方法:(, call the AAC’s update methods in the following order:)
audioAnalysis.Update();
-必须首先调用.此方法更新可视化数据数组;从XNA当前正在播放的音频中提取256个频率的幅度(- This must be called first. This method updates the visualisation data array; extracting the amplitude for 256 frequencies, from audio currently being played by XNA’s)MediaPlayer
类.如果当前没有音频在播放,则每个频率的振幅将设置为0.(class. If no audio is currently playing the amplitude for each frequency will be set to 0.)audioAnalysis.updateAverageLowFrequencyData();
-此方法使用可视化数据数组的更新版本更新低频段的平均幅度.(- This method updates the average amplitude for the low frequency band, using the updated version of the visualisation data array.)audioAnalysis.updateAverageLowFrequencyData();
-该方法使用可视化数据数组的更新版本更新中频带的平均幅度.(- This method updates the average amplitude for the mid frequency band, using the updated version of the visualisation data array.)audioAnalysis.updateAverageLowFrequencyData();
-该方法使用可视化数据数组的更新版本来更新高频段的平均幅度.(- This method updates the average amplitude for the high frequency band, using the updated version of the visualisation data array.) 2.有关如何正确更新AAC的示例,请参见图3.(2. See figure 3 for an example of how to correctly update the AAC.)
图3-如何正确更新AudioAnalysisXNAClass(Figure 3 - How to correctly update the AudioAnalysisXNAClass)3.如果您已正确执行上述步骤,则每个游戏循环一次AAC现在已成功更新!(3. If you have followed the above steps correctly the AAC is now successfully being updated once per game loop!)
吸气剂和二传手(Getters and Setters)
音频分析类(AAC)包含用于其每个私有变量的getter和setter方法; lowFrBandAverage,midFrBandAverage,highFrBandAverage.(The Audio Analysis Class (AAC) contains a getter and setter method for each of its private variables; lowFrBandAverage, midFrBandAverage, highFrBandAverage.) 组(Set)方法(Methods) 如果您希望手动覆盖更新功能并指定自己的平均幅度值,则可以使用设置方法.有关此示例,请参见图4.(The set methods can be used should you wish to manually override the update functions, and specify your own average amplitude values. See figure 4 for an example of this.)
图4-如何手动设置每个频带的平均幅度值.(Figure 4 - How to manually set the average amplitude value for each frequency band.)但是,下一次调用低,中和高频平均更新方法时,将替换这些手动值中的每一个,并根据音频当前的低,中和高平均值进行替换.(However, each these manual values will be replaced next time the low, mid and high frequency average update method is called, with the current low, mid and high averages according to the audio.) 获取方法(Get Methods) 如果您希望检查变量包含的值,则可以使用get方法.以下代码段使用图4中的代码在每个游戏循环中手动设置平均幅度变量的值,然后进行``获取'‘并将手动设置的值打印到控制台,有关详细信息,请参见图5.(The get methods can be used should you wish to check the value that the variables contain. The following code snippet manually sets the values of the average amplitude variables each game loop, using the code from figure 4, before ‘getting’ and printing the manually set values to the console, see figure 5 for details.)
protected override void Update(GameTime gameTime)
{
//FIRST: Update visulisation data.
audioAnalysis.Update();
////////////////////////////////////////////////////////////////////
/* SECOND: Update the average amplitutde for each frequency band, //
// using the current visulisation data. */
////////////////////////////////////////////////////////////////////
//Update the average amplitude for the low frequency band.
audioAnalysis.updateAverageLowFrequencyData();
//Update the average amplitude for the mid frequency band.
audioAnalysis.updateAverageMidFrequencyData();
//Update the average amplitude for the high frequency band.
audioAnalysis.updateAverageHighFrequencyData();
manuallySetValues(); //Manually set all of the average frequency values
getAverageAmplitudes(); //Print all of the average frequency values to the console.
}
图5-将图4中设置的值返回并打印到控制台. (请参阅左下角.)(Figure 5 - Values set in figure 4, returned and printed to the console. (See bottom left.))最后,如果需要,get方法还可用于创建其他方法.我为音频分析框架的更多有经验的用户提供了创建额外方法的选项.当然,他们也可以直接在音频分析类本身中实现新方法.新方法的创建很大程度上取决于各个开发人员的创造力和独创性.图6显示了创建新方法的非常简单的示例,该方法使用get方法将中频带的平均幅度与最小float值进行比较,以返回最小或最大double值.(Finally the get methods can also be used to create extra methods should they be required. The creation of extra methods is an option I’ve provided for more experienced users of the audio analysis framework. Of course, they could also directly implement new methods into the audio analysis class itself. The creation of new methods is much down to the creativity and ingenuity of the individual developers. Figure 6 shows a very simple example of the creation of a new method, using the get method to compare the average amplitude of the mid frequency band against a min float value, to return a min or max double value.)
图6-创建一个新方法以返回一个double.(Figure 6 - Creation of a new method to return a double.)### 音频分析类功能概述(Overview of the Audio Analysis Classes Functionality) 下一节将提供一个示例,说明如何在XNA项目中使用每个功能集中的一种方法.每个功能集的其余方法均会以完全相同的方式工作,因此将不进行演示,只是它们将使用不同的频段平均值计算返回值.方法名称中指定了用于计算返回值的平均频段.例如,方法" getBool_2StepLowFrq"将使用低频带平均值计算返回值,该平均值由方法名称末尾的" LowFrq"指定.同时," getBool_2StepMidFrq"将使用方法名称末尾的" MidFrq"所指定的中频段平均值来计算返回值.最后," getBool_2StepHighFrq"将使用方法名称末尾的" HighFrq"所指定的高频段平均值来计算返回值.(The following section will provide an example of how one of the methods from each function set could be used within an XNA project. The remaining methods from each function set will not be demonstrated, as they work in exactly the same manor, except that they will calculate the return value using a different frequency band average. The frequency band average used to calculate a return value is specified in the methods name. For example the method “getBool_2StepLowFrq” will calculate the return value using the low frequency band average value, as specified by the ‘LowFrq’ at the end of the methods name. Whilst the “getBool_2StepMidFrq” will calculate the return value using the mid frequency band average value, as specified by the ‘MidFrq’ at the end of the methods name. Finally, the “getBool_2StepHighFrq” will calculate the return value using the high frequency band average value, as specified by the ‘HighFrq’ at the end of the methods name.) 还应注意,在方法名称中指定的频带将在某种程度上确定返回变量的可能用途.例如,对于控制节奏的变量,最好使用低频带来计算返回值.虽然使用中频带最适合将变量与音频中的人类语音采样或主要合成音符旋律相关联.最后,对于传达能量或亮度的变量,最好使用高频带.但是,最终,这取决于各个开发人员的创造力和对这三个频段的了解,这最终将决定如何使用它们.(It should also be noted that the frequency band specified within the method name will to some degree determine the possible uses of the returned variable. For example using the low frequency band to calculate return values would be best for variables that control rhythm. Whilst using the mid frequency band would be best for variables to be associated with human speech samples within the audio, or perhaps the main synth melody. Finally using the high frequency band would be best for variables that convey energy or brightness. However, in the end, it is down to the individual developer’s creativity and knowledge of these 3 frequency bands which will ultimately dictate how they are used.) 最后,每个频带平均值的值将始终在0.0f和1.0f之间.指定超出这些界限的值将导致某些返回值变得不可获取.(Finally the value of each frequency band average will always be between 0.0f and 1.0f. Specifying a value that is outside these boundaries will result in some return values becoming unobtainable.)
函数集1示例:2Step返回音频动态C#布尔变量(Function Set 1 Example: 2Step Return an Audio-dynamic C# Boolean Variable)
此方法用于使用低频段返回布尔变量.如果音频剪辑的低频段平均值大于0.49f(任意值),则此方法将布尔变量" shoot"设置为true.然后将此变量设置为true时,可以用作触发敌方单位发射武器的触发器.否则,如果音频的平均低频带小于0.49f,则将返回错误,并且敌人将停止射击.(This method is used to return a Boolean variable using the low frequency band. If the low frequency band average of an audio clip is greater than 0.49f (an arbitrary value) this method is will set the Boolean variable “shoot” to true. This variable could then be used as a trigger for enemy units to fire their weapons when it is set to true. Otherwise, if the audios average low frequency band is less than 0.49f false will be returned, and enemies will cease their fire.)
bool shoot = audioAnalysis.getBool_2StepLowFrq(0.49f);
函数集2示例:2Step返回音频动态C#整数变量(Function Set 2 Example: 2Step Return an Audio-dynamic C# Integer Variable)
此方法用于使用低频段返回两个整数变量的选择.如果音频剪辑的低频段平均值大于0.54f,则此方法会将整数变量gameIntensity1Or6设置为6.否则,如果不满足此条件,则gameIntensity1Or6将设置为1.触发,当gameIntensity1Or6的值设置为6时,生成的敌人类型与设置为1时不同的敌人类型.(This method is used to return a choice of two integer variables using the low frequency band. If the low frequency band average of an audio clip is greater than 0.54f, this method will set the integer variable gameIntensity1Or6 to 6. Otherwise, if this criterion is not met, gameIntensity1Or6 will be set to 1. This variable could be used as a trigger, spawning a different enemy type when the value of gameIntensity1Or6 is set to 6, than when it is set to 1.)
int gameIntensity1Or6 = audioAnalysis.getInt_2StepLowFrq(1, 6, 0.54f);
函数集3示例:6Step返回音频动态C#整数变量(Function Set 3 Example: 6Step Return an Audio-dynamic C# Integer Variable)
此方法用于使用低频段返回1到6之间的整数值.如果音频剪辑的低频段平均值小于0.1f,则将返回minInt值1.如果频带平均值大于0.1f,但也小于或等于0.2f,则将返回2.如果频带平均值大于0.2f,但也小于或等于0.3f,则将返回3.如果频带平均值大于0.3f,但也小于或等于0.4f,则将返回4.如果频带平均值大于0.4f,但也小于或等于0.54f,则将返回5.最后,如果频带平均值大于0.54f 6,将返回最大值.(This method is used to return integer values between 1 and 6 using the low frequency band. If the low frequency band average of an audio clip is less than 0.1f, the minInt value of 1 will be returned. If the frequency band average is greater than 0.1f, but also less than or equal to 0.2f, 2 will be returned. If the frequency band average is greater than 0.2f, but also less than or equal to 0.3f, 3 will be returned. If the frequency band average is greater than 0.3f, but also less than or equal to 0.4f, 4 will be returned. If the frequency band average is greater than 0.4f, but also less than or equal to 0.54f, 5 will be returned. Finally if the frequency band average is greater than 0.54f 6, the maximum value, will be returned.) 每次返回值时,gameIntensity1To6的值都会设置为该值.再一次,该变量可以用作触发器,也许可以生成不同类型的敌人.(Each time a value is returned gameIntensity1To6’s value will be set to that value. Once again this variable could be used as a trigger, perhaps to spawn different types of enemies.) 与以前的方法的唯一区别是此方法具有生成6种不同类型的敌人的能力,而不仅仅是2种.(The only difference from the previous method being that this method has the ability to spawn 6 different types of enemies, instead of just 2.)
int gameIntensity1To6 = audioAnalysis.getInt_6StepLowFrq(1, 6, 0.1f, 0.2f, 0.3f, 0.4f, 0.54f);
函数集4示例– 2Step返回音频动态C#浮点变量(Function Set 4 Example – 2Step Return an Audio-dynamic C# Float Variable)
此方法用于使用低频段返回两个浮点变量的选择.如果音频片段的低频段平均值大于0.45f,则此方法会将浮动变量敌人移动速度设置为4.5f.否则,如果不符合此条件,(This method is used to return a choice of two float variable/s using the low frequency band. If the low frequency band average of an audio clip is greater than 0.45f, this method will set the float variable enemyMoveSpeed to 4.5f. Otherwise, if this criterion is not met,) enemyMoveSpeed
将设置为0.9f.该变量可用于调节敌人的移动速度.这样,当音乐强度降低时,敌人的移动速度就会变慢,而当音乐强度降低时,敌人的移动速度会更快.(will be set to 0.9f. This variable could be used to regulate enemy move speed. So that enemies move slowly when the music is less intense, and faster when it comes more so.)
float enemyMoveSpeed = audioAnalysis.getFloat_2StepLowFrq(0.9f, 4.5f, 0.45f);
函数集5示例– 6Step返回音频动态C#浮点变量(Function Set 5 Example – 6Step Return an Audio-dynamic C# Float Variable)
此方法用于使用中频段返回介于0.75f和9.1337f之间的浮点值.如果音频剪辑的中频带平均值小于0.2f,则将返回0.75f.如果频带平均值大于0.2f,但也小于或等于0.3f,则将返回1.96f.如果频段平均值大于0.3f,但也小于或等于0.4f,则将返回3.75f.如果频段平均值大于0.4f,但也小于或等于0.5f,则将返回5.55f.如果频带平均值大于0.5f,但也小于或等于0.64f,则将返回7.34f.最后,如果频段平均值大于0.64f,则将返回9.1337f(最大值).(This method is used to return float values between 0.75f and 9.1337f using the mid frequency band. If the mid frequency band average of an audio clip is less than 0.2f, 0.75f will be returned. If the frequency band average is greater than 0.2f, but also less than or equal to 0.3f, 1.96f will be returned. If the frequency band average is greater than 0.3f, but also less than or equal to 0.4f, 3.75f will be returned. If the frequency band average is greater than 0.4f, but also less than or equal to 0.5f, 5.55f will be returned. If the frequency band average is greater than 0.5f, but also less than or equal to 0.64f, 7.34f will be returned. Finally if the frequency band average is greater than 0.64f, 9.1337f - the maximum value, will be returned.)
返回的浮点数存储在(The returned float is stored in the) enemyAnimation
变量,例如可以用来调整敌人动画的比例.(variable, which could for example be used to regulate the scale of enemy animations.)
Float enemyAnimation = audioAnalysis.getFloat_6StepMidFrq( 0.75f, 9.1337f, 0.2f, 0.3f, 0.4f,
0.5f, 0.64f);
功能集6 – 2Step返回音频动态C#字符串变量(Function Set 6 – 2Step Return an Audio-dynamic C# String Variable)
此方法用于使用高频带返回两个字符串之一.的(This method is used to return one of two Strings using the high frequency band. The) highFrqMonitor
如果高频平均值高于0.0f,则字符串变量将设置为包含"高频活动".否则,它将返回"无高点".此变量可用于监视高频平均值的状态,也许在音频样本当前不包含高频时向用户显示.(String variable will be set to contain “High frequencies active” if the high frequency average is above 0.0f. Otherwise, it will return “No highs”. This variable could be used to monitor the state of the high frequency average, perhaps to display to the user when an audio sample currently contains no high frequencies.)
String highFrqMonitor = audioAnalysis.getString_2StepHighFrq( "No highs",
"High frequencies active", 0.0f);
函数集7示例– 6Step返回音频动态C#字符串变量(Function Set 7 Example – 6Step Return an Audio-dynamic C# String Variable)
此方法用于使用中频段返回六个字符串之一.如果音频剪辑的中频带平均值小于0.1f,将返回"非常低".如果频带平均值大于0.1f,但也小于或等于0.2f,则将返回"低".如果频带平均值大于0.2f,但也小于或等于0.3f,则将返回"低中".如果频带平均值大于0.3f,但也小于或等于0.4f,则将返回"中".如果频带平均值大于0.4f,但也小于或等于0.54f,则将返回" High".最后,如果频带平均值大于0.54f,将返回"非常高".(This method is used to return one of six Strings using the mid frequency band. If the mid frequency band average of an audio clip is less than 0.1f, “Very low” will be returned. If the frequency band average is greater than 0.1f, but also less than or equal to 0.2f, “Low” will be returned. If the frequency band average is greater than 0.2f, but also less than or equal to 0.3f, “Low-Medium” will be returned. If the frequency band average is greater than 0.3f, but also less than or equal to 0.4f, “Medium” will be returned. If the frequency band average is greater than 0.4f, but also less than or equal to 0.54f, “High” will be returned. Finally if the frequency band average is greater than 0.54f “Very High” will be returned.)
与以前的方法类似,(Similar to the previous method, the) midFrqMonitor
变量也许可以用来向用户显示中频带的强度.(variable could perhaps be used to display to the user the intensity of the mid frequency band.)
String midFrqMonitor = audioAnalysis.getString_6StepMidFrq( "Very low", "Low", "Low-Medium",
"Medium", "High", "Very High", 0.1f, 0.2f, 0.3f, 0.4f, 0.54f);
功能集8示例– 3Step返回音频动态XNA Vector2变量(Function Set 8 Example – 3Step Return an Audio-dynamic XNA Vector2 Variable)
此方法用于使用低频带返回三个Vector2变量之一.如果音频剪辑的低频段平均值小于0.4f,(This method is used to return one of three Vector2 variables using the low frequency band. If the low frequency band average of an audio clip is less than 0.4f,) minParticleTrailVelocity
将被退回.如果频段平均值大于0.4f,但也小于或等于0.54f,(will be returned. If the frequency band average is greater than 0.4f, but also less than or equal to 0.54f,) midParticleTrailVelocity
将被退回.最后,如果频段平均值大于0.54f(will be returned. Finally if the frequency band average is greater than 0.54f) maxParticleTrailVelocity
将被退回.(will be returned.)
的(The) currentParticleTrailVelocity
使用提供的三个速度之一作为参数,也许可以使用变量来调节粒子行进以产生拖尾效应的速度.(variable could perhaps be used regulate the velocity at which particles travel for a trail effect, using one of the three velocities provided as parameters.)
//Example particle trail velocities:
Vector2 minParticleTrailVelocity = new Vector2(0.7f, 0.7f);
Vector2 midParticleTrailVelocity = new Vector2(2.0f, 2.0f);
Vector2 maxParticleTrailVelocity = new Vector2(4.0f, 4.0f);
Vector2 currentParticleTrailVelocity = audioAnalysis.getVector2_3StepLowFrq(
minParticleTrailVelocity, midParticleTrailVelocity, maxParticleTrailVelocity, 0.4f, 0.54f);
功能集9示例– 6Step返回音频动态XNA Vector2变量(Function Set 9 Example – 6Step Return an Audio-dynamic XNA Vector2 Variable)
此方法用于使用中频带返回六个Vector2变量之一.如果音频剪辑的中频带平均值小于0.1f,则将返回verySmallParticleExplosionVelocity.如果频段平均值大于0.1f,但也小于或等于0.2f,则将返回smallParticleExplosionVelocity.如果频带平均值大于0.2f,但也小于或等于0.3f,则将返回mediumParticleExplosionVelocity.如果频段平均值大于0.3f,但也小于或等于0.4f,则将返回bigParticleExplosionVelocity.如果频段平均值大于0.4f,但也小于或等于0.54f,则将返回veryBigParticleExplosionVelocity.最后,如果频段平均值大于0.54f,则将返回massParticleExplosionVelocity.(This method is used to return one of six Vector2 variabes using the mid frequency band. If the mid frequency band average of an audio clip is less than 0.1f, verySmallParticleExplosionVelocity will be returned. If the frequency band average is greater than 0.1f, but also less than or equal to 0.2f, smallParticleExplosionVelocity will be returned. If the frequency band average is greater than 0.2f, but also less than or equal to 0.3f, mediumParticleExplosionVelocity will be returned. If the frequency band average is greater than 0.3f, but also less than or equal to 0.4f, bigParticleExplosionVelocity will be returned. If the frequency band average is greater than 0.4f, but also less than or equal to 0.54f, veryBigParticleExplosionVelocity will be returned. Finally if the frequency band average is greater than 0.54f massiveParticleExplosionVelocity will be returned.) 使用提供的六个速度之一作为参数,currentParticleExplosionVelocity变量可用于调节粒子传播爆炸的速度.(The currentParticleExplosionVelocity variable could be used to regulate the velocity at which particles travel for explosions, using one of the six velocities provided as parameters.)
// Example particle explosion velocities:
Vector2 verySmallParticleExplosionVelocity = new Vector2(0.5f, 0.5f);
Vector2 smallParticleExplosionVelocity = new Vector2(1.5f, 1.5f);
Vector2 mediumParticleExplosionVelocity = new Vector2(5.0f, 5.0f);
Vector2 bigParticleExplosionVelocity = new Vector2(10.0f, 10.0f);
Vector2 veryBigParticleExplosionVelocity = new Vector2(15.0f, 15.0f);
Vector2 massiveParticleExplosionVelocity = new Vector2(25.0f, 25.0f);
Vector2 currentParticleExplosionVelocity = audioAnalysis.getVector2_6StepMidFrq(
verySmallParticleExplosionVelocity, smallParticleExplosionVelocity,
mediumParticleExplosionVelocity, bigParticleExplosionVelocity,
bigParticleExplosionVelocity, massiveParticleExplosionVelocity, 0.1f, 0.2f, 0.3f, 0.4f, 0.54f);
函数集10示例– 3Step返回音频动态XNA TimeSpan变量(Function Set 10 Example – 3Step Return an Audio-dynamic XNA TimeSpan Variable)
此方法用于使用低频段返回三个TimeSpan变量之一.如果音频剪辑的低频段平均值小于0.4f,则将使用TimeSpan.FromSeconds(maxFireRateInterval)将maxFireRateInterval转换为TimeSpan,然后返回.如果频段平均值大于0.4f,但也小于或等于0.54f,则将使用TimeSpan.FromSeconds(midFireRateInterval)将midFireRateInterval转换为TimeSpan,然后返回.最后,如果平均频段大于0.54f,则将使用TimeSpan.FromSeconds(minFireRateInterval)将minFireRateInterval转换为TimeSpan,然后返回.(This method is used to return one of three TimeSpan variables using the low frequency band. If the low frequency band average of an audio clip is less than 0.4f, the maxFireRateInterval will be converted into a TimeSpan using the TimeSpan.FromSeconds(maxFireRateInterval), then returned. If the frequency band average is greater than 0.4f, but also less than or equal to 0.54f, the midFireRateInterval will be converted into a TimeSpan using the TimeSpan.FromSeconds(midFireRateInterval), then returned. Finally if the frequency band average is greater than 0.54f the minFireRateInterval will be converted into a TimeSpan using the TimeSpan.FromSeconds(minFireRateInterval), then returned.) 可以使用timeSpanBetweenShots变量来调节发射子弹之间的时间.例如,根据用于设置返回的TimeSpan的maxFireRateInterval浮点数,当低频段平均值低于0.4f时,弹丸将几乎完全停止发射.根据用于设置返回的TimeSpan的minFireRateInterval浮点数,当低频段平均值大于0.54f时,弹丸将被极快地发射.而当低频段平均值介于0.1f和0.7f之间时,将根据确切的当前平均值以其他TimeSpan速率之一发射弹丸.(The timeSpanBetweenShots variable could perhaps be used regulate time between firing a projectile. For Example, when the low frequency band average is below 0.4f projectiles will almost stop being fired at all, according to the maxFireRateInterval float that was used to setup the returned TimeSpan. Whilst when the low frequency band average is greater than 0.54f projectiles will be fired extremely quickly, according to the minFireRateInterval float that was used to setup the returned TimeSpan. While when the low frequency band average is between 0.1f and 0.7f projectiles will be fired at one of the other TimeSpan rates depending on the exact current average.)
//Example fire rate intervals, as floats:
float minFireRateInterval = 0.05f;
float midFireRateInterval = 0.15f;
float maxFireRateInterval = 10000f; //This basically turns off shooting.
TimeSpan timeSpanBetweenShots = audioAnalysis.getTimeSpan_3StepLowFrq(
minFireRateInterval, midFireRateInterval, maxFireRateInterval, 0.4f, 0.54f);
函数集11示例– 6Step返回音频动态XNA TimeSpan变量(Function Set 11 Example – 6Step Return an Audio-dynamic XNA TimeSpan Variable)
此方法用于使用低频段返回六个TimeSpan变量之一.如果音频剪辑的低频段平均值小于0.1f,则将使用TimeSpan.FromSeconds(slowestInterval)将slowestInterval转换为TimeSpan,然后返回.如果频段平均值大于0.1f,但也小于或等于0.2f,则将使用TimeSpan.FromSeconds(slowInterval)将slowInterval转换为TimeSpan,然后返回.如果频带平均值大于0.2f,但也小于或等于0.3f,则将使用TimeSpan.FromSeconds(mediumInterval)将mediumInterval转换为TimeSpan,然后返回.如果频带平均值大于0.3f,但也小于或等于0.4f,则将使用TimeSpan.FromSeconds(fastInterval)将fastInterval转换为TimeSpan,然后返回.如果频段平均值大于0.4f,但也小于或等于0.7f,则将使用TimeSpan.FromSeconds(veryFastInterval)将veryFastInterval转换为TimeSpan,然后返回.最后,如果频段平均值大于0.7f,则将使用TimeSpan.FromSeconds(extremelyFastInterval)将ExtremeFastInterval转换为TimeSpan,然后返回.(This method is used to return one of six TimeSpan variables using the low frequency band. If the low frequency band average of an audio clip is less than 0.1f, the slowestInterval will be converted into a TimeSpan using the TimeSpan.FromSeconds(slowestInterval), then returned. If the frequency band average is greater than 0.1f, but also less than or equal to 0.2f, the slowInterval will be converted into a TimeSpan using the TimeSpan.FromSeconds(slowInterval), then returned. If the frequency band average is greater than 0.2f, but also less than or equal to 0.3f, the mediumInterval will be converted into a TimeSpan using the TimeSpan.FromSeconds(mediumInterval), then returned. If the frequency band average is greater than 0.3f, but also less than or equal to 0.4f, the fastInterval will be converted into a TimeSpan using the TimeSpan.FromSeconds(fastInterval), then returned. If the frequency band average is greater than 0.4f, but also less than or equal to 0.7f, the veryFastInterval will be converted into a TimeSpan using the TimeSpan.FromSeconds(veryFastInterval), then returned. Finally if the frequency band average is greater than 0.7f the extremelyFastInterval will be converted into a TimeSpan using the TimeSpan.FromSeconds(extremelyFastInterval), then returned.) 可以使用timeSpanBetweenSpawning变量来调节敌人产生之间的时间.例如,根据用于设置返回的TimeSpan的slowestInterval浮点数,当低频段平均值低于0.1f时,敌人几乎几乎完全停止生成.根据用于设置返回的TimeSpan的ExtremeFastInterval浮点数,当低频段平均值大于0.7f时,敌人将非常快速地生成.而当低频段平均值介于0.1f和0.7f之间时,敌人将以其他TimeSpan速率之一生成,具体取决于确切的当前平均值.(The timeSpanBetweenSpawning variable could perhaps be used regulate time between the spawning of enemies. For Example, when the low frequency band average is below 0.1f enemies will almost stop spawning at all, according to the slowestInterval float that was used to setup the returned TimeSpan. Whilst when the low frequency band average is greater than 0.7f enemies will spawn extremely quickly, according to the extremelyFastInterval float that was used to setup the returned TimeSpan. While when the low frequency band average is between 0.1f and 0.7f enemies will spawn at one of the other TimeSpan rates depending on the exact current average.)
float extremelyFastInterval = 0.05f;
float veryFastInterval = 0.2f;
float fastInterval = 0.3f;
float mediumInterval = 0.5f;
float slowInterval = 0.9f;
float slowestInterval = 10000f; //This basically stops spawning.
TimeSpan timeSpanBetweenSpawning = audioAnalysis.getTimeSpan_6StepLowFrq(
extremelyFastInterval, veryFastInterval, fastInterval, mediumInterval,
slowInterval, slowestInterval, 0.1f, 0.2f, 0.3f, 0.4f, 0.7f);
功能集12示例– 3Step返回音频动态XNA颜色变量(Function Set 12 Example – 3Step Return an Audio-dynamic XNA Color Variable)
此方法用于使用低频段返回三个Color变量之一.如果音频剪辑的低频段平均值小于0.4f,将返回colour_LowResponce.如果频带平均值大于0.4f,但也小于或等于0.54f,则将返回colour_MediumResponce.最后,如果频段平均值大于0.54f,将返回colour_HighResponce.(This method is used to return one of three Color variables using the low frequency band. If the low frequency band average of an audio clip is less than 0.4f, colour_LowResponce will be returned. If the frequency band average is greater than 0.4f, but also less than or equal to 0.54f, colour_MediumResponce will be returned. Finally if the frequency band average is greater than 0.54f colour_HighResponce will be returned.) 可以使用currentColour变量来调节粒子痕迹或爆炸的颜色.(The currentColour variable could perhaps be used regulate the colour of particle trails or explosions.)
Color colour_LowResponce = new Color(1.0f, 0.0f, 0.0f); // Red
Color colour_MediumResponce = new Color(0.0f, 1.0f, 0.0f); // Green
Color colour_HighResponce = new Color(0.0f, 0.0f, 1.0f); // Blue
Color currentColour = audioAnalysis.getColour_3StepLowFrq( colour_LowResponce,
colour_MediumResponce, colour_HighResponce, 0.4f, 0.54f);
功能集13示例– 6Step返回音频动态XNA颜色变量(Function Set 13 Example – 6Step Return an Audio-dynamic XNA Color Variable)
该方法用于返回使用高频段的六个颜色变量之一.如果音频剪辑的高频段平均值小于0.2f,则将返回colour_MinResponce.如果频段平均值大于0.2f,但也小于或等于0.25f,(This method is used to return one of six Color variabes using the high frequency band. If the high frequency band average of an audio clip is less than 0.2f, colour_MinResponce will be returned. If the frequency band average is greater than 0.2f, but also less than or equal to 0.25f,) colour_LowMediumResponce
将被退回.如果频带平均值大于0.25f,但也小于或等于0.3f,则将返回colour_MediumResponce.如果频段平均值大于0.3f,但也小于或等于0.35f,(will be returned. If the frequency band average is greater than 0.25f, but also less than or equal to 0.3f, colour_MediumResponce will be returned. If the frequency band average is greater than 0.3f, but also less than or equal to 0.35f,) colour_HighMediumResponce
将被退回.如果频段平均值大于0.35f,但也小于或等于0.7f,(will be returned. If the frequency band average is greater than 0.35f, but also less than or equal to 0.7f,) colour_HighResponce
将被退回.最后,如果频段平均值大于0.7f,将返回colour_MaxResponce.(will be returned. Finally if the frequency band average is greater than 0.7f colour_MaxResponce will be returned.)
的(The) currentColour
变量可用于调节项目的背景色.因此,当高频平均值是一个非常大的值时,背景颜色将变为浅灰色.当它是一个低值时,它将保持黑色或深灰色.这将创建背景色频闪效果–在高频尖峰(例如踩hat声)上将背景色闪烁为浅灰色.(variable could be used to regulate the background colour of the project. So when the high frequency average is a very large value, the background colour will change to a light grey. Whilst when it is a low value, it will remain black or dark grey. This will create background colour strobe effect – flashing the background colour a light grey on high frequency spikes (such as hi-hat hits).)
Color colour_MinResponce = new Color(0, 0, 0); // Black
Color colour_LowMediumResponce = new Color(3, 3, 3); // Very very dark grey
Color colour_MediumResponce = new Color(6, 6, 6); // Very dark grey
Color colour_HighMediumResponce = new Color(9, 9, 9); // dark grey
Color colour_HighResponce = new Color(12, 12, 12); // grey
Color colour_MaxResponce = new Color(40, 40, 40); // light grey
Color currentColour = audioAnalysis.getColour_6StepHighFrq( colour_MinResponce,
colour_LowMediumResponce, colour_MediumResponce, colour_HighMediumResponce,
colour_HighResponce, colour_MaxResponce,
0.2f, 0.25f, 0.3f, 0.35f, 0.7f);
功能集14示例– 3Step返回音频动态XNA Color []数组(Function Set 14 Example – 3Step Return an Audio-dynamic XNA Color[] Array)
此方法用于使用低频段返回三个Color数组之一Color [].如果音频剪辑的低频段平均值小于0.4f,则将返回audioVisColourArray1.如果频段平均值大于0.4f,但也小于或等于0.54f,则将返回audioVisColourArray2.最后,如果频段平均值大于0.54f,则将返回audioVisColourArray3.(This method is used to return one of three Color arrays, Color[], using the low frequency band. If the low frequency band average of an audio clip is less than 0.4f, audioVisColourArray1 will be returned. If the frequency band average is greater than 0.4f, but also less than or equal to 0.54f, audioVisColourArray2 will be returned. Finally if the frequency band average is greater than 0.54f audioVisColourArray3 will be returned.)
的(The) currentColourArray
可以用于调节可同步/以颜色组合方式工作的多个项目的颜色,并提供一种更有效的返回颜色组合的方式,只需多次调用getColour方法即可.(could be used regulate the colours of multiple items that work in synchronization / in colour combinations – and provides a more efficient means of returning colour combinations that simply calling the getColour method multiple times.)
//initalise colour arrays for audio analysis use:
audioVisColourArray1 = new Color[2]; //array of 2 colours
audioVisColourArray2 = new Color[2]; //array of 2 colours
audioVisColourArray3 = new Color[2]; //array of 2 colours
//Colours for a low responce
audioVisColourArray1[0] = new Color(0, 153, 153);
audioVisColourArray1[1] = new Color(153, 153, 0);
//Colours for a medium responce
audioVisColourArray2[0] = new Color(152, 237, 0);
audioVisColourArray2[1] = new Color(0, 237, 152);
//Colours for a high responce
audioVisColourArray3[0] = new Color(208, 0, 110);
audioVisColourArray3[1] = new Color(110, 0, 208);
//A new array larger enough to hold largest colour combination returned by the AAC (2).
Color[] currentColourArray = new Color[2];
//Get the currentColourArray from using the AAC.
Color[] currentColourArray = audioAnalysis.getColourArray_3StepLowFrq(
audioVisColourArray1, audioVisColourArray2, audioVisColourArray3, 0.4f, 0.54f);
音频原型游戏(Audio-Driven Prototype Game)
与该框架一起,创建了2D"音频驱动"游戏,请参见图7\8和9.该游戏实现了音频分析框架,展示了其一些可能的功能.该原型游戏已作为XNA可执行文件与完整的源代码一起上传到了git hub.(Along side this framework a 2D ‘audio-driven’ game was created, see figures 7, 8 and 9. This game implements the audio analysis framework demonstrating some of its possible capabilities. This prototype game has been uploaded to git hub as an XNA executable, along with the full source code.)
- 要下载游戏的exe,请单击此处!(To download an exe of the game click here!)
- 要下载游戏源代码,请单击此处!(To download the game source code click here!)
图7-“极低"游戏强度-低频段平均振幅为0.077(Figure 7 - “Very low” gameplay intensity - low frequency band average amplitude of 0.077)
图8-“高"游戏强度-低频段平均振幅为0.478(Figure 8 - “High” gameplay intensity - low frequency band average amplitude of 0.478)
图9-“疯狂"游戏强度-低频平均振幅为0.542(Figure 9 - “Insane” gameplay intensity - low frequency average amplitude of 0.542)## 未来考虑(Future Considerations) 知道了我现在所知道的,我将考虑对音频分析类进行一些重大更改.在创建音频分析类时,我仔细考虑了功能与性能的关系.由于此框架是为开发人员设计的,因此他们可能正在构建对性能产生重大影响的应用程序,因此,我自己的方法所产生的影响应尽可能小.考虑到这一点,我决定以少量的功能和可维护性为代价,为每种返回数据类型生成两组功能.这样,如果开发人员只希望简单地以"开或关"类型返回两个指定值,从而对程序产生最小的影响,则2Step函数可提供最佳性能.另一方面,6Step函数提供了一些额外的功能,但以稍高的影响为代价,但是提供了一条返回值平滑的曲线,并允许开发人员指定六个不同的值进行返回.(Knowing what I now know, there are some major changes that I would consider making to the audio analysis class. When creating the audio analysis class, I considered carefully the effects of functionality vs. performance. Since this framework is designed for the use of developers, who may be building applications already significantly impact upon performance, it’s important that my own methods are of the lowest impact possible. Considering this, I decided to trade a small amount of functionality and maintainability, to produce two sets of functions for each return data type. This way, should developers only wish for a simple ‘on or off’ type return of two specified values, inflicting minimum impact to their program, the 2Step functions provide optimal performance. On the other hand, the 6Step functions provide some extra functionality, at the expense of slightly higher impact, but providing a smoother curve over which values are returned, and allowing the developer to specify six different values for return.) 如果将来要继续进行音频分析课程,我将尝试分析这两种方法所造成的影响.如果差异相对较小,我将考虑同时废弃两者,而不是使用10Step方法.我这样做的理由是,在平滑的收益曲线上,10Step方法可能会提供开发人员从单一方法可能需要的最大功能.同时,与6Step方法一样,也可以将其用作2\3\4等步骤方法,方法是通过使参数超出范围(超出范围超出范围)来操作参数.归一化的幅度数组(0到1).例如,可以轻松地将10Step函数转换为XStep函数.如果X是希望函数选择的参数数量,从string1开始到string10,则必须在计算范围内输入X-1参数,从float max参数开始,到float min参数.(If I am to continue the audio analysis class in the future, I will attempt to analyse the impact that both these methods cause. If the difference is relatively small I will consider scrapping both, in place of a 10Step method. My reasoning behind this is that a 10Step method will likely provide the maximum functionality a developer could need from a single method, over a smooth return curve. At the same time, as with the 6Step method, it’s also possible to use it as a 2, 3, 4, etc step method, by manipulating the parameters in such a way that makes them out of bounds (out of bounds being outside the normalised amplitude array of 0 to 1). For example a 10Step function can be converted into an XStep function easily. If X is the number of parameters you wish the function to choose from, starting from string1 and going to string10, then you must enter X-1 parameters within bounds the for calculation, starting with the float max parameter, and going to the float min parameter.)
致谢(Acknowledgements)
音乐由Andreas Estensen(Est&Sen)创作.(Music created by Andreas Estensen (Est&Sen).) 请点击这里查看他的Facebook页面了解更多!(Please click here to see his facebook page for more!)
参考文献(References)
- MSDN-‘MediaPlayer.GetVisualizationData方法’(MSDN - ‘MediaPlayer.GetVisualizationData Method’) http://msdn.microsoft.com/zh-CN/library/microsoft.xna.framework.media.mediaplayer.getvisualizationdata.aspx(http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.mediaplayer.getvisualizationdata.aspx) (2013年4月20日访问)((Accessed 20/04/2013))
- Rm09(2010)–“了解可视化数据”:(Rm09 (2010) – ‘Understanding VisualizationData’:) http://xboxforums.create.msdn.com/forums/t/22707.aspx(http://xboxforums.create.msdn.com/forums/t/22707.aspx) (2013年4月20日访问)((Accessed 20/04/2013))
- Rose,J(2002)–“范围查找器”:(Rose, J (2002) – ‘Range Finder’:) http://www.dplay.com/tutorial/bands/index.html(http://www.dplay.com/tutorial/bands/index.html) (访问:2013年10月2日)((Accessed: 10/02/2013))
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C# Windows Dev media audio synchronize analysis game 新闻 翻译