scoreline_i error and strings
Date | 2015-11-05 16:23 |
From | Peiman Khosravi |
Subject | scoreline_i error and strings |
Hello, Any idea why: Sscore sprintf "i 2 0 %f %s", 0.023600, Sfile scoreline_i Sscore returns this error: illegal RT scoreline: i 2 0 0.023600 /Users/peimankhosravi/Desktop/session/soundfiles/Number.1.wav ^ Thanks P Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2015-11-05 16:27 |
From | Steven Yi |
Subject | Re: scoreline_i error and strings |
I imagine the string should be quoted within the template string? Something like: Sscore sprintf "i 2 0 %f \"%s\"", 0.023600, Sfile On Thu, Nov 5, 2015 at 11:23 AM, Peiman Khosravi |
Date | 2015-11-05 16:32 |
From | Peiman Khosravi |
Subject | Re: scoreline_i error and strings |
Thanks Steven, Yes that's what I thought but the template you suggested now returns: INIT ERROR in instr 2: diskin2: 0: failed to open file aout diskin2 Sfile 50 0 0 0 0 0 0 0 I don't know how to add the double quotes in the scoreline String! Best, Peiman On 05/11/2015 16:27, Steven Yi wrote: > I imagine the string should be quoted within the template string? > Something like: > > Sscore sprintf "i 2 0 %f \"%s\"", 0.023600, Sfile Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2015-11-05 16:33 |
From | Victor Lazzarini |
Subject | Re: scoreline_i error and strings |
because it is missing the double quotes surrounding the substring. Using {{ and }} works: instr 1 S1 = p4 prints S1 endin scoreline_i {{ i 1 0 1 "hello\n" }} ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 5 Nov 2015, at 16:23, Peiman Khosravi |
Date | 2015-11-05 16:35 |
From | Victor Lazzarini |
Subject | Re: scoreline_i error and strings |
Try instr 1 Sp4 = p4 S1 sprintf "THIS: %s", Sp4 prints S1 endin scoreline_i {{ i 1 0 1 "hello\n" }} ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 5 Nov 2015, at 16:32, Peiman Khosravi |
Date | 2015-11-05 16:42 |
From | Peiman Khosravi |
Subject | Re: scoreline_i error and strings |
Thanks Victor, that works but I need to construct the string with sprintf and this doesn't work: scoreline_i {{ i 1 0 1 String }} On 05/11/2015 16:35, Victor Lazzarini wrote: > instr 1 > Sp4 = p4 > S1 sprintf "THIS: %s", Sp4 > prints S1 > endin > scoreline_i {{ > i 1 0 1 "hello\n" > }} Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2015-11-05 16:45 |
From | Victor Lazzarini |
Subject | Re: scoreline_i error and strings |
How come it doesn’t? My example does exactly that: constructs a string with sprintf. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 5 Nov 2015, at 16:42, Peiman Khosravi |
Date | 2015-11-05 16:49 |
From | Peiman Khosravi |
Subject | Re: scoreline_i error and strings |
OK sorry I'm confused! In your example you're constructing the string from the p-filed that you've manually defined. I need it the other way around. So I need to construct the file name in one instrument and pass it to scoreline_i as a p-field to call another instrument. Something like this: until (kindx == $CHANS) do Schan sprintfk ".%d", 1 Sextension strcat Schan, "$EXT" Sfile strcat "\"$FILE\"", Sextension ilength filelen Sfile ; Length of file in seconds scoreline_i {{i 2 0 1 Sfile}} kindx += 1 od endin On 05/11/2015 16:45, Victor Lazzarini wrote: > instr 1 > >>Sp4 = p4 > >>S1 sprintf "THIS: %s", Sp4 > >>prints S1 > >>endin > >>scoreline_i {{ > >>i 1 0 1 "hello\n" > >>}} Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2015-11-05 16:50 |
From | Victor Lazzarini |
Subject | Re: scoreline_i error and strings |
Just to be clear: instr 1 Sp4 = p4 S1 sprintf {{ i2 0 1 "%s"}}, Sp4 scoreline_i S1 endin instr 2 Sp4 = p4 a1 diskin2 Sp4,1,0,1 out a1 endin scoreline_i {{ i 1 0 1 "flutec3.wav" }} ============= SECTION 1: new alloc for instr 1: rtevent: T 0.000 TT 0.000 M: 0.0 new alloc for instr 2: diskin2: opened '/Users/victor/audio/flutec3.wav': 44100 Hz, 1 channel(s), 311296 sample frames ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 5 Nov 2015, at 16:45, Victor Lazzarini |
Date | 2015-11-05 16:51 |
From | Peiman Khosravi |
Subject | Re: scoreline_i error and strings |
I'm just trying this again thanks! On 05/11/2015 16:50, Victor Lazzarini wrote: > S1 sprintf {{ i2 0 1 "%s"}}, Sp4 Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2015-11-05 16:56 |
From | Peiman Khosravi |
Subject | Re: scoreline_i error and strings |
Yes that's it! Now I understand. Thanks very much! Best, Peiman On 05/11/2015 16:50, Victor Lazzarini wrote: > Just to be clear: > > instr 1 > Sp4 = p4 > S1 sprintf {{ i2 0 1 "%s"}}, Sp4 > scoreline_i S1 > endin > > instr 2 > Sp4 = p4 > a1 diskin2 Sp4,1,0,1 > out a1 > endin > > scoreline_i {{ > i 1 0 1 "flutec3.wav" > }} > > > ============= > SECTION 1: > new alloc for instr 1: > rtevent: T 0.000 TT 0.000 M: 0.0 > new alloc for instr 2: > diskin2: opened '/Users/victor/audio/flutec3.wav': > 44100 Hz, 1 channel(s), 311296 sample frames > > ======================== > Dr Victor Lazzarini > Dean of Arts, Celtic Studies and Philosophy, > Maynooth University, > Maynooth, Co Kildare, Ireland > Tel: 00 353 7086936 > Fax: 00 353 1 7086952 > >> On 5 Nov 2015, at 16:45, Victor Lazzarini |