< Back to IRCAM Forum

Help writing file

Hello,
I am excited to learn Open Music programming–I have some background in programming but have never used a visual language. At this point, I am getting hung up on the basics. I am following the Open Music Documentation site and attempting to implement some of their examples for practice.

When evaluating the file-write-line box, I get this error: “Error while evaluating the box FILE-WRITE-LINE: #P”/Users/…/TestOutputOM.txt" (of type pathname) is not of type stream.

In the listener, when I evaluate the streamfile, it is returning ‘nil’, though I believe it should be returning a file pointer?

Thanks for any help!

Also, any links to sample projects that demonstrate reading and writing would be appreciated. I am undertaking a simple translation project, where numerical files are input and a transcription and midi file is output.

Hi Greg,

Apparently you are missing inputs here (or they are hidden). So it is difficult to say what’s wrong.
Anyhow, a good way to start with file-box is its tutorial:

  • Go to OM’s workspace help menu
  • choose \Import Tutorial Patches
  • choose Fiel-box.

Best
K

Hi,
Just a guess maybe: the streamfile box is not supposed to be evaluated directly: it will take a correct value (a stream reading and/or writing to the file it is connected to) only when you evaluate the file-box that contains it.
Best,
Jean

In other words, file-box really like an omloop, in the sense that you can’t just evaluatre parts of it as you would do in a standard patch, but you need to evaluate it “from outside” only.