def playOne(self,buff,fs,pan=0): """ Joue le son correspondant au signal "buff", à la fréquence d'échantillonnage "fs". """ import audiere from time import sleep print audiere.get_devices() d = audiere.open_device() s = d.open_array(buff,fs) s.pan = pan s.play() while s.playing: sleep(.01)
def play(self,buffs,fs,pan=0): """ Joue successivement les sons correspondants aux signaux stockés dans la matrice "buffs", à la fréquence d'échantillonnage "fs". """ import audiere from time import sleep print audiere.get_devices() d = audiere.open_device() sons = [d.open_array(buff,fs) for buff in buffs] for son in sons: son.play() while son.playing: sleep(0.01)
def __init__(self, mode="max", prescale=1): devices = audiere.get_devices() if "oss" in devices: self.device = audiere.open_device("oss") elif "alsa" in devices: self.device = audiere.open_device("alsa") else: raise RuntimeError("no suitable audio device found!") self.mode = mode self.channels = numpy.zeros((CRATES, SLOTS, CHANNELS), dtype=numpy.float32) self.prescale = numpy.ones_like(self.channels) * prescale self.speakers = numpy.empty_like(self.channels, dtype=object) self.speakers[:, :, :] = VRateSpeaker(self.channels, prescale)
def __init__(self, mode='max', prescale=1): devices = audiere.get_devices() if 'oss' in devices: self.device = audiere.open_device('oss') elif 'alsa' in devices: self.device = audiere.open_device('alsa') else: raise RuntimeError('no suitable audio device found!') self.mode = mode self.channels = numpy.zeros((CRATES, SLOTS, CHANNELS), dtype=numpy.float32) self.prescale = numpy.ones_like(self.channels) * prescale self.speakers = numpy.empty_like(self.channels, dtype=object) self.speakers[:, :, :] = VRateSpeaker(self.channels, prescale)
def __init__(self): self.playlist = [] #try: print(audiere.get_devices())