Csound Csound-dev Csound-tekno Search About

[Csnd] ntom opcode UDO string problem

Date2019-12-10 13:39
Fromjacqouemin
Subject[Csnd] ntom opcode UDO string problem
Hi all,

I was trying to work with the Steven Yi csound-live-code (thank you so much
for your work, it's amazing!) environment and I wanted to change one thing
in order to be able to set the root of the global scale with a string. 
I decided to use the ntom opcode and keep his syntax.

This is the original Steven Yi UDO:
---
opcode set_root, 0,i 
  iscale_root xin
  gi_scale_base = iscale_root
endop
---

I tried to change it with this:
---
opcode set_root, 0,S 
  Scale_root xin
  iscale_root ntom Scale_root
  gi_scale_base = iscale_root
endop
---

If I use "ntom" Csound says "format not understood".

I tried a simple instrument that use ntom and a string variable and it works
like a charm, but when I pass through the UDO I always get the message
"format not understood".

Do you think there is a problem in my syntax?
Thank you all,
best,

j



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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-12-10 15:34
FromVictor Lazzarini
SubjectRe: [Csnd] ntom opcode UDO string problem
Maybe the UDO is not being passed the string at i-time? Try adding a prints to see if it is getting it.

prints Scale


========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 10 Dec 2019, at 13:39, jacqouemin  wrote:
> 
> Hi all,
> 
> I was trying to work with the Steven Yi csound-live-code (thank you so much
> for your work, it's amazing!) environment and I wanted to change one thing
> in order to be able to set the root of the global scale with a string. 
> I decided to use the ntom opcode and keep his syntax.
> 
> This is the original Steven Yi UDO:
> ---
> opcode set_root, 0,i 
>  iscale_root xin
>  gi_scale_base = iscale_root
> endop
> ---
> 
> I tried to change it with this:
> ---
> opcode set_root, 0,S 
>  Scale_root xin
>  iscale_root ntom Scale_root
>  gi_scale_base = iscale_root
> endop
> ---
> 
> If I use "ntom" Csound says "format not understood".
> 
> I tried a simple instrument that use ntom and a string variable and it works
> like a charm, but when I pass through the UDO I always get the message
> "format not understood".
> 
> Do you think there is a problem in my syntax?
> Thank you all,
> best,
> 
> j
> 
> 
> 
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
> 
> 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-12-10 15:51
FromVictor Lazzarini
SubjectRe: [Csnd] ntom opcode UDO string problem
I wonder if there are non-printing characters in there that are confusing ntom and we can’t see them.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 10 Dec 2019, at 16:00, jacqouemin  wrote:
> 
> Hi Victor,
> thank you for your answer.
> 
> Yes.. It gets the string, but in the end it doesn’t recognise it.
> 
> ---
> gi_scale_base init 60
> 
> opcode set_root, 0,S 
>  Scale_root xin 
>  iscale_root ntom Scale_root 
>  gi_scale_base = iscale_root 
> prints Scale_root
> endop 
> 
> instr 1
> set_root("4E")
> prints("\n")
> print(gi_scale_base)
> endin
> ---
> 
> Csound compiler:
> ---
> SECTION 1:
> new alloc for instr 1:
> format not understood
> 4E
> instr 1:  gi_scale_base = 0.000
> ---
> 
> j
> 
> 
> 
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
> 
> 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-12-10 15:55
FromJohn ff
SubjectRe: [Csnd] ntom opcode UDO string problem
That message comes from emugens.c

Sent from TypeApp
On 10 Dec 2019, at 15:45, jacqouemin <jacques.mascheroni@gmail.com> wrote:
Hi Victor,
thank you for your answer.

Yes.. It gets the string, but in the end it doesn’t recognise it.

---
gi_scale_base init 60

opcode set_root, 0,S
Scale_root xin
iscale_root ntom Scale_root
gi_scale_base = iscale_root
prints Scale_root
endop

instr 1
set_root("4E")
prints("\n")
print(gi_scale_base)
endin
---

Csound compiler:
---
SECTION 1:
new alloc for instr 1:
format not understood
4E
instr 1: gi_scale_base = 0.000
---

j



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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-12-10 16:00
Fromjacqouemin
SubjectRe: [Csnd] ntom opcode UDO string problem
Hi Victor,
thank you for your answer.

Yes.. It gets the string, but in the end it doesn’t recognise it.

---
gi_scale_base init 60

opcode set_root, 0,S 
  Scale_root xin 
  iscale_root ntom Scale_root 
  gi_scale_base = iscale_root 
prints Scale_root
endop 

instr 1
set_root("4E")
prints("\n")
print(gi_scale_base)
endin
---

Csound compiler:
---
SECTION 1:
new alloc for instr 1:
format not understood
4E
instr 1:  gi_scale_base = 0.000
---

j



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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-12-10 16:07
Fromjohn
SubjectRe: [Csnd] ntom opcode UDO string problem
More detail; this message is not n the current sources, chaged in Fen 
22tis year (I think).  What verson/platform are you using?

Current message is followed by ", note:  notelen: "
where the <..> is replaced by values in the cal


On Tue, 10 Dec 2019, John ff wrote:

> That message comes from emugens.c
> 
> Sent from TypeApp
> On 10 Dec 2019, at 15:45, jacqouemin  wrote:
> 
> Hi Victor,
> thank you for your answer.
> Yes.. It gets the string, but in the end it doesn’t recognise it.
> ---
> gi_scale_base init 60
> opcode set_root, 0,S
>   Scale_root xin
>   iscale_root ntom Scale_root
>   gi_scale_base = iscale_root 
> prints Scale_root
> endop 
> instr 1
> set_root("4E")
> prints("\n")
> print(gi_scale_base)
> endin
> ---
> Csound compiler:
> ---
> SECTION 1:
> new alloc for instr 1:
> format not understood
> 4E
> instr 1:  gi_scale_base = 0.000
> ---
> j
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
> 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

Date2019-12-10 16:17
FromEduardo Moguillansky
SubjectRe: [Csnd] ntom opcode UDO string problem

For me this works correctly:

instr 1
  imidi ntom "4E"
  print imidi
  kmidi ntom "4E"
  printf "kmidi: %d \n", 1, kmidi
  turnoff
endin

after the error message the opcode should be printing the note you passed and its length. If its not printing anything then there is a problem outside the opcode itself.

On 10.12.19 14:39, jacqouemin wrote:
Hi all,

I was trying to work with the Steven Yi csound-live-code (thank you so much
for your work, it's amazing!) environment and I wanted to change one thing
in order to be able to set the root of the global scale with a string. 
I decided to use the ntom opcode and keep his syntax.

This is the original Steven Yi UDO:
---
opcode set_root, 0,i 
  iscale_root xin
  gi_scale_base = iscale_root
endop
---

I tried to change it with this:
---
opcode set_root, 0,S 
  Scale_root xin
  iscale_root ntom Scale_root
  gi_scale_base = iscale_root
endop
---

If I use "ntom" Csound says "format not understood".

I tried a simple instrument that use ntom and a string variable and it works
like a charm, but when I pass through the UDO I always get the message
"format not understood".

Do you think there is a problem in my syntax?
Thank you all,
best,

j



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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-12-10 16:33
FromVictor Lazzarini
SubjectRe: [Csnd] ntom opcode UDO string problem
The problem is using it in a UDO, that was the report. It seems to work ok on an instrument.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 10 Dec 2019, at 16:17, Eduardo Moguillansky  wrote:
> 
> For me this works correctly:
> 
> instr 1
>   imidi ntom "4E"
>   print imidi
>   kmidi ntom "4E"
>   printf "kmidi: %d \n", 1, kmidi
>   turnoff
> endin
> 
> 
> after the error message the opcode should be printing the note you passed and its length. If its not printing anything then there is a problem outside the opcode itself. 
> 
> On 10.12.19 14:39, jacqouemin wrote:
>> Hi all,
>> 
>> I was trying to work with the Steven Yi csound-live-code (thank you so much
>> for your work, it's amazing!) environment and I wanted to change one thing
>> in order to be able to set the root of the global scale with a string. 
>> I decided to use the ntom opcode and keep his syntax.
>> 
>> This is the original Steven Yi UDO:
>> ---
>> opcode set_root, 0,i 
>>   iscale_root xin
>>   gi_scale_base = iscale_root
>> endop
>> ---
>> 
>> I tried to change it with this:
>> ---
>> opcode set_root, 0,S 
>>   Scale_root xin
>>   iscale_root ntom Scale_root
>>   gi_scale_base = iscale_root
>> endop
>> ---
>> 
>> If I use "ntom" Csound says "format not understood".
>> 
>> I tried a simple instrument that use ntom and a string variable and it works
>> like a charm, but when I pass through the UDO I always get the message
>> "format not understood".
>> 
>> Do you think there is a problem in my syntax?
>> Thank you all,
>> best,
>> 
>> j
>> 
>> 
>> 
>> --
>> Sent from: 
>> http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>> 
>> 
>> 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

Date2019-12-10 16:58
FromSteven Yi
SubjectRe: [Csnd] ntom opcode UDO string problem
Hi Jacques,

(Glad you enjoy the system!)

I tried your code here and it worked without error using latest Csound
compiled from develop branch, MacOS.

Also, I'd be careful about using numbered instruments with cslc in
general due to it possibly overwriting a named instrument that had a
number assigned, but that shouldn't be an issue here.  Another thing
is that you might create customizations to the library by creating
your own #include file that is included separate from livecode.orc.
You could add your own UDOs and instruments there and add the #include
from a custom mylivecode.csd.

All best!
Steven




On Tue, Dec 10, 2019 at 10:44 AM jacqouemin
 wrote:
>
> Hi Victor,
> thank you for your answer.
>
> Yes.. It gets the string, but in the end it doesn’t recognise it.
>
> ---
> gi_scale_base init 60
>
> opcode set_root, 0,S
>   Scale_root xin
>   iscale_root ntom Scale_root
>   gi_scale_base = iscale_root
> prints Scale_root
> endop
>
> instr 1
> set_root("4E")
> prints("\n")
> print(gi_scale_base)
> endin
> ---
>
> Csound compiler:
> ---
> SECTION 1:
> new alloc for instr 1:
> format not understood
> 4E
> instr 1:  gi_scale_base = 0.000
> ---
>
> j
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> 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-12-10 17:22
Fromjohn
SubjectRe: [Csnd] ntom opcode UDO string problem
Works for me on Linux opendSuSE cyrrent github code with input



gi_scale_base init 60

opcode set_root, 0,S
   Scale_root xin
   iscale_root ntom Scale_root
   gi_scale_base = iscale_root
prints Scale_root
endop

instr 1
set_root("4E")
prints("\n")
print(gi_scale_base)
endin




i1 0 0
e




anfd output

SECTION 1:
new alloc for instr 1:
4E
instr 1:  gi_scale_base = 64.000
Score finished in csoundPerform().
inactive allocs returned to freespace
end of score.              overall amps:      0.0
            overall samples out of range:        0
0 errors in performance


On Tue, 10 Dec 2019, Victor Lazzarini wrote:

> The problem is using it in a UDO, that was the report. It seems to work ok on an instrument.
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
>> On 10 Dec 2019, at 16:17, Eduardo Moguillansky  wrote:
>>
>> For me this works correctly:
>>
>> instr 1
>>   imidi ntom "4E"
>>   print imidi
>>   kmidi ntom "4E"
>>   printf "kmidi: %d \n", 1, kmidi
>>   turnoff
>> endin
>>
>>
>> after the error message the opcode should be printing the note you passed and its length. If its not printing anything then there is a problem outside the opcode itself.
>>
>> On 10.12.19 14:39, jacqouemin wrote:
>>> Hi all,
>>>
>>> I was trying to work with the Steven Yi csound-live-code (thank you so much
>>> for your work, it's amazing!) environment and I wanted to change one thing
>>> in order to be able to set the root of the global scale with a string.
>>> I decided to use the ntom opcode and keep his syntax.
>>>
>>> This is the original Steven Yi UDO:
>>> ---
>>> opcode set_root, 0,i
>>>   iscale_root xin
>>>   gi_scale_base = iscale_root
>>> endop
>>> ---
>>>
>>> I tried to change it with this:
>>> ---
>>> opcode set_root, 0,S
>>>   Scale_root xin
>>>   iscale_root ntom Scale_root
>>>   gi_scale_base = iscale_root
>>> endop
>>> ---
>>>
>>> If I use "ntom" Csound says "format not understood".
>>>
>>> I tried a simple instrument that use ntom and a string variable and it works
>>> like a charm, but when I pass through the UDO I always get the message
>>> "format not understood".
>>>
>>> Do you think there is a problem in my syntax?
>>> Thank you all,
>>> best,
>>>
>>> j
>>>
>>>
>>>
>>> --
>>> Sent from:
>>> http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>>>
>>>
>>> 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
>

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-12-10 20:08
Fromjacqouemin
SubjectRe: [Csnd] ntom opcode UDO string problem
Yes!!
It works!! I just had to update my Csound!

Thank you all for the answers!



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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