Csound Csound-dev Csound-tekno Search About

[Csnd] Macros/#include statements issue?

Date2013-07-04 19:05
Fromjkeary
Subject[Csnd] Macros/#include statements issue?
Hi,

Here's something strange that I've come across in my adventures with Csound
whenever I use an #include statement.  Lets say Im using macros for a
modular approach, to create separate files for tables of pitches,
instruments, etc.  If I don't provide an empty line after the #include
statement, I get syntax errors and the file doesn't work.  But if I do, it
works.  So for example this file:

----------






sr	=	44100
ksmps	=	100
nchnls	=	2
0dbfs	= 	1

#include "Chromatic.txt"

#include "Instrument1.txt"

$MIDI(1)
$MIDI(2)
$MIDI(3)
$MIDI(4)



; p1   p2 p3  p4 p5  p6 p7 
; inst st dur ni vel ch pan
i1 0.000000 10 9 1 1 64
i2 0.000000 10 10 1 1 64
i3 0.000000 10 11 1 1 64
i4 0.000000 10 12 1 1 64



----------

works, where as this file:

----------






sr	=	44100
ksmps	=	100
nchnls	=	2
0dbfs	= 	1

#include "Chromatic.txt" ; chromatic pitch tables
#include "MIDI.txt" ; midi instrument

$MIDI(1)
$MIDI(2)
$MIDI(3)
$MIDI(4)



; p1   p2 p3  p4 p5  p6 p7 
; inst st dur ni vel ch pan
i1 0.000000 10 9 1 1 64
i2 0.000000 10 10 1 1 64
i3 0.000000 10 11 1 1 64
i4 0.000000 10 12 1 1 64



----------

doesn't work, and gives an error message when trying to run in terminal or
qt like this:

Creating options
Creating orchestra
Creating score
using callback interface
defining argument inno as...#1#

error: syntax error, unexpected T_IDENT  (token "source") line 8:
>>>gimidi4 ftgen 4, 0, -isize, -2, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
101, 102, 103, 104, 105, 106, 107#source <<<
Parsing failed due to invalid input!
Stopping on parser failure

no sound written to disk

Also for reference here are the contents of chromatic.txt:

--------

; Chromatic 3 Octaves C2 to C8 (36 notes all together, 130.81 Hz to  987.77
Hz)

gimidi1 ftgen 1, 0, -36, -2, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
67, 68, 69, 70, 71
gimidi2 ftgen 2, 0, -isize, -2, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83
gimidi3 ftgen 3, 0, -isize, -2, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
90, 91, 92, 93, 94, 95
gimidi4 ftgen 4, 0, -isize, -2, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
101, 102, 103, 104, 105, 106, 107

--------

and and midi.txt:

--------

#define MIDI(inno)	#
instr $inno.

idur = p3
ipch table p4, p6					; midi pitches
ivel table int(rnd(8)), giVelocities			; midi velocity table choosing random
midi velocities
outic p6, 10, p7, 0, 127		; pan value
noteondur p6, ipch, ivel, idur

endin
#

--------

...Why?

James



-----
jaemskeray
--
View this message in context: http://csound.1045644.n5.nabble.com/Macros-include-statements-issue-tp5725195.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-07-04 19:08
Fromjpff@cs.bath.ac.uk
SubjectRe: [Csnd] Macros/#include statements issue?
Which version?  I thought I had fixed this some time back

> Hi,
>
> Here's something strange that I've come across in my adventures with
> Csound
> whenever I use an #include statement.  Lets say Im using macros for a
> modular approach, to create separate files for tables of pitches,
> instruments, etc.  If I don't provide an empty line after the #include
> statement, I get syntax errors and the file doesn't work.  But if I do, it
> works.  So for example this file:
>
> ----------
>
> 
> 
> 
> 
>
> sr	=	44100
> ksmps	=	100
> nchnls	=	2
> 0dbfs	= 	1
>
> #include "Chromatic.txt"
>
> #include "Instrument1.txt"
>
> $MIDI(1)
> $MIDI(2)
> $MIDI(3)
> $MIDI(4)
>
> 
> 
> ; p1   p2 p3  p4 p5  p6 p7
> ; inst st dur ni vel ch pan
> i1 0.000000 10 9 1 1 64
> i2 0.000000 10 10 1 1 64
> i3 0.000000 10 11 1 1 64
> i4 0.000000 10 12 1 1 64
> 
> 
>
> ----------
>
> works, where as this file:
>
> ----------
>
> 
> 
> 
> 
>
> sr	=	44100
> ksmps	=	100
> nchnls	=	2
> 0dbfs	= 	1
>
> #include "Chromatic.txt" ; chromatic pitch tables
> #include "MIDI.txt" ; midi instrument
>
> $MIDI(1)
> $MIDI(2)
> $MIDI(3)
> $MIDI(4)
>
> 
> 
> ; p1   p2 p3  p4 p5  p6 p7
> ; inst st dur ni vel ch pan
> i1 0.000000 10 9 1 1 64
> i2 0.000000 10 10 1 1 64
> i3 0.000000 10 11 1 1 64
> i4 0.000000 10 12 1 1 64
> 
> 
>
> ----------
>
> doesn't work, and gives an error message when trying to run in terminal or
> qt like this:
>
> Creating options
> Creating orchestra
> Creating score
> using callback interface
> defining argument inno as...#1#
>
> error: syntax error, unexpected T_IDENT  (token "source") line 8:
>>>>gimidi4 ftgen 4, 0, -isize, -2, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
> 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
> 100,
> 101, 102, 103, 104, 105, 106, 107#source <<<
> Parsing failed due to invalid input!
> Stopping on parser failure
>
> no sound written to disk
>
> Also for reference here are the contents of chromatic.txt:
>
> --------
>
> ; Chromatic 3 Octaves C2 to C8 (36 notes all together, 130.81 Hz to
> 987.77
> Hz)
>
> gimidi1 ftgen 1, 0, -36, -2, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
> 47,
> 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
> 66,
> 67, 68, 69, 70, 71
> gimidi2 ftgen 2, 0, -isize, -2, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
> 58,
> 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
> 77,
> 78, 79, 80, 81, 82, 83
> gimidi3 ftgen 3, 0, -isize, -2, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
> 70,
> 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
> 89,
> 90, 91, 92, 93, 94, 95
> gimidi4 ftgen 4, 0, -isize, -2, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
> 82,
> 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
> 101, 102, 103, 104, 105, 106, 107
>
> --------
>
> and and midi.txt:
>
> --------
>
> #define MIDI(inno)	#
> instr $inno.
>
> idur = p3
> ipch table p4, p6					; midi pitches
> ivel table int(rnd(8)), giVelocities			; midi velocity table choosing
> random
> midi velocities
> outic p6, 10, p7, 0, 127		; pan value
> noteondur p6, ipch, ivel, idur
>
> endin
> #
>
> --------
>
> ...Why?
>
> James
>
>
>
> -----
> jaemskeray
> --
> View this message in context:
> http://csound.1045644.n5.nabble.com/Macros-include-statements-issue-tp5725195.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>
>
>



Date2013-07-05 01:07
Fromjkeary
Subject[Csnd] Re: Macros/#include statements issue?
5.19.02 double 64 bit

thanks

James



-----
jaemskeray
--
View this message in context: http://csound.1045644.n5.nabble.com/Macros-include-statements-issue-tp5725195p5725204.html
Sent from the Csound - General mailing list archive at Nabble.com.