def clicked_cb(button, c): python_array = [1000, # this need be the instrument number 0.0, 2.0] csnd_array = csnd6.doubleArray(len(python_array)) for n in range(len(python_array)): csnd_array[n] = python_array[n] print python_array c.ScoreEvent('i', csnd_array, len(python_array))
def clicked_cb(button, c): python_array = [ 1000, # this need be the instrument number 0.0, 2.0 ] csnd_array = csnd6.doubleArray(len(python_array)) for n in range(len(python_array)): csnd_array[n] = python_array[n] print(python_array) c.ScoreEvent('i', csnd_array, len(python_array))
def score_event(self, eventType, pvals, absp2mode=0): """Send a score event to csound""" if self._client_addr: print("Not supported for client interface. Use send_score()") return if not use_ctypes: print("score_event() not available without ctypes.") n = len(pvals) if self._myfltsize == 8: pfields = csnd6.doubleArray(n) else: pfields = csnd6.floatArray(n) for i in xrange(n): pfields[i] = pvals[i] self._cs.ScoreEvent(absp2mode, eventType, n, pfields)
def get_table_data(self, t): '''Get the values of a Csound f-table as a list''' if self._client_addr: print("Operation not supported for client interface") return length = self._cs.TableLength(t) if length < 0: raise (ValueError("ftable number %d does not exist!" % (num))) tabarray = csnd6.doubleArray(length) self._cs.TableCopyOut(t, tabarray) table = [] if use_ctypes: if self._myfltsize == 8: flttype = np.float32 else: flttype = np.float64 table = np.fromiter(tabarray, dtype=flttype, count=length) else: for i in xrange(length): table.append(tabarray[i]) return table
def get_table_data(self, t): """Get the values of a Csound f-table as a list""" if self._client_addr: print("Operation not supported for client interface") return length = self._cs.TableLength(t) if length < 0: raise (ValueError("ftable number %d does not exist!" % (num))) tabarray = csnd6.doubleArray(length) self._cs.TableCopyOut(t, tabarray) table = [] if use_ctypes: if self._myfltsize == 8: flttype = np.float32 else: flttype = np.float64 table = np.fromiter(tabarray, dtype=flttype, count=length) else: for i in xrange(length): table.append(tabarray[i]) return table