Sample code is as follows:
import numpy as np import time import sounddevice as sd def FindFreq_Resp(f_num, Amp): print "Calculating frequency response..." Freq=np.logspace(1.3, 4.3, num=f_num) for f in Freq: xx=np.linspace(0.0, 1, 48000) y=Amp*np.sin(f*2.0*np.pi*xx) myrecording = sd.playrec(y, 48000, channels=1, blocking=True) Fs=48000 FindFreq_Resp(100,0.1) print "Some memory has been eaten" FindFreq_Resp(100,0.1) print "Even more memory has been eaten" FindFreq_Resp(100,0.1) print "Not much memory left :("If I run the function enough times, it will use up all of the memory and the program will freeze :( I'm coding on a raspberry PI 1