Syllabus 20091006 Emanuele

From XPUB & Lens-Based wiki
from os import system
import time

system('sox -c2 -r44100 -n -t wav - synth 0.2 pinknoise vol 1.0 fade l 0 0.2 0.19 > pink.wav')
system('sox -c2 -r44100 -n -t wav - synth 0.2 brownnoise vol 1.0 fade l 0 0.2 0.19 > brown.wav')
system('sox -c2 -r44100 -n -t wav - synth 0.2 noise vol 1.0 fade l 0 0.2 0.19 > white.wav')
system('sox -c2 -r44100 -n silence.wav synth 0.2 noise vol 0.0')
system('sox pink.wav --rate 44100 --bits 16 --channels 2 --encoding signed-integer pink.raw')
system('sox brown.wav --rate 44100 --bits 16 --channels 2 --encoding signed-integer brown.raw')
system('sox white.wav --rate 44100 --bits 16 --channels 2 --encoding signed-integer white.raw')
system('sox silence.wav --rate 44100 --bits 16 --channels 2 --encoding signed-integer silence.raw')

n=1
f=8

for i in range(8):
    system("cat pink.raw >> song1.raw")
    for i in range(n):
	system("cat brown.raw >> song1.raw")
	for i in range(f):
            system("cat silence.raw>>song1.raw")
        
    n=n+1
    f=f/2

n=8

for i in range(8):
    system("cat pink.raw >> song1.raw")
    
    for i in range(n):
	system("cat brown.raw >> song1.raw")
	for i in range(f)"
            system("cat silence.raw>>song1.raw")    
    n=n-1
    f=f*2



system("sox --rate 44100 --bits 16 --channels 2 --encoding signed-integer song1.raw song1.wav")
system("rm song1.raw")
system("play song1.wav")


Attachments