User:Farrah Shakeel/Assignments1/sox

From XPUB & Lens-Based wiki

Downloaded Sounds from freesound.org

  • extracted sound samples from longer files with ffmpeg:
ffmpeg -i filename.wav -ss 00:00:10 -t 00:00:15 newfilename.wav
# take input file, skip so much time, and extract thereon so much time, and save as this filename.

ffmpeg -i filename.wav -t 00:00:15 newfilename.wav
# take input file, extract so much time from the beginning of the audio, and save as this filename.


Example of a "sequential" loop:

  • click on attachment "india.wav"


from os import system

for i in range(2):
	system("cat bus-india.raw >> india.raw")
	system("cat amb-siren.raw >> india.raw")
	system("cat india-sound.raw >> india.raw")
	

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

system("play india.wav")
system("rm india.raw")



Example of a "nested" loop:

  • click on attachment "laughs.wav"


from os import system


for i in range(2):
	system("cat laugh1.raw >> laughs.raw")
	system("cat laugh2.raw >> laughs.raw")
	system("cat laugh3.raw >> laughs.raw")
	system("cat laugh4.raw >> laughs.raw")
		
	for i in range(2):
		system("cat laugh5.raw >> laughs.raw")
		system("cat laugh6.raw >> laughs.raw")
		system("cat laugh7.raw >> laughs.raw")


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


Attachments