zoukankan      html  css  js  c++  java
  • 项目1: 额外函数说明

    Project 1: Specification of Additional Functions

    项目1:额外函数说明

    Note: all mono → stereo functions should return a new array, rather than trying to work in-place.

    注意:所有的单声道多声道函数应该返回一个新数组,而不是在原数组中操作。

    equal_scale(freq, amp, dur, sampler=sin_sample)

    Return an ascending chromatic scale starting on freq where each tone is dur seconds long. A short silence should be inserted between notes. The function sampler may optionally(随意地) be passed into the function to determine which waveform should be used (if none is passed, sin_sample you wrote earlier is used).

    返回一个上升的半音音阶开始于freq频率,其中每个声调持续dur秒。在音符间应该插入一个短暂的静音。函数采样器可以随意地传递到函数来决定哪个哪个波形该被使用(如果传递none,早些时候你写的sin_sample将被使用)

    A chromatic scale(半音音阶) is a 12-tone scale. In equal temperament, each note(音符)is equally spaced up the octave. An octave is reached when the frequency doubles. It follows, then, that the i-th note of the scaled is

    f(i) = freq*2^(i/12)

    Note that, despite being a 12-tone scale, the last note is a repeat of the first, but an octave higher. So, in total there will be 13 tones.

    半音音阶是12个音级组成。在十二平均乐律中,每个音符相等地划分八度音阶。当频率为2倍时为一个八度音阶。如下所示,第i个调整音符为

    f(i) = freq*2^(i/12)      ^相当于**

    注意,除了为12个音级,最后一个音符是第一个的重复,但是高一个八度音符。因此,总共有13个音符。

    百度知道:

    请问八度音阶在频率变化上有什么规律?

    第一个问题:八度音的频率关系。

    每相邻的两个半音,高音频率是低音频率的“21/12次方倍”。

    例如国际标准音A的频率是440HZ,那么比它高半音的bB,频率就是:

    440*2^(1/12)=466.13HZ

    所以,以此类推,一个八度的12个音,连乘下来,结果正好得2。通俗一点儿也就是说,高音1的频率是比他低一个八度的那个1的频率的两倍。

    第二个问题:不同乐器的同一个音的振动频率是否相同。

    大至相同,但有微小的差别。比如吉他的国际标准音A的频率是440HZ,而小提琴的这个A就用441HZ

    Project 1: Specification of Additional Functions 翻译+部分解释 - 牛皮糖 - 牛皮糖的旅程

    ring_modulate(s1, s2)

    This function takes two waves and computes their ring modulation. The ring modulation is the product of the two input waves.

    In order to calculate the ring modulation of the given waves, each wave is first scaled so that the samples range from 0 to 1. Each pair of corresponding sample is multiplied, and then scaled back to the original range of values (hint: use WAVE_MAX).

    该函数获取两个声波并计算它们的环形调制,环形调制是两个输入声波的结果。

    为了计算给定声波的每个声波的环形调制,首先进行调节以便于采样值范围从01.每对相应的样本相乘,然后调整回原始的值范围(提示:使用WAVE_MAX

    环行调制(Ring Modulation)简介

    环行调制(Ring Modulation)当调制技术直接作用于载波振荡器的振幅输入时,这种调制技术被称为环行调制。环行调制在英文中还有其他的一些名称BalancedModulationDouble-sidebandDSBModulation。在环行调制中,载波体振荡器的振幅只是由调制信号决定的。因此,当调制信号的振幅是0,那么整个环行调制Instrument的输出也只能是0,这个特证是环行调制区别于振幅调制的最明显的一点。  尽管环行调制作用于载波振幅,但它却经常用来改变声音的频率。环行调制与AM的情况有些类似,所不同的是输出结果并不包含原有的声音。当把载波体和调制体两种频率输送到环形调制器的输入端口中时,人们只能听到两个频率的组合音--和音或差音(即从FC+FMFC-FM中获得的边频),而原有的输入信号(FCFM)不会在输出中出现,从而使人们可以创造出全新的声音。

        因此说,环形调制的原理是将两个不同频率的声音信号组合起来,制造出额外的泛音。载波体为正弦波1000Hz,调制体为正弦波750Hz,所输出的频率应分别是差音250Hz与和音1750Hz,而没有原来的载波体频率。环行调制的输出有两个重要特征,一个是输出的音色一般不会是谐和的,也不会与其他任何输入谐和地相连,除非是在极少见的情况下。而且重要的是,两个输入信号都不通向输出。另一个特征是,如果两个输入中任何一个是处在零音量上,输出也同样是处在零上。因为在内部,两个输入波形是相乘的关系。

    我们再看一个例子,如要是把一个300Hz的正弦音输入到端口A,另一个220Hz的正弦音输入到端口B,我们会听到300+220=520Hz的和音和300-220=80Hz的差音。

        但这只是环行调制的“第一次序”组合音,环行调制同样也能产生由其他音组成的“第二次序”音,它在第一次序音的和与关差的基础之上构成,依次类推。按理论,第二次序各音应如下面所示:

        第二序音之和音(Hz300+520=820220+520=740300+80=380220+80=300第二次序音之差音(Hz300-80=220220-80=140在实践中,第二次序各音比第一次序组合音要微弱得多,但却足以影响音色。重要的是,环行调制器只在两个正弦音中就能有效产生八个不同强度。因此大大起到了修饰作用。

        其实,上面的例子只是一个简单的情况,在实际操作中,要输送到环行调制器每一个端口好几个音,使之产生带有丰富效果的多样化的组合音响。而且,只要旨输入的诸相关音量略加改动,输出的音色就会产生强烈的变化。在后来的应用中,方波或锯齿波这样复杂的信号也输送到环形调制器中,以便产生极其稠密的音响。这里的危险是,一旦出现变形,各种效果就变得难以区别。

    Project 1: Specification of Additional Functions 翻译+部分解释 - 牛皮糖 - 牛皮糖的旅程

    fade_out(data, amount=.1)

    This function takes in an array of samples and implements a fading out effect over the last “amount” percent of the samples. The scaling function may be any decreasing curve, however a straightforward approach is to use a linear function. It may also be interesting to try this with an exponential function.

    该函数或缺一个数组样本并且实现一个淡出效果在样本上的最后“总量”百分比。调整函数可以是任何递减曲线,然而一个简单的方法是使用线性函数。尝试用指数函数也是很有趣的。

    Project 1: Specification of Additional Functions 翻译+部分解释 - 牛皮糖 - 牛皮糖的旅程

    repeat(data, count, scale_func=None)

    This function takes a signal data and repeats it count times. Note that count is the actual number of times the sound plays, so if count == 2, then the resulting wave has the original in it twice.

    Optionally, a scaling function may be provided. If scale_function is provided, it should be a function that takes a sample number and returns a constant factor by which to scale that sample. Be careful about clipping if the scaling factor is greater than 1. The scaling includes the first instance of the wave.

    If no scaling function is provided (i.e. scaling_func == None), then no scaling is applied, repeating simply the original values.

    Examples of scaling functions include linear (i.e. could be something similar to fade_out), or cyclical (based on trig functions).

    该函数采取一个信号data并重复count次数。注意count是一个声音播放的实际数目,因此如果count==2,那么产生的声波有两个原始声波。

    可选择地,可以提供一个调节函数。如果提供了scale_function,那么它应该采取一个样本数量并返回用来调节样本的不变因素。注意clipping调节因素是否比1大。调节包括了第一个声波实例。

    如果没有提供调节函数(也就是scaling_func == None),那么没有调节函数被应用,简单地重复原始声波。

    Project 1: Specification of Additional Functions 翻译+部分解释 - 牛皮糖 - 牛皮糖的旅程

    sweep(mono_data, start)

    This function takes a mono signal and “sweeps” it linearly across the stereo spectrum. If start is 0, it should move left to right, and if it is 1, then right to left.

    The pan should move evenly throughout the sound, using the sin/cos pan calculations shown in the stereo description.

    该函数采取一个单声道信号,并且线性地“扫描”穿过立体声谱。如果start0,那么它应该从左移动到右,如果是1,那么从右移动到左。

    Project 1: Specification of Additional Functions 翻译+部分解释 - 牛皮糖 - 牛皮糖的旅程

    splatter(mono_data, count, duration)

    This function takes as input a mono wave. The wave is repeated count times, creating a wave that is duration seconds in length.

    The repetitions happen at random intervals and may overlap. Each repetition should have a random pan and a random scaling factor from 0 to 1. The results are combined into a single wave.

    For example, a single frog croak as input could be made to sound like a scene from a pond with frogs all around croaking.

    This is the most challenging primitive, but arguably also has the most interesting results.

    该函数读取一个单声道声波作为输入。该声波被重复count次,创建一个长度为duration秒的声波。

    重复以随机间隔发生并可能重叠。每个重复应该有一个随机位置并且有一个从01的随机调节因素。这些结果合并到一个声波中。

    例如,单个蛙叫声作为输入可以做成听起来像一个池塘边的蛙叫声的场景。

    Example: Croak    Splattered Croak

    None
  • 相关阅读:
    Conventional and Direct Path Loads
    [转]Oracle DB RMAN 简单配置
    [转]Oracle DB 使用快速恢复区
    增量备份,11g052题目解析
    [转]Oracle DB 使用RMAN执行恢复
    [转]Oracle DB 备份和恢复的概念
    [转]Oracle DB 管理数据并发处理
    [转]Oracle DB管理内存
    [转]Oracle 并行原理与示例总结
    [转]Oracle DB审计
  • 原文地址:https://www.cnblogs.com/yuxc/p/2061843.html
Copyright © 2011-2022 走看看