new alloc for instr 2:
i 2 time 0.00000: 1.00000
Sline 1:
Warning: Skipping empty line 1
i 2 time 0.00000: 2.00000
Sline 2:
Like I said, I’m not sure the output is correct, but I’m no longer getting the format error.
new alloc for instr 2:
i 2 time 0.00000: 1.00000
Sline 1:
Warning: Skipping empty line 1
i 2 time 0.00000: 2.00000
Sline 2:
Like I said, I’m not sure the output is correct, but I’m no longer getting the format error.
Now this is weird, Ive used the exact code and config file you provided
SECTION 1:
new alloc for instr 2:
instr 2: time 0.00000: 1.00000
Sline 1: 1
PERF ERROR in instr 2 (opcode strtodk) line 27: strtodk: invalid format
from file pausetime.csd (1)
kVol strtodk Sline
note aborted
B 0.000 .. 1.000 T 1.001 TT 1.001 M: 0.00000 0.00000
End of Performance inactive allocs returned to freespace
overall amps: 0.00000 0.00000
overall samples out of range: 0 0
1 errors in performance
Elapsed time at end of performance: real: 0.981s, CPU: 0.035s
173 512 sample blks of 64-bit floats written to dac
and im still getting this
what version of Csound are you using?
I tested with both Csound7 and Csound6, and get the same results. I’m at a Windows machine now, let me try again.
Ok, on Windows I’m seeing the same problem you’re facing:
Sline 1: 1 1
PERF ERROR in instr 2 (opcode strtodk) line 27: strtodk: invalid format
from file C:/Users/rory/Downloads/test1.csd (1)
kVol strtodk Sline
note aborted
B 0.000 .. 1.000 T 1.001 TT 1.001 M: 0.00000 0.00000
End of Performance inactive allocs returned to freespace
overall amps: 0.00000 0.00000
overall samples out of range: 0 0
1 errors in performance
Do you absolutely need to parse strings? It seems like there are quite a few options when it comes to read numerical data from an external file. Perhaps you could replace your strings with numerical flags? I know it’s not ideal, but it looks like there are some issues with strtodk
and readf
. I’ll file an issue on the github tracker when I get a chance.
FWIW, if I was looking to parse data from a text file, I wouldn’t use any of the existing file reading opcodes. I would format my text as JSON and use these JSON opcodes by @rjk They will give you absolute control over how you read and write your data.
Im actually working on ubuntu linux system and i face this same issue
So are you suggesting to read the values from a JSON file than a text file so i can use the JSON opcodes?
i’m fine with using any mode of file but my main goal is to read multiple values from the file its reading from and store those values in global float variable form. So would your suggestion work for this as well?
Yes. I think it would work very well, and with these opcodes you can quickly load the data into an array. So no need to have to parse through it line by line. Check out this example. The JSON data is presented as a string, but can easily be read from disk. In line 51 jsonpath
is used to grab a JSON object from the file. It returns a handle, which is passed to jsonarrval
on line 57. The output of this is an array. Looks like things are done at i-time in most cases, which is fine. It’s fast, and you get your data into your array from the off.
I’ve built these opcodes before without any issues. They should compile fine with Csound7, but you might need to tweak a few things.
They should be mandatory for anyone looking to work with text files in Csound
I tried using a JSON file, and I was finally able to read the values and convert them into global float variables. Thanks a lot for taking the time to help me out. Will surely reach out next time.