electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Bug: is it ChucK or me?
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [6 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Fri Oct 26, 2007 12:30 am    Post subject: Bug: is it ChucK or me?
Subject description: possible bug in ChucK
Reply with quote  Mark this post and the followings unread

I have been staring at this evil bug for two hours now, would someone mind taking a look at it? I think it might be a ChucK bug because it's really simple and I just cannot figure it out. fsamples[f1] goes out of range at 8 even though it is declared to be fsamples[128]. I tried changing variable names, looking elsewhere in the file, and using constants instead of variable names with no success. I isolated it with the print statement <<< t, f1 >>>; which only counts to 8 before it crashes. I am running the command line code of chuck version: 1.2.1.0 (dracula) on Mac OS X. Thanks in advance.


CrystalFFT1.ck
 Description:
Contains a bug! Does not werk!

Download
 Filename:  CrystalFFT1.ck
 Filesize:  3.28 KB
 Downloaded:  195 Time(s)

Back to top
View user's profile Send private message Send e-mail
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Fri Oct 26, 2007 5:12 am    Post subject: Reply with quote  Mark this post and the followings unread

Very odd, I suspected it might be a different array that goes out of bound but I can't find any arrays of size 8 or smaller there? Arrays going out of bound are most often little mistakes in the ChucK program, the hard part is that ChucK doesn't tell you the *name* of the array that goes out of bound when it quits.

If you're sure that's the array you should mail Ge himself, he knows everything Smile.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Sat Oct 27, 2007 12:12 am    Post subject: Reply with quote  Mark this post and the followings unread

Yes, I am sure that is the array because when I put 0 into the index of fsamples[] it runs, but if i put f1 in it, it crashes right after printing that f1 is 8. I emailed Ge, we will see what happens. The more I think about it, the more I think its a ChucK bug.
Back to top
View user's profile Send private message Send e-mail
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Sat Oct 27, 2007 3:59 am    Post subject: Reply with quote  Mark this post and the followings unread

I found the bug! I had used .cvals() instead of .cval() to access the FFT samples. I changed it to fval() which is what I was really looking for anyway, the magnitude, and it works great now! Anyway it gave me a good reason to email Ge and send him my compliments! Cheers.
Back to top
View user's profile Send private message Send e-mail
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Oct 28, 2007 1:47 pm    Post subject: Reply with quote  Mark this post and the followings unread

Oops, my bad. I was torn between arrays going out of bound being the mistake I myself make most often and it generally being good policy to doubt ChucK especially with newer features.
_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ge



Joined: Aug 13, 2006
Posts: 108
Location: Palo Alto, CA

PostPosted: Sun Oct 28, 2007 4:15 pm    Post subject: ChucK is at fault, I think Reply with quote  Mark this post and the followings unread

Hi! In tracking things down, the problem was that upchuck() wasn't working when now is exactly 0. This has been fixed. .fvals() and .fval() access the same array, and shouldn't behave differently. If they are, then there may be another bug! Heh.

I reiterate what Kassen said: when things get really weird, doubt chuck (because it usually is due to chuck)!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [6 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use