Syllabus 20091006 hopeless

From XPUB & Lens-Based wiki

audio.sh (hopeless pt. one)

#!/bin/bash

sox -c2 -r44100 -n -t wav - synth 0.2 pinknoise vol 1.0 fade l 0 0.2 0.19 > pink.wav
sox -c2 -r44100 -n -t wav - synth 0.2 brownnoise vol 1.0 fade l 0 0.2 0.19 > brown.wav
sox -c2 -r44100 -n -t wav - synth 0.2 noise vol 1.0 fade l 0 0.2 0.19 > white.wav
sox -c1 -r8000 -n beep.wav synth 0.25 sine 220 vol 0.7

sox pink.wav --rate 44100 --bits 16 --channels 2 --encoding signed-integer pink.raw
sox brown.wav --rate 44100 --bits 16 --channels 2 --encoding signed-integer brown.raw
sox white.wav --rate 44100 --bits 16 --channels 2 --encoding signed-integer white.raw
sox beep.wav --rate 44100 --bits 16 --channels 2 --encoding signed-integer beep.raw


play.py (hopeless pt. two)

#!/usr/bin/env/python

from os import system

for i in range(4):
	system("cat pink.raw >> song.raw")
	system("cat white.raw >> song.raw")	
	system("cat brown.raw >> song.raw")

for i in range(4):
	system("cat pink.raw >> song.raw")

	for i in range(4):
		system("cat white.raw >> song.raw")

	for i in range(4):
		system("cat beep.raw >> song.raw")

	for i in range(8):
		system("cat pink.raw >> song.raw")
	
		system("cat brown.raw >> song.raw")

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