def test_create_sinewave(self): osc = Osc('sine', freq=200.0) length = 1 out = osc.play(length) out.write('tests/renders/osc_sinewave.wav') self.assertEqual(len(out), int(length * out.samplerate)) wtA = [random.random() for _ in range(random.randint(10, 1000))] osc = Osc(wtA, freq=200.0) length = 1 out = osc.play(length) out.write('tests/renders/osc_rand_list_wt.wav') self.assertEqual(len(out), int(length * out.samplerate)) wtB = dsp.wt( [random.random() for _ in range(random.randint(10, 1000))]) osc = Osc(wtB, freq=200.0) length = 1 out = osc.play(length) out.write('tests/renders/osc_rand_wt_wt.wav') self.assertEqual(len(out), int(length * out.samplerate)) wtC = SoundBuffer(filename='tests/sounds/guitar1s.wav') osc = Osc(wtC, freq=200.0) length = 1 out = osc.play(length) out.write('tests/renders/osc_guitar_wt.wav') self.assertEqual(len(out), int(length * out.samplerate))
def test_create_sinewave(self): osc = Osc('sine', freq=200.0) length = 1 out = osc.play(length) out.write('tests/renders/osc_sinewave.wav') self.assertEqual(len(out), int(length * out.samplerate)) wtA = [ random.random() for _ in range(random.randint(10, 1000)) ] osc = Osc(wtA, freq=200.0) length = 1 out = osc.play(length) out.write('tests/renders/osc_rand_list_wt.wav') self.assertEqual(len(out), int(length * out.samplerate)) wtB = dsp.wt([ random.random() for _ in range(random.randint(10, 1000)) ]) osc = Osc(wtB, freq=200.0) length = 1 out = osc.play(length) out.write('tests/renders/osc_rand_wt_wt.wav') self.assertEqual(len(out), int(length * out.samplerate)) wtC = SoundBuffer(filename='tests/sounds/guitar1s.wav') osc = Osc(wtC, freq=200.0) length = 1 out = osc.play(length) out.write('tests/renders/osc_guitar_wt.wav') self.assertEqual(len(out), int(length * out.samplerate))
def test_harmonics(self): wt = dsp.wt('sine') wt = wt.harmonics() wt.graph('tests/renders/graph_harmonics.png', stroke=3) osc = Osc(wt, freq=80) out = osc.play(10) out.write('tests/renders/osc_harmonics.wav')
import random from pippi import dsp from pippi.oscs import Osc # Create a wavetable osc with a randomly # selected waveform type osc = Osc(freq=440, wavetable=dsp.RND) # Length in seconds length = 1 # Fill a SoundBuffer with output from the osc out = osc.play(length) * 0.5 # Write the output buffer to a WAV file out.write('simple_osc.wav')
import random from pippi.oscs import Osc waveform_types = ['square', 'sine', 'triangle', 'saw', 'rsaw', 'cosine'] # Create a wavetable osc with a randomly # selected waveform type osc = Osc(freq=440, wavetable=random.choice(waveform_types)) # Length in frames length = 44100 # Fill a SoundBuffer with output from the osc out = osc.play(length, amp=0.5) # Write the output buffer to a WAV file out.write('simple_osc.wav')
def test_create_sinewave(self): osc = Osc(dsp.SINE, random.triangular(20, 20000)) length = random.triangular(0.01, 1) out = osc.play(length) self.assertEqual(len(out), int(length * out.samplerate))
def test_create_sinewave(self): osc = Osc(random.triangular(20, 20000), wavetable='sine') length = random.randint(1, 44100) out = osc.play(length) self.assertEqual(len(out), length)