Csound Csound-dev Csound-tekno Search About

[Csnd] ctcsound syntax highlight without csoundmagics?

Date2019-09-05 22:05
Fromjoachim heintz
Subject[Csnd] ctcsound syntax highlight without csoundmagics?
once again a question for ctcsound in the jupyter notebooks:
is there an easy way to activate syntax highlighting except loading the 
csoundmagics?

i would like to go my own way in using ctcsound, and i find the line
	from pylab import *
in csoundmagics a bit suspicious 
(https://github.com/csound/ctcsound/blob/master/cookbook/csoundmagics/csoundmagics.py 
line 127).

but nevertheless i would like to see syntax highlighting in something like
orc = '''
giSine ftgen 0, 0, 128, 10, 1
'''

thanks -
	joachim

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

Date2019-09-06 13:15
FromFrancois PINOT
SubjectRe: [Csnd] ctcsound syntax highlight without csoundmagics?
Hello Joachim,

'from pylab import *' is used in csoundmagics.py to give access to numpy and matplotlib.pyplot. By the way, I don't use this anymore preferring to use explicit imports so that the functions and objects of numpy and matplotlib.pyplot are prefixed with the right namespace, which is more explicit. You can see this on github where I just committed the modifications in csoundmagics.py and in the 7th recipe of the cookbook.

Seeing syntax highlighting in a Python string representing some piece of a Csound orchestra would mean that we have Csound syntax highlighting in strings of a Python program which has its own Python syntax highlighting. I'm not sure that Jupyter notebook has this ability. That's one of the reasons why I developed the magic commands %%csd, %%orc, and %sco.

François

Le jeu. 5 sept. 2019 à 23:05, joachim heintz <jh@joachimheintz.de> a écrit :
once again a question for ctcsound in the jupyter notebooks:
is there an easy way to activate syntax highlighting except loading the
csoundmagics?

i would like to go my own way in using ctcsound, and i find the line
        from pylab import *
in csoundmagics a bit suspicious
(https://github.com/csound/ctcsound/blob/master/cookbook/csoundmagics/csoundmagics.py
line 127).

but nevertheless i would like to see syntax highlighting in something like
orc = '''
giSine ftgen 0, 0, 128, 10, 1
'''

thanks -
        joachim

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
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

Date2019-09-06 15:02
Fromjoachim heintz
SubjectRe: [Csnd] ctcsound syntax highlight without csoundmagics?
hello françois -

yes this was my concern, too.  it can create a messy namespace.  but 
with your changes, and what you explained about the highlighting, i 
think i will use the csoundmagics, too.

thanks and best -

	joachim



On 06/09/19 14:15, Francois PINOT wrote:
> Hello Joachim,
>
> 'from pylab import *' is used in csoundmagics.py to give access to numpy
> and matplotlib.pyplot. By the way, I don't use this anymore preferring
> to use explicit imports so that the functions and objects of numpy and
> matplotlib.pyplot are prefixed with the right namespace, which is more
> explicit. You can see this on github where I just committed the
> modifications in csoundmagics.py and in the 7th recipe of the cookbook.
>
> Seeing syntax highlighting in a Python string representing some piece of
> a Csound orchestra would mean that we have Csound syntax highlighting in
> strings of a Python program which has its own Python syntax
> highlighting. I'm not sure that Jupyter notebook has this ability.
> That's one of the reasons why I developed the magic commands %%csd,
> %%orc, and %sco.
>
> François
>
> Le jeu. 5 sept. 2019 à 23:05, joachim heintz  > a écrit :
>
>     once again a question for ctcsound in the jupyter notebooks:
>     is there an easy way to activate syntax highlighting except loading the
>     csoundmagics?
>
>     i would like to go my own way in using ctcsound, and i find the line
>             from pylab import *
>     in csoundmagics a bit suspicious
>     (https://github.com/csound/ctcsound/blob/master/cookbook/csoundmagics/csoundmagics.py
>
>     line 127).
>
>     but nevertheless i would like to see syntax highlighting in
>     something like
>     orc = '''
>     giSine ftgen 0, 0, 128, 10, 1
>     '''
>
>     thanks -
>             joachim
>
>     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
>
> 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

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