PDA

View Full Version : artist with odd programming problem




Aprilleglo
Jan 21, 2005, 05:48 PM
Dear scripters, programer who might know how to Fix my problem

I am an installation artist working with a composer and scientist to make music from the movement of a candle. I gotten most everything I need done with applescript.
I have been able to pull off high contrast gifs for each still in a clip in final cut, then recursively process each still and histograms in photoshop to store a series of integer values in Excel. When I graph my data in the Excel both my collaborators agree it looks like sound. That's great but.... The problem is that to make music from the data the composer needs it in the form of a sound file. I need a hack to get my data written as a AIFF sound file. I have been researching for months on the file format and conceptually it's easy, I know everything I need for the header and the sound data is just my signed integers that I have already calculated but in a binary structured format.

Here rests the problem, Applescript does't handle binary I/O. I been trying to use Xcode to write a program to write the correct structures for the header and data to disk with no luck. I know enough C to follow source code (although I haven't programed in C in twenty years) but I am so lost trying to understand how to use Xcode/Carbon file management that I can't seem to get off the ground. (the old fprintf() just doesn't fly). I discovered in the API for Quicktime that there is call for making a AIFF header but I don't see it when I look at the quicktime scripting dictionary.

In a perfect world I would like to able pass the header parameters to quicktime and let it make my header(which is the more compex structure) and have a C function that I can call inside my applescript loop as I process each still to which pass my current integer value and the filename and it will place the integer in the correct sound data structure and append it to the file.

Any help on using quicktime APL calls or sample Xcode source code on writing binary files that I could try to use to figure out how to write to disk using carbon... I have read thru all the tutorials and apple documention I could find but none seem to address my problem (but if you know of one I would love to have the link) I know there is some elementary concept I not grasping but I have been working on this for months and I stuck.....

Thanks for your help in advance



AirFoil
Jan 24, 2005, 10:20 PM
Instead of fprint() have you tried fwrite()?