<?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: How efficient is coding objects using Java?</title>
		<atom:link href="http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/feed</link>
		<description></description>
		<pubDate>Tue, 18 Jun 2013 22:26:48 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-34303</guid>
					<title><![CDATA[How efficient is coding objects using Java?]]></title>
					<link>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-34303</link>
					<pubDate>Wed, 24 Oct 2007 14:54:11 +0000</pubDate>
					<dc:creator>Adam</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>I have just written an MSP pitch detector object in java. It works perfectly but has a very high load on the CPU. In fact, if I use a signal vector size of more than 256 it causes clicking artefacts in the audio. The code isn&#8217;t really that big and I am using a brand new intel mac book 2.2 GHz machine.</p>
<p>Is this because of some speed limitation of using mxj quickie to build java objects? How could I improve the speed?</p>
<p>I am normally a C programmer and have coded much much larger things that run in real-time as VST plug-ins for example &#8211; and they generally are not that much of a burden on the CPU. I know Java is slower than C but I didn&#8217;t expect it to be quite so limiting, is there something I am doing wrong?</p>
<p>Alternatively, if anyone could point me to a good introduction to programming Max/MSP objects in C I would be very grateful (apologies as this question prob should go in the other forum but the first question should be here&#8230;).</p>
<p>I&#8217;d be very happy if someone could point me in the right direction,</p>
<p>Many thanks,</p>
<p>Adam</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115476</guid>
					<title><![CDATA[Re: How efficient is coding objects using Java?]]></title>
					<link>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115476</link>
					<pubDate>Wed, 24 Oct 2007 17:15:58 +0000</pubDate>
					<dc:creator>topher lafata</dc:creator>

					<description>
						<![CDATA[
						<p>Java is definitely slower than C but it is possible<br />
with some care to get it running pretty efficiently.</p>
<p>I could take a look at your code if you want. Things to avoid<br />
are unnecessary object allocation, method call overhead,<br />
etc. Generally having a knowledge of what the JVM will do<br />
when it executes certain instructions.</p>
<p>I generally tend to think as if I am writing C code when writing<br />
mxj~ stuff and stay as much as possible with the primitive constructs<br />
of the java language.</p>
<p>Hope this is helpful.</p>
<p>Topher</p>
<p>
On Oct 24, 2007, at 07:54 AM, Adam Stark wrote:</p>
<p>><br />
> Hi,<br />
><br />
> I have just written an MSP pitch detector object in java. It works  <br />
> perfectly but has a very high load on the CPU. In fact, if I use a  <br />
> signal vector size of more than 256 it causes clicking artefacts in  <br />
> the audio. The code isn&#8217;t really that big and I am using a brand  <br />
> new intel mac book 2.2 GHz machine.<br />
><br />
> Is this because of some speed limitation of using mxj quickie to  <br />
> build java objects? How could I improve the speed?<br />
><br />
> I am normally a C programmer and have coded much much larger things  <br />
> that run in real-time as VST plug-ins for example &#8211; and they  <br />
> generally are not that much of a burden on the CPU. I know Java is  <br />
> slower than C but I didn&#8217;t expect it to be quite so limiting, is  <br />
> there something I am doing wrong?<br />
><br />
> Alternatively, if anyone could point me to a good introduction to  <br />
> programming Max/MSP objects in C I would be very grateful  <br />
> (apologies as this question prob should go in the other forum but  <br />
> the first question should be here&#8230;).<br />
><br />
> I&#8217;d be very happy if someone could point me in the right direction,<br />
><br />
> Many thanks,<br />
><br />
> Adam</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115477</guid>
					<title><![CDATA[Re: How efficient is coding objects using Java?]]></title>
					<link>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115477</link>
					<pubDate>Wed, 24 Oct 2007 17:23:33 +0000</pubDate>
					<dc:creator>topher lafata</dc:creator>

					<description>
						<![CDATA[
						<p>also&#8230;</p>
<p>
Using the benchmark message allows you to quantify any optimizations  <br />
that you might be making<br />
and could be helpful if you are not aware of it. See the mxj~  <br />
examples for use of the benchmark<br />
message.</p>
<p>
T</p>
<p>On Oct 24, 2007, at 07:54 AM, Adam Stark wrote:</p>
<p>><br />
> Hi,<br />
><br />
> I have just written an MSP pitch detector object in java. It works  <br />
> perfectly but has a very high load on the CPU. In fact, if I use a  <br />
> signal vector size of more than 256 it causes clicking artefacts in  <br />
> the audio. The code isn&#8217;t really that big and I am using a brand  <br />
> new intel mac book 2.2 GHz machine.<br />
><br />
> Is this because of some speed limitation of using mxj quickie to  <br />
> build java objects? How could I improve the speed?<br />
><br />
> I am normally a C programmer and have coded much much larger things  <br />
> that run in real-time as VST plug-ins for example &#8211; and they  <br />
> generally are not that much of a burden on the CPU. I know Java is  <br />
> slower than C but I didn&#8217;t expect it to be quite so limiting, is  <br />
> there something I am doing wrong?<br />
><br />
> Alternatively, if anyone could point me to a good introduction to  <br />
> programming Max/MSP objects in C I would be very grateful  <br />
> (apologies as this question prob should go in the other forum but  <br />
> the first question should be here&#8230;).<br />
><br />
> I&#8217;d be very happy if someone could point me in the right direction,<br />
><br />
> Many thanks,<br />
><br />
> Adam</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115478</guid>
					<title><![CDATA[Re: How efficient is coding objects using Java?]]></title>
					<link>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115478</link>
					<pubDate>Thu, 25 Oct 2007 13:19:09 +0000</pubDate>
					<dc:creator>Adam</dc:creator>

					<description>
						<![CDATA[
						<p>Hi Topher,</p>
<p>Thanks for your replies. It would be great if you could have a look at my code. I have attached the java file. The function causing the problems is the pitch_YIN function.</p>
<p>I also have one more question which is about C coding Max/MSP objects &#8211; so far, all the examples I have seen so far in C have been massively complex, uncommented and unexplained. The Java equivalent is so simple. Is there a simple C example somewhere or a good guide? Or is it generally complicated?</p>
<p>I&#8217;m very very appreciative of your help,</p>
<p>Thanks</p>
<p>Adam</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115479</guid>
					<title><![CDATA[Re: How efficient is coding objects using Java?]]></title>
					<link>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115479</link>
					<pubDate>Thu, 25 Oct 2007 13:45:31 +0000</pubDate>
					<dc:creator>topher lafata</dc:creator>

					<description>
						<![CDATA[
						<p>Hola<br />
I am about to get on a plane here but will check the code in the next <br />
day or so.</p>
<p>The c external api is covered in writing max/msp externals by david <br />
zicarelli.</p>
<p>It is not overly complicated. Just a little different.</p>
<p>I agree that there could be a higher level c api for externs. I was <br />
working on a similar object to mxj called cfunk that addresses these <br />
issues by allowing you to write in a similar way but in c instead of <br />
java .I have stopped development of cfunk but perhaps I will finish it <br />
up someday or someone else is interested in taking it over.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115480</guid>
					<title><![CDATA[Re: How efficient is coding objects using Java?]]></title>
					<link>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115480</link>
					<pubDate>Fri, 26 Oct 2007 15:44:43 +0000</pubDate>
					<dc:creator>volker böhm</dc:creator>

					<description>
						<![CDATA[
						<p>hi adam,<br />
the reason why your code is slow is not due to the language (at least  <br />
not entirely), but to the fact that you try to calculate<br />
the square difference function in the time domain. in the nested for- <br />
loops you are doing a lot of calculations&#8230;<br />
this wouldn&#8217;t be efficient in C either.<br />
but using FFT you can easily calculate the auto-correlation much  <br />
quicker.<br />
i believe that&#8217;s the trick other yin-pitchtrackers use.</p>
<p>volker.</p>
<p>On 25 Oct 2007, at 15:19, Adam Stark wrote:</p>
<p>> Hi Topher,<br />
><br />
> Thanks for your replies. It would be great if you could have a look  <br />
> at my code. I have attached the java file. The function causing the  <br />
> problems is the pitch_YIN function.<br />
><br />
> I also have one more question which is about C coding Max/MSP  <br />
> objects &#8211; so far, all the examples I have seen so far in C have  <br />
> been massively complex, uncommented and unexplained. The Java  <br />
> equivalent is so simple. Is there a simple C example somewhere or a  <br />
> good guide? Or is it generally complicated?<br />
><br />
> I&#8217;m very very appreciative of your help,<br />
><br />
> Thanks<br />
><br />
> Adam<br />
>
<pitch_yin .java></pitch_yin></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115481</guid>
					<title><![CDATA[Re: How efficient is coding objects using Java?]]></title>
					<link>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115481</link>
					<pubDate>Fri, 26 Oct 2007 16:02:15 +0000</pubDate>
					<dc:creator>Adam</dc:creator>

					<description>
						<![CDATA[
						<p>Hi volker,</p>
<p>Yes, that is a good suggestion and would make it run much faster. I also found another problem. This is maybe very obvious to more experienced Java users but I am new to using Java for signal processing: I found that, in my loop, when I calculated the square of a number using:</p>
<p>Math.pow(x,2);</p>
<p>my function took 19ms to do it&#8217;s calculations. However, when I used:</p>
<p>x*x</p>
<p>the processing time was reduced to just 3ms.</p>
<p>Anyway, thank you everyone for your help,</p>
<p>Adam</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115482</guid>
					<title><![CDATA[Re: How efficient is coding objects using Java?]]></title>
					<link>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115482</link>
					<pubDate>Fri, 26 Oct 2007 16:19:33 +0000</pubDate>
					<dc:creator>Joshua Kit Clayton</dc:creator>

					<description>
						<![CDATA[
						<p></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115483</guid>
					<title><![CDATA[Re: How efficient is coding objects using Java?]]></title>
					<link>http://cycling74.com/forums/topic/how-efficient-is-coding-objects-using-java/#post-115483</link>
					<pubDate>Fri, 26 Oct 2007 16:35:02 +0000</pubDate>
					<dc:creator>topher lafata</dc:creator>

					<description>
						<![CDATA[
						<p>I still haven&#8217;t found a spot to view your attachment but that makes <br />
sense. Method call overhead in tight loops adds up and the java Math <br />
library is typicaly slow on top of that. In the mxj~ noise examples you <br />
wil see I opted to write my own random fucntion instead of using <br />
Math.nextfloat. It seems like you are able to make use of the <br />
benchmarking stuff as well. Kudos.</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

