<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: python pyext audio crash</title>
		<atom:link href="http://cycling74.com/forums/topic/python-pyext-audio-crash/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/python-pyext-audio-crash/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 20:25:28 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-35105</guid>
					<title><![CDATA[python pyext audio crash]]></title>
					<link>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-35105</link>
					<pubDate>Mon, 24 Dec 2007 08:39:57 +0000</pubDate>
					<dc:creator>jcobbett</dc:creator>

					<description>
						<![CDATA[
						<p>hey all:</p>
<p>I have my first pyext object working in a patch. hooray. it&#8217;s working fine. It&#8217;s very simple. It makes a list of ints and sends them out one at a time. The idea is to send the ints to mtof and then into one of my msp synths. I have abstractions that can do this, but I thought it would be more elegant (and a great learning tool for both max and python) to write my abstractions using py/pyext. </p>
<p>The problem is when I turn on the audio. max crashes immediately every time. The script is just sending out integers&#8230; why would that crash the audio? simply pulling in an ezdac~ and turing it on crashes max, without even connecting it to anything.</p>
<p>My other audio patches work fine. I&#8217;m using 4.5, with an iMac g5.</p>
<p>Thanks!!</p>
<p>Here is the pyext code (class Scale is in a separate doc):<br />
######################################<br />
try:<br />
	import pyext<br />
except:<br />
	print &#8220;ERROR: This script must be loaded by the PD/Max pyext external&#8221;<br />
from scrale import Scale<br />
from random import randrange as randy<br />
class riff(pyext._class):<br />
    count = 0<br />
    length = 4<br />
    sclea = []<br />
    pattern = []<br />
    _inlets=3<br />
    _outlets=2<br />
    def makeriff_2(self, root, mode, length):<br />
        print &#8220;we are now in func &#8216;makescale&#8217;&#8221;<br />
        t=Scale(root)<br />
        mode = str(mode)</p>
<p>        self.length = length</p>
<p>        if mode == &#8220;major&#8221;:<br />
            self.sclea = t.major()<br />
            print &#8220;major is %s&#8221;  % t.major()</p>
<p>        elif mode == &#8220;minor&#8221;:<br />
            self.sclea = t.minor()<br />
            print &#8220;%s is: %s&#8221; % (mode, self.sclea)</p>
<p>        elif mode == &#8220;dorian&#8221;:<br />
            self.sclea = t.dorian()<br />
            print &#8220;%s is: %s&#8221; % (mode, self.sclea)</p>
<p>        elif mode == &#8220;mixolydian&#8221;:<br />
            self.sclea = t.mixolydian()<br />
            print &#8220;%s is: %s&#8221; % (mode, self.sclea)</p>
<p>        elif mode == &#8220;phrygian&#8221;:<br />
            self.sclea = t.phrygian()<br />
            print &#8220;%s is: %s&#8221; % (mode, self.sclea)</p>
<p>        else:<br />
            self.sclea = t.crom<br />
            print &#8220;%s is: %s&#8221; % (mode, self.sclea) </p>
<p>        for i in range(self.length):<br />
            self.pattern.append( randy(len(self.sclea)))</p>
<p>    def bang_1(self):</p>
<p>
        self._outlet(1, self.sclea[self.pattern[self.count]])</p>
<p>        if self.count < self.length - 1:<br />
            self.count +=1<br />
        else:<br />
            self.count = 0</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119266</guid>
					<title><![CDATA[Re: python pyext audio crash]]></title>
					<link>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119266</link>
					<pubDate>Mon, 24 Dec 2007 08:52:28 +0000</pubDate>
					<dc:creator>jcobbett</dc:creator>

					<description>
						<![CDATA[
						<p>python and indents&#8230; here</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119267</guid>
					<title><![CDATA[Re: python pyext audio crash]]></title>
					<link>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119267</link>
					<pubDate>Mon, 24 Dec 2007 10:44:47 +0000</pubDate>
					<dc:creator>gr@grrrr.org</dc:creator>

					<description>
						<![CDATA[
						<p>Hi John,<br />
my guess is that you have overdrive turned on. There are known problems <br />
with the py object and overdrive, but it&#8217;s on my todo list to resolve them.</p>
<p>A few more things:<br />
- You are setting a few variables (like pattern) in the class scope. <br />
This is probably not what you want, because the variables will be shared <br />
among multiple instances of your class (e.g. multiple py/pyext objects <br />
using the same script. You should initialize instance specific variables <br />
in __init__.</p>
<p>- In your Python script you are defining the number of inlets and <br />
outlets in the class. This is deprecated&#8230; it should be defined with <br />
the object, like [pyext 3 2 myscript.riff  myargs(</p>
<p>- You could instead of converting the mode argument to str compare it to <br />
symbols, as in "if mode == pyext.Symbol('major')", and even cache these <br />
symbols at script initialization.</p>
<p>gr~~~</p>
<p>John Cobbett schrieb:<br />
> hey all:<br />
><br />
> I have my first pyext object working in a patch. hooray. it's working fine. It's very simple. It makes a list of ints and sends them out one at a time. The idea is to send the ints to mtof and then into one of my msp synths. I have abstractions that can do this, but I thought it would be more elegant (and a great learning tool for both max and python) to write my abstractions using py/pyext. <br />
><br />
> The problem is when I turn on the audio. max crashes immediately every time. The script is just sending out integers... why would that crash the audio? simply pulling in an ezdac~ and turing it on crashes max, without even connecting it to anything.<br />
><br />
> My other audio patches work fine. I'm using 4.5, with an iMac g5.<br />
><br />
> Thanks!!<br />
><br />
> Here is the pyext code (class Scale is in a separate doc):<br />
> ######################################<br />
> try:<br />
> 	import pyext<br />
> except:<br />
> 	print "ERROR: This script must be loaded by the PD/Max pyext external"<br />
> from scrale import Scale<br />
> from random import randrange as randy<br />
> class riff(pyext._class):<br />
>     count = 0<br />
>     length = 4<br />
>     sclea = []<br />
>     pattern = []<br />
>     _inlets=3<br />
>     _outlets=2<br />
>     def makeriff_2(self, root, mode, length):<br />
>         print &#8220;we are now in func &#8216;makescale&#8217;&#8221;<br />
>         t=Scale(root)<br />
>         mode = str(mode)<br />
>         <br />
>         self.length = length<br />
>         <br />
>         if mode == &#8220;major&#8221;:<br />
>             self.sclea = t.major()<br />
>             print &#8220;major is %s&#8221;  % t.major()<br />
>             <br />
>         elif mode == &#8220;minor&#8221;:<br />
>             self.sclea = t.minor()<br />
>             print &#8220;%s is: %s&#8221; % (mode, self.sclea)<br />
>             <br />
>         elif mode == &#8220;dorian&#8221;:<br />
>             self.sclea = t.dorian()<br />
>             print &#8220;%s is: %s&#8221; % (mode, self.sclea)<br />
>             <br />
>         elif mode == &#8220;mixolydian&#8221;:<br />
>             self.sclea = t.mixolydian()<br />
>             print &#8220;%s is: %s&#8221; % (mode, self.sclea)<br />
>             <br />
>         elif mode == &#8220;phrygian&#8221;:<br />
>             self.sclea = t.phrygian()<br />
>             print &#8220;%s is: %s&#8221; % (mode, self.sclea)<br />
>             <br />
>         else:<br />
>             self.sclea = t.crom<br />
>             print &#8220;%s is: %s&#8221; % (mode, self.sclea) <br />
>         <br />
>         for i in range(self.length):<br />
>             self.pattern.append( randy(len(self.sclea)))<br />
><br />
>     def bang_1(self):<br />
>         <br />
>         <br />
>         self._outlet(1, self.sclea[self.pattern[self.count]])<br />
><br />
>         if self.count < self.length - 1:<br />
>             self.count +=1<br />
>         else:<br />
>             self.count = 0<br />
>         <br />
><br />
>     <br />
>     <br />
><br />
>     <br />
><br />
>     <br />
><br />
>         <br />
><br />
><br />
><br />
>   </p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119268</guid>
					<title><![CDATA[Re: python pyext audio crash]]></title>
					<link>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119268</link>
					<pubDate>Mon, 24 Dec 2007 22:57:33 +0000</pubDate>
					<dc:creator>jcobbett</dc:creator>

					<description>
						<![CDATA[
						<p>Hey gr you are the one behind py/pyext right? Thanks! Also thanks for the advice! It&#8217;s difficult to find info/examples on py/ext &#8211; especially at the beginner level so it&#8217;s been trial and error all the way&#8230;</p>
<p>-John C.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119269</guid>
					<title><![CDATA[Re: python pyext audio crash]]></title>
					<link>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119269</link>
					<pubDate>Mon, 24 Dec 2007 23:19:39 +0000</pubDate>
					<dc:creator>gr@grrrr.org</dc:creator>

					<description>
						<![CDATA[
						<p>John Cobbett schrieb:<br />
> Hey gr you are the one behind py/pyext right? Thanks! Also thanks for the advice! It&#8217;s difficult to find info/examples on py/ext &#8211; especially at the beginner level so it&#8217;s been trial and error all the way&#8230;<br />
>   <br />
Yes and yes&#8230;. py/pyext has originally been made for Pure Data&#8230; its <br />
existence for Max/MSP is only a by-product, therefore it&#8217;s badly documented.<br />
In case you are interested in better documentation, you are very much <br />
invited to install Pure Data, learn from the help patches and transfer <br />
them to Max.<br />
I&#8217;m happy to help in case of other questions&#8230; did switching off <br />
overdrive help?</p>
<p>gr~~~</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119270</guid>
					<title><![CDATA[Re: python pyext audio crash]]></title>
					<link>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119270</link>
					<pubDate>Tue, 25 Dec 2007 07:05:38 +0000</pubDate>
					<dc:creator>jcobbett</dc:creator>

					<description>
						<![CDATA[
						<p>Ok problem solved. turning overdrive off didn&#8217;t fix the problem. what solved it was &#8220;deglobalizing&#8221; all the variables in my script and putting them in __init__ like you advised &#8211; then it worked fine. Interesting&#8230;   Thanks again!</p>
<p>-JC</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119271</guid>
					<title><![CDATA[Re: python pyext audio crash]]></title>
					<link>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119271</link>
					<pubDate>Tue, 05 Feb 2013 10:21:08 +0000</pubDate>
					<dc:creator>Sefie</dc:creator>

					<description>
						<![CDATA[
						<p>I know raping corpses etc. but I&#8217;m having the same problem in PureData and was hoping maybe someone might know how to tell me what &#8220;deglobalizing&#8221; means. Here my code of a class that needs to be reinstanciated quite a lot with different values:</p>
<p>class NoteObject(pyext._class):<br />
	&#8220;&#8221;"The NoteObject class handles everything needed to model a note&#8221;"&#8221;</p>
<p>	# number of inlets and outlets<br />
	_inlets=1<br />
	_outlets=6</p>
<p>	#variables &#8211; at some point I should decide for either system&#8230;<br />
	pitch = 60<br />
	vel = 127 #velocity<br />
	channel = 1<br />
	duration = 1.0 / 4 #in beats<br />
	timestamp = 0 #in measures</p>
<p>	#and by all these powers combined we have:<br />
	quintuple = array(&#8216;f&#8217;, [pitch, vel, channel, duration, timestamp])<br />
	quinnames = ["pitch", "vel", "channel", "duration", "timestamp"]</p>
<p>	# methods for first inlet</p>
<p>	#set a quint value based on the index or parameter name f1 and the set value f2<br />
	def quint(self, f1, f2):<br />
		import types<br />
		i = -1<br />
		if isNumber(f1):<br />
			i = int(f1)<br />
		else:<br />
			i = self.quinnames.index(str(f1))<br />
		if (not i == -1) and isNumber(f2):<br />
			self.quintuple[i] = f2<br />
			if i == 0:<br />
				self.pitch = f2<br />
			elif i == 1:<br />
				self.vel = f2<br />
			elif i == 2:<br />
				self.channel = f2<br />
			elif i == 3 and (f2 > 0):<br />
				self.duration = 1.0 / f2<br />
				self.quintuple[i] = self.duration<br />
			elif i == 4:<br />
				self.timestamp = f2<br />
			#print &#8220;quintuple[",i,"] and &#8220;,self.quinnames[i],&#8221; set to &#8220;, self.quintuple[i]</p>
<p>	#put a list of up to 5 parameters into the quintuple<br />
	def setquintuple_1(self,*s):<br />
		for i in range(len(s)):<br />
			self.quint(i, s[i])<br />
			if i > 5:<br />
				print &#8220;Too many arguments to put in a quintuple&#8221;<br />
				break</p>
<p>	#output the quintuple individually to the outlets 2-6 and the whole to the 1th as well as to the log<br />
	def getquintuple_1(self):<br />
		self._outlet(1, self.quintuple)</p>
<p>	#sets the element f1 in the quintuple to f2 with a &#8220;set f f&#8221;-message to i1<br />
	def set_1(self, f1, f2):<br />
		self.quint(f1,f2)</p>
<p>	#hinders potentially pending note-offs<br />
	def nonoteoff_1(self):<br />
		self._outlet(1, &#8220;nonoteoff&#8221;)</p>
<p>	#compares handed list to self.quintuple and takes appropriate action<br />
	def compare_1(self, *f):<br />
		#print &#8220;comparing &#8220;, f, &#8220;to quintuple &#8220;, self.quintuple<br />
		if len(f)==5:<br />
			#I know this is no good style. I was planning for feedback per step<br />
			if f[2] == self.quintuple[2]:<br />
				if f[0] == self.quintuple[0]:<br />
					if self.quintuple[3] > 0:<br />
						if f[4] > self.quintuple[4]:<br />
							self._outlet(1, &#8220;nonoteoff&#8221;)<br />
							print &#8220;killed note-off of &#8220;, self.quintuple<br />
		else:<br />
			print &#8220;this is not even comparable&#8221;	</p>
<p>	#helper function &#8211; determine whether argument is a numeric type<br />
	def isNumber(value):<br />
		import types<br />
		if type(value) in (types.FloatType, types.IntType, types.LongType):<br />
			return 1<br />
		else:<br />
			return 0</p>
<p>	#Constructor &#8211; sets the values put in as args to the quintuple etc<br />
	def __init__(self,*args):<br />
		for i in range(len(args)):<br />
			self.quint(i, args[i])</p>
<p>As you see I put the argument values to the variables in the constructor, so each and every instance should have its own values. But whenever I call any method but setquintuple() the called method works on the variables of the last set instance.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119272</guid>
					<title><![CDATA[Re: python pyext audio crash]]></title>
					<link>http://cycling74.com/forums/topic/python-pyext-audio-crash/#post-119272</link>
					<pubDate>Thu, 07 Feb 2013 22:11:45 +0000</pubDate>
					<dc:creator>Timothy Place</dc:creator>

					<description>
						<![CDATA[
						<p>FYI, you can wrap your code in html &#8220;pre&#8221; tags if you want to maintain formatting and indenting.</p>
<p>Cheers</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

