## Project 1: Specification of Additional Functions

square_sample(freq, amp, dur)

This function returns a square wave with frequency freq, amplitude amp, and duration dur (in seconds). The amplitude should be specified with a range of 0 to 1 where 1 represents the maximal amplitude. To obtain the actual amplitude in the sample use the WAVE_MAX value to scale it to an appropriate value.

See http://en.wikipedia.org/wiki/Image:Waveforms.svg for an illustration.

sawtooth_sample(freq, amp, dur)

This function returns a sawtooth wave with frequency freq, amplitude amp, and duration dur (in seconds). The amplitude should be specified with a range of 0 to 1 where 1 represents the maximal amplitude. To obtain the actual amplitude in the sample use the WAVE_MAX value to scale it to an appropriate value.

See http://en.wikipedia.org/wiki/Image:Waveforms.svg for an illustration.

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).

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

This function is essentially the same as the scale in equal temperment, except that the frequency multipliers should be the ones provided in the ratios list.

—-

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

This function produces an ascending partch scale. This scale contains 43 tones which are calculated using the ratios in the ratios list.

The scale is not found in classical music, but rather in the electronic music of Harry Partch. Even to most musicians this scale will sound unfamiliar.        