Csound Csound-dev Csound-tekno Search About

[Csnd] Csound and Arduino (attn: Jake)

Date2011-07-30 20:36
FromDave Seidel
Subject[Csnd] Csound and Arduino (attn: Jake)
I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1] http://csoundblog.com/2010/08/photoresistor-theremin/


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"

Date2011-07-30 20:39
FromDave Seidel
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
Whoops, the beginning of the first sentence should read "I have a nice
box my brother made for me...."

On 7/30/2011 3:36 PM, Dave Seidel wrote:
> I have a nice box my brother me for me with a Arduino on the inside and
> a bunch of controls on the outside (six pots, three toggles, and two
> momentary push-buttons). Up til now, I've been running Auduino firmware
> on the box and using it as a synth, which uses a subset of the controls
> (five pots).
> 
> My brother has another similar box he made for himself, and has been
> using it as a hardware controller for realtime PD programs, using
> Firmata firmware on Arduino and the pduino object in PD.
> 
> I'd love to be able to use my box with Csound in a similar way to what
> he's doing with PD, and I'm trying to figure out what my options are.
> 
> Jake has demonstrated[1] how to use Processing and his Csoundo package
> to do something like this, but he hasn't published the code yet AFAIK.
> Jake, in your Processing code, did you use the cc.arduino package (which
> talks to Firmata) or did you write your own serial code? Would you be
> willing to make your Processing sources available?
> 
> I'm also interested in hearing if anyone else has succeeded is using an
> Arduino with Csound. I know some options have been discussed, e.g. using
> OSC, which would require either an Arduino shield with OSC support or
> some intermediate software between Csound and the Arduino to translate
> between serial and OSC. I think someone suggested doing this in Python,
> which is reasonable, but it also would make sense to do this in
> Processing. Has anyone tried either of these approaches, and if so,
> would you consider sharing your work?
> 
> Thanks in advance for any input.
> 
> - Dave
> 
> [1] http://csoundblog.com/2010/08/photoresistor-theremin/
> 
> 
> 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"
> 
> 


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"

Date2011-07-30 20:43
FromVictor Lazzarini
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
You could use PD and csound inside PD with csoundapi~.

Victor
On 30 Jul 2011, at 20:39, Dave Seidel wrote:

> Whoops, the beginning of the first sentence should read "I have a nice
> box my brother made for me...."
>
> On 7/30/2011 3:36 PM, Dave Seidel wrote:
>> I have a nice box my brother me for me with a Arduino on the inside  
>> and
>> a bunch of controls on the outside (six pots, three toggles, and two
>> momentary push-buttons). Up til now, I've been running Auduino  
>> firmware
>> on the box and using it as a synth, which uses a subset of the  
>> controls
>> (five pots).
>>
>> My brother has another similar box he made for himself, and has been
>> using it as a hardware controller for realtime PD programs, using
>> Firmata firmware on Arduino and the pduino object in PD.
>>
>> I'd love to be able to use my box with Csound in a similar way to  
>> what
>> he's doing with PD, and I'm trying to figure out what my options are.
>>
>> Jake has demonstrated[1] how to use Processing and his Csoundo  
>> package
>> to do something like this, but he hasn't published the code yet  
>> AFAIK.
>> Jake, in your Processing code, did you use the cc.arduino package  
>> (which
>> talks to Firmata) or did you write your own serial code? Would you be
>> willing to make your Processing sources available?
>>
>> I'm also interested in hearing if anyone else has succeeded is  
>> using an
>> Arduino with Csound. I know some options have been discussed, e.g.  
>> using
>> OSC, which would require either an Arduino shield with OSC support or
>> some intermediate software between Csound and the Arduino to  
>> translate
>> between serial and OSC. I think someone suggested doing this in  
>> Python,
>> which is reasonable, but it also would make sense to do this in
>> Processing. Has anyone tried either of these approaches, and if so,
>> would you consider sharing your work?
>>
>> Thanks in advance for any input.
>>
>> - Dave
>>
>> [1] http://csoundblog.com/2010/08/photoresistor-theremin/
>>
>>
>> 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"
>>
>>
>
>
> 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"
>

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





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"

Date2011-07-30 20:47
FromDave Seidel
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
Ah, I see that Jake did indeed publish his code:

http://csound.noisepages.com/2010/08/photo-theremin-code/

Getting it now to study. Thanks, Jake!

- Dave

On 7/30/2011 3:36 PM, Dave Seidel wrote:
> I have a nice box my brother me for me with a Arduino on the inside and
> a bunch of controls on the outside (six pots, three toggles, and two
> momentary push-buttons). Up til now, I've been running Auduino firmware
> on the box and using it as a synth, which uses a subset of the controls
> (five pots).
> 
> My brother has another similar box he made for himself, and has been
> using it as a hardware controller for realtime PD programs, using
> Firmata firmware on Arduino and the pduino object in PD.
> 
> I'd love to be able to use my box with Csound in a similar way to what
> he's doing with PD, and I'm trying to figure out what my options are.
> 
> Jake has demonstrated[1] how to use Processing and his Csoundo package
> to do something like this, but he hasn't published the code yet AFAIK.
> Jake, in your Processing code, did you use the cc.arduino package (which
> talks to Firmata) or did you write your own serial code? Would you be
> willing to make your Processing sources available?
> 
> I'm also interested in hearing if anyone else has succeeded is using an
> Arduino with Csound. I know some options have been discussed, e.g. using
> OSC, which would require either an Arduino shield with OSC support or
> some intermediate software between Csound and the Arduino to translate
> between serial and OSC. I think someone suggested doing this in Python,
> which is reasonable, but it also would make sense to do this in
> Processing. Has anyone tried either of these approaches, and if so,
> would you consider sharing your work?
> 
> Thanks in advance for any input.
> 
> - Dave
> 
> [1] http://csoundblog.com/2010/08/photoresistor-theremin/
> 
> 
> 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"
> 
> 


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"

Date2011-07-30 21:25
FromDave Seidel
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
Ah yes, excellent point! Definitely an option, and one I'll consider.

My choice will likely come down to: into which
language/environment/spiritual-practice do I want to invest my learning
(i.e., not creating) time, Processing or PD?

So far, I'm pulled toward Processing for two reasons:
1. I'm more fluent and productive in text-based languages (like Java,
Python, Ruby, etc.) than in graphical languages.
2. I'm very interested in Processing's graphic (output) abilities.

Where's the best online documentation for csoundapi~? Can it do realtime
stuff (e.g., invalue/outvalue or whatever)?


On 7/30/2011 3:43 PM, Victor Lazzarini wrote:
> You could use PD and csound inside PD with csoundapi~.
> 
> Victor
> On 30 Jul 2011, at 20:39, Dave Seidel wrote:
> 
>> Whoops, the beginning of the first sentence should read "I have a nice
>> box my brother made for me...."
>>
>> On 7/30/2011 3:36 PM, Dave Seidel wrote:
>>> I have a nice box my brother me for me with a Arduino on the inside and
>>> a bunch of controls on the outside (six pots, three toggles, and two
>>> momentary push-buttons). Up til now, I've been running Auduino firmware
>>> on the box and using it as a synth, which uses a subset of the controls
>>> (five pots).
>>>
>>> My brother has another similar box he made for himself, and has been
>>> using it as a hardware controller for realtime PD programs, using
>>> Firmata firmware on Arduino and the pduino object in PD.
>>>
>>> I'd love to be able to use my box with Csound in a similar way to what
>>> he's doing with PD, and I'm trying to figure out what my options are.
>>>
>>> Jake has demonstrated[1] how to use Processing and his Csoundo package
>>> to do something like this, but he hasn't published the code yet AFAIK.
>>> Jake, in your Processing code, did you use the cc.arduino package (which
>>> talks to Firmata) or did you write your own serial code? Would you be
>>> willing to make your Processing sources available?
>>>
>>> I'm also interested in hearing if anyone else has succeeded is using an
>>> Arduino with Csound. I know some options have been discussed, e.g. using
>>> OSC, which would require either an Arduino shield with OSC support or
>>> some intermediate software between Csound and the Arduino to translate
>>> between serial and OSC. I think someone suggested doing this in Python,
>>> which is reasonable, but it also would make sense to do this in
>>> Processing. Has anyone tried either of these approaches, and if so,
>>> would you consider sharing your work?
>>>
>>> Thanks in advance for any input.
>>>
>>> - Dave
>>>
>>> [1] http://csoundblog.com/2010/08/photoresistor-theremin/
>>>
>>>
>>> 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"
>>>
>>>
>>
>>
>> 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"
>>
> 
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
> 
> 
> 
> 
> 
> 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"
> 
> 


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"

Date2011-07-30 21:41
FromVictor Lazzarini
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
Regarding PD, I guess you only need a minimal  (half-hour?)  
understanding of it to patch arduino into
csoundapi~  and then forget about it, as everything else can be done  
in Csound (PD is just like a shell).

Victor
On 30 Jul 2011, at 21:25, Dave Seidel wrote:

> Ah yes, excellent point! Definitely an option, and one I'll consider.
>
> My choice will likely come down to: into which
> language/environment/spiritual-practice do I want to invest my  
> learning
> (i.e., not creating) time, Processing or PD?
>
> So far, I'm pulled toward Processing for two reasons:
> 1. I'm more fluent and productive in text-based languages (like Java,
> Python, Ruby, etc.) than in graphical languages.
> 2. I'm very interested in Processing's graphic (output) abilities.
>
> Where's the best online documentation for csoundapi~? Can it do  
> realtime
> stuff (e.g., invalue/outvalue or whatever)?
>
>
> On 7/30/2011 3:43 PM, Victor Lazzarini wrote:
>> You could use PD and csound inside PD with csoundapi~.
>>
>> Victor
>> On 30 Jul 2011, at 20:39, Dave Seidel wrote:
>>
>>> Whoops, the beginning of the first sentence should read "I have a  
>>> nice
>>> box my brother made for me...."
>>>
>>> On 7/30/2011 3:36 PM, Dave Seidel wrote:
>>>> I have a nice box my brother me for me with a Arduino on the  
>>>> inside and
>>>> a bunch of controls on the outside (six pots, three toggles, and  
>>>> two
>>>> momentary push-buttons). Up til now, I've been running Auduino  
>>>> firmware
>>>> on the box and using it as a synth, which uses a subset of the  
>>>> controls
>>>> (five pots).
>>>>
>>>> My brother has another similar box he made for himself, and has  
>>>> been
>>>> using it as a hardware controller for realtime PD programs, using
>>>> Firmata firmware on Arduino and the pduino object in PD.
>>>>
>>>> I'd love to be able to use my box with Csound in a similar way to  
>>>> what
>>>> he's doing with PD, and I'm trying to figure out what my options  
>>>> are.
>>>>
>>>> Jake has demonstrated[1] how to use Processing and his Csoundo  
>>>> package
>>>> to do something like this, but he hasn't published the code yet  
>>>> AFAIK.
>>>> Jake, in your Processing code, did you use the cc.arduino package  
>>>> (which
>>>> talks to Firmata) or did you write your own serial code? Would  
>>>> you be
>>>> willing to make your Processing sources available?
>>>>
>>>> I'm also interested in hearing if anyone else has succeeded is  
>>>> using an
>>>> Arduino with Csound. I know some options have been discussed,  
>>>> e.g. using
>>>> OSC, which would require either an Arduino shield with OSC  
>>>> support or
>>>> some intermediate software between Csound and the Arduino to  
>>>> translate
>>>> between serial and OSC. I think someone suggested doing this in  
>>>> Python,
>>>> which is reasonable, but it also would make sense to do this in
>>>> Processing. Has anyone tried either of these approaches, and if so,
>>>> would you consider sharing your work?
>>>>
>>>> Thanks in advance for any input.
>>>>
>>>> - Dave
>>>>
>>>> [1] http://csoundblog.com/2010/08/photoresistor-theremin/
>>>>
>>>>
>>>> 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"
>>>>
>>>>
>>>
>>>
>>> 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"
>>>
>>
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
>>
>> 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"
>>
>>
>
>
> 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"
>

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





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"

Date2011-07-30 21:42
Fromjoachim heintz
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
i don't know about the best, but here is one free documentation about
csound in pd:
http://en.flossmanuals.net/csound/ch052_csound-in-pd

victor's csoundapi~ works really really good, and is used far to rarely,
in my opinion.

the other option is sending osc messages from pd to csound:
http://www.youtube.com/watch?v=JX1C3TqP_9Y&feature=view_all&list=PL3EE3219702D17FD3&index=11

	joachim

Am 30.07.2011 22:25, schrieb Dave Seidel:
> Where's the best online documentation for csoundapi~? Can it do realtime
> stuff (e.g., invalue/outvalue or whatever)?


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"

Date2011-07-30 22:37
FromMartin Peach
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
It sounds like a MIDI controller box. If you have a MIDI interface, you 
can easily turn arduino into a MIDI device with two 220 Ohm resistors 
and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) 
Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:
> I have a nice box my brother me for me with a Arduino on the inside and
> a bunch of controls on the outside (six pots, three toggles, and two
> momentary push-buttons). Up til now, I've been running Auduino firmware
> on the box and using it as a synth, which uses a subset of the controls
> (five pots).
>
> My brother has another similar box he made for himself, and has been
> using it as a hardware controller for realtime PD programs, using
> Firmata firmware on Arduino and the pduino object in PD.
>
> I'd love to be able to use my box with Csound in a similar way to what
> he's doing with PD, and I'm trying to figure out what my options are.
>
> Jake has demonstrated[1] how to use Processing and his Csoundo package
> to do something like this, but he hasn't published the code yet AFAIK.
> Jake, in your Processing code, did you use the cc.arduino package (which
> talks to Firmata) or did you write your own serial code? Would you be
> willing to make your Processing sources available?
>
> I'm also interested in hearing if anyone else has succeeded is using an
> Arduino with Csound. I know some options have been discussed, e.g. using
> OSC, which would require either an Arduino shield with OSC support or
> some intermediate software between Csound and the Arduino to translate
> between serial and OSC. I think someone suggested doing this in Python,
> which is reasonable, but it also would make sense to do this in
> Processing. Has anyone tried either of these approaches, and if so,
> would you consider sharing your work?
>
> Thanks in advance for any input.
>
> - Dave
>
> [1] http://csoundblog.com/2010/08/photoresistor-theremin/
>
>
> 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"
>
>
>



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"

Date2011-07-30 23:29
Frommatt ingalls
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:

> It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.
> 
> Martin
> 
> 
> On 2011-07-30 15:36, Dave Seidel wrote:
>> I have a nice box my brother me for me with a Arduino on the inside and
>> a bunch of controls on the outside (six pots, three toggles, and two
>> momentary push-buttons). Up til now, I've been running Auduino firmware
>> on the box and using it as a synth, which uses a subset of the controls
>> (five pots).
>> 
>> My brother has another similar box he made for himself, and has been
>> using it as a hardware controller for realtime PD programs, using
>> Firmata firmware on Arduino and the pduino object in PD.
>> 
>> I'd love to be able to use my box with Csound in a similar way to what
>> he's doing with PD, and I'm trying to figure out what my options are.
>> 
>> Jake has demonstrated[1] how to use Processing and his Csoundo package
>> to do something like this, but he hasn't published the code yet AFAIK.
>> Jake, in your Processing code, did you use the cc.arduino package (which
>> talks to Firmata) or did you write your own serial code? Would you be
>> willing to make your Processing sources available?
>> 
>> I'm also interested in hearing if anyone else has succeeded is using an
>> Arduino with Csound. I know some options have been discussed, e.g. using
>> OSC, which would require either an Arduino shield with OSC support or
>> some intermediate software between Csound and the Arduino to translate
>> between serial and OSC. I think someone suggested doing this in Python,
>> which is reasonable, but it also would make sense to do this in
>> Processing. Has anyone tried either of these approaches, and if so,
>> would you consider sharing your work?
>> 
>> Thanks in advance for any input.
>> 
>> - Dave
>> 
>> [1] http://csoundblog.com/2010/08/photoresistor-theremin/
>> 
>> 
>> 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"
>> 
>> 
>> 
> 
> 
> 
> 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"
> 



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"


Date2011-07-30 23:46
FromRory Walsh
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
Yes please!

On 30 July 2011 23:29, matt ingalls  wrote:
> i have some posix serial code ive used to make a commandline app to communicate with an arduino.
> probably easy to turn it into a csound opcode, if you were interested.
> -m
>
> On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
>
>> It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.
>>
>> Martin
>>
>>
>> On 2011-07-30 15:36, Dave Seidel wrote:
>>> I have a nice box my brother me for me with a Arduino on the inside and
>>> a bunch of controls on the outside (six pots, three toggles, and two
>>> momentary push-buttons). Up til now, I've been running Auduino firmware
>>> on the box and using it as a synth, which uses a subset of the controls
>>> (five pots).
>>>
>>> My brother has another similar box he made for himself, and has been
>>> using it as a hardware controller for realtime PD programs, using
>>> Firmata firmware on Arduino and the pduino object in PD.
>>>
>>> I'd love to be able to use my box with Csound in a similar way to what
>>> he's doing with PD, and I'm trying to figure out what my options are.
>>>
>>> Jake has demonstrated[1] how to use Processing and his Csoundo package
>>> to do something like this, but he hasn't published the code yet AFAIK.
>>> Jake, in your Processing code, did you use the cc.arduino package (which
>>> talks to Firmata) or did you write your own serial code? Would you be
>>> willing to make your Processing sources available?
>>>
>>> I'm also interested in hearing if anyone else has succeeded is using an
>>> Arduino with Csound. I know some options have been discussed, e.g. using
>>> OSC, which would require either an Arduino shield with OSC support or
>>> some intermediate software between Csound and the Arduino to translate
>>> between serial and OSC. I think someone suggested doing this in Python,
>>> which is reasonable, but it also would make sense to do this in
>>> Processing. Has anyone tried either of these approaches, and if so,
>>> would you consider sharing your work?
>>>
>>> Thanks in advance for any input.
>>>
>>> - Dave
>>>
>>> [1] http://csoundblog.com/2010/08/photoresistor-theremin/
>>>
>>>
>>> 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"
>>>
>>>
>>>
>>
>>
>>
>> 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"
>>
>
>
>
> 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"
>
>


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"


Date2011-07-31 02:38
FromDave Seidel
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
That would be great to have, Matt.

- Dave

On 7/30/2011 6:29 PM, matt ingalls wrote:
> i have some posix serial code ive used to make a commandline app to communicate with an arduino.
> probably easy to turn it into a csound opcode, if you were interested.
> -m
> 
> On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
> 
>> It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.
>>
>> Martin
>>
>>
>> On 2011-07-30 15:36, Dave Seidel wrote:
>>> I have a nice box my brother me for me with a Arduino on the inside and
>>> a bunch of controls on the outside (six pots, three toggles, and two
>>> momentary push-buttons). Up til now, I've been running Auduino firmware
>>> on the box and using it as a synth, which uses a subset of the controls
>>> (five pots).
>>>
>>> My brother has another similar box he made for himself, and has been
>>> using it as a hardware controller for realtime PD programs, using
>>> Firmata firmware on Arduino and the pduino object in PD.
>>>
>>> I'd love to be able to use my box with Csound in a similar way to what
>>> he's doing with PD, and I'm trying to figure out what my options are.
>>>
>>> Jake has demonstrated[1] how to use Processing and his Csoundo package
>>> to do something like this, but he hasn't published the code yet AFAIK.
>>> Jake, in your Processing code, did you use the cc.arduino package (which
>>> talks to Firmata) or did you write your own serial code? Would you be
>>> willing to make your Processing sources available?
>>>
>>> I'm also interested in hearing if anyone else has succeeded is using an
>>> Arduino with Csound. I know some options have been discussed, e.g. using
>>> OSC, which would require either an Arduino shield with OSC support or
>>> some intermediate software between Csound and the Arduino to translate
>>> between serial and OSC. I think someone suggested doing this in Python,
>>> which is reasonable, but it also would make sense to do this in
>>> Processing. Has anyone tried either of these approaches, and if so,
>>> would you consider sharing your work?
>>>
>>> Thanks in advance for any input.
>>>
>>> - Dave
>>>
>>> [1] http://csoundblog.com/2010/08/photoresistor-theremin/
>>>
>>>
>>> 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"
>>>
>>>
>>>
>>
>>
>>
>> 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"
>>
> 
> 
> 
> 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"
> 
> 


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"

Date2011-07-31 02:41
FromDave Seidel
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
Thanks, Victor and Joachim! Yes, I'd like to explore OSC eventually as
well. I'm guessing Processing may have an OSC library as well.

On 7/30/2011 4:42 PM, joachim heintz wrote:
> i don't know about the best, but here is one free documentation about
> csound in pd:
> http://en.flossmanuals.net/csound/ch052_csound-in-pd
> 
> victor's csoundapi~ works really really good, and is used far to rarely,
> in my opinion.
> 
> the other option is sending osc messages from pd to csound:
> http://www.youtube.com/watch?v=JX1C3TqP_9Y&feature=view_all&list=PL3EE3219702D17FD3&index=11
> 
> 	joachim
> 
> Am 30.07.2011 22:25, schrieb Dave Seidel:
>> Where's the best online documentation for csoundapi~? Can it do realtime
>> stuff (e.g., invalue/outvalue or whatever)?
> 
> 
> 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"
> 
> 


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"

Date2011-07-31 08:54
Fromzappfinger
Subject[Csnd] Re: Csound and Arduino (attn: Jake)
Hi Dave,

The following minimal Python code should get you started:

regards, Richard


#
#  basic serial to OSC
#
import serial,binascii,osc,string

ser = serial.Serial()
# the (USB) serial port 
ser.port = 6
if ser.isOpen():
  ser.close()
ser.open()

osc.init()
i=10000
val=''
iarr=[]
while i:
    char = ser.read(1)
    while char<>';':
       val = val + char
       char = ser.read(1)
    print val;
    iarr = [int(val)]
    osc.sendMsg("/freq", iarr, "127.0.0.1", 9000) # send normal msg
    i = i-1
    val=''
    # print i

--
View this message in context: http://csound.1045644.n5.nabble.com/Csound-and-Arduino-attn-Jake-tp4650481p4651443.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"

Date2011-07-31 15:35
FromDave Seidel
SubjectRe: [Csnd] Re: Csound and Arduino (attn: Jake)
Thanks, Richard.

On 7/31/2011 3:54 AM, zappfinger wrote:
> Hi Dave,
> 
> The following minimal Python code should get you started:
> 
> regards, Richard
> 
> 
> #
> #  basic serial to OSC
> #
> import serial,binascii,osc,string
> 
> ser = serial.Serial()
> # the (USB) serial port 
> ser.port = 6
> if ser.isOpen():
>   ser.close()
> ser.open()
> 
> osc.init()
> i=10000
> val=''
> iarr=[]
> while i:
>     char = ser.read(1)
>     while char<>';':
>        val = val + char
>        char = ser.read(1)
>     print val;
>     iarr = [int(val)]
>     osc.sendMsg("/freq", iarr, "127.0.0.1", 9000) # send normal msg
>     i = i-1
>     val=''
>     # print i
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Csound-and-Arduino-attn-Jake-tp4650481p4651443.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"
> 
> 


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"

Date2011-07-31 23:20
Fromjoachim heintz
SubjectRe: [Csnd] Re: Csound and Arduino (attn: Jake)
hi richard -
when i run your script, i get the message
ImportError: No module named osc
i have liblo installed - what am i missing (ubuntu 10.10)?
thanks -
	joachim

Am 31.07.2011 09:54, schrieb zappfinger:
> Hi Dave,
> 
> The following minimal Python code should get you started:
> 
> regards, Richard
> 
> 
> #
> #  basic serial to OSC
> #
> import serial,binascii,osc,string
> 
> ser = serial.Serial()
> # the (USB) serial port 
> ser.port = 6
> if ser.isOpen():
>   ser.close()
> ser.open()
> 
> osc.init()
> i=10000
> val=''
> iarr=[]
> while i:
>     char = ser.read(1)
>     while char<>';':
>        val = val + char
>        char = ser.read(1)
>     print val;
>     iarr = [int(val)]
>     osc.sendMsg("/freq", iarr, "127.0.0.1", 9000) # send normal msg
>     i = i-1
>     val=''
>     # print i
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Csound-and-Arduino-attn-Jake-tp4650481p4651443.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"
> 
> 


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"

Date2011-08-01 07:19
FromRichard van Bemmelen
SubjectRe: [Csnd] Re: Csound and Arduino (attn: Jake)
Hi Joachim,

OSC and serial libraries are not standard libraries in Python.
So you have to download them specific for you platform.
I use pyosc and some serial library for PC (I got this running once on a PC).
On my Mac I am missing the serial library too, so I have to download this.
I will let you know the results,

regards,
Richard
2011/8/1 joachim heintz <jh@joachimheintz.de>
hi richard -
when i run your script, i get the message
ImportError: No module named osc
i have liblo installed - what am i missing (ubuntu 10.10)?
thanks -
       joachim

Am 31.07.2011 09:54, schrieb zappfinger:
> Hi Dave,
>
> The following minimal Python code should get you started:
>
> regards, Richard
>
>
> #
> #  basic serial to OSC
> #
> import serial,binascii,osc,string
>
> ser = serial.Serial()
> # the (USB) serial port
> ser.port = 6
> if ser.isOpen():
>   ser.close()
> ser.open()
>
> osc.init()
> i=10000
> val=''
> iarr=[]
> while i:
>     char = ser.read(1)
>     while char<>';':
>        val = val + char
>        char = ser.read(1)
>     print val;
>     iarr = [int(val)]
>     osc.sendMsg("/freq", iarr, "127.0.0.1", 9000) # send normal msg
>     i = i-1
>     val=''
>     # print i
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Csound-and-Arduino-attn-Jake-tp4650481p4651443.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"
>
>


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"



Date2011-08-01 10:30
Fromjoachim heintz
SubjectRe: [Csnd] Re: Csound and Arduino (attn: Jake)
thanks, richard -
i have installed pyosc now (serial was already there). when i run your
script now, i get this error:

Traceback (most recent call last):
  File "/home/linux/Desktop/SerialToOsc.py", line 11, in 
    ser.open()
  File "/usr/lib/python2.6/dist-packages/serial/serialposix.py", line
175, in open
    raise SerialException("could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: could not open port 6: [Errno 2] No
such file or directory: '/dev/ttyS6'

does anyone know what this means?
thanks -

	joachim


Am 01.08.2011 08:19, schrieb Richard van Bemmelen:
> Hi Joachim,
> 
> OSC and serial libraries are not standard libraries in Python.
> So you have to download them specific for you platform.
> I use pyosc and some serial library for PC (I got this running once on a
> PC).
> On my Mac I am missing the serial library too, so I have to download this.
> I will let you know the results,
> 
> regards,
> Richard
> 2011/8/1 joachim heintz >
> 
>     hi richard -
>     when i run your script, i get the message
>     ImportError: No module named osc
>     i have liblo installed - what am i missing (ubuntu 10.10)?
>     thanks -
>            joachim
> 
>     Am 31.07.2011 09:54, schrieb zappfinger:
>     > Hi Dave,
>     >
>     > The following minimal Python code should get you started:
>     >
>     > regards, Richard
>     >
>     >
>     > #
>     > #  basic serial to OSC
>     > #
>     > import serial,binascii,osc,string
>     >
>     > ser = serial.Serial()
>     > # the (USB) serial port
>     > ser.port = 6
>     > if ser.isOpen():
>     >   ser.close()
>     > ser.open()
>     >
>     > osc.init()
>     > i=10000
>     > val=''
>     > iarr=[]
>     > while i:
>     >     char = ser.read(1)
>     >     while char<>';':
>     >        val = val + char
>     >        char = ser.read(1)
>     >     print val;
>     >     iarr = [int(val)]
>     >     osc.sendMsg("/freq", iarr, "127.0.0.1", 9000) # send normal msg
>     >     i = i-1
>     >     val=''
>     >     # print i
>     >
>     > --
>     > View this message in context:
>     http://csound.1045644.n5.nabble.com/Csound-and-Arduino-attn-Jake-tp4650481p4651443.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"
>     >
>     >
> 
> 
>     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"
> 
> 


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"

Date2011-08-01 10:50
FromRory Walsh
SubjectRe: [Csnd] Re: Csound and Arduino (attn: Jake)
I'm not much a python user but would it not be easier to "import
csound" rather than an osc library? That way you can
start/stop/control Csound directly from your python code?

On 1 August 2011 10:30, joachim heintz  wrote:
> thanks, richard -
> i have installed pyosc now (serial was already there). when i run your
> script now, i get this error:
>
> Traceback (most recent call last):
>  File "/home/linux/Desktop/SerialToOsc.py", line 11, in 
>    ser.open()
>  File "/usr/lib/python2.6/dist-packages/serial/serialposix.py", line
> 175, in open
>    raise SerialException("could not open port %s: %s" % (self._port, msg))
> serial.serialutil.SerialException: could not open port 6: [Errno 2] No
> such file or directory: '/dev/ttyS6'
>
> does anyone know what this means?
> thanks -
>
>        joachim
>
>
> Am 01.08.2011 08:19, schrieb Richard van Bemmelen:
>> Hi Joachim,
>>
>> OSC and serial libraries are not standard libraries in Python.
>> So you have to download them specific for you platform.
>> I use pyosc and some serial library for PC (I got this running once on a
>> PC).
>> On my Mac I am missing the serial library too, so I have to download this.
>> I will let you know the results,
>>
>> regards,
>> Richard
>> 2011/8/1 joachim heintz >
>>
>>     hi richard -
>>     when i run your script, i get the message
>>     ImportError: No module named osc
>>     i have liblo installed - what am i missing (ubuntu 10.10)?
>>     thanks -
>>            joachim
>>
>>     Am 31.07.2011 09:54, schrieb zappfinger:
>>     > Hi Dave,
>>     >
>>     > The following minimal Python code should get you started:
>>     >
>>     > regards, Richard
>>     >
>>     >
>>     > #
>>     > #  basic serial to OSC
>>     > #
>>     > import serial,binascii,osc,string
>>     >
>>     > ser = serial.Serial()
>>     > # the (USB) serial port
>>     > ser.port = 6
>>     > if ser.isOpen():
>>     >   ser.close()
>>     > ser.open()
>>     >
>>     > osc.init()
>>     > i=10000
>>     > val=''
>>     > iarr=[]
>>     > while i:
>>     >     char = ser.read(1)
>>     >     while char<>';':
>>     >        val = val + char
>>     >        char = ser.read(1)
>>     >     print val;
>>     >     iarr = [int(val)]
>>     >     osc.sendMsg("/freq", iarr, "127.0.0.1", 9000) # send normal msg
>>     >     i = i-1
>>     >     val=''
>>     >     # print i
>>     >
>>     > --
>>     > View this message in context:
>>     http://csound.1045644.n5.nabble.com/Csound-and-Arduino-attn-Jake-tp4650481p4651443.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"
>>     >
>>     >
>>
>>
>>     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"
>>
>>
>
>
> 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"
>
>


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"


Date2011-08-01 10:52
Fromzappfinger
Subject[Csnd] Re: Csound and Arduino (attn: Jake)
Joachim,

Port 6 was specific in my case on a Windows PC.
You would have to find out what your serial port is on Ubuntu, maybe also
depending if you are using a *real* serial connection or via a USB cable.

If you are using pyserial, there are some examples on the website:
http://pyserial.sourceforge.net/shortintro.html

Richard



--
View this message in context: http://csound.1045644.n5.nabble.com/Csound-and-Arduino-attn-Jake-tp4650481p4654529.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"

Date2011-08-02 12:43
Fromzappfinger
Subject[Csnd] Re: Csound and Arduino (attn: Jake)
Ok, here is a more modern version of serial2OSC, it uses the latest pyosc and
pyserial.

Richard

#
#  basic serial to OSC, uses pyserial and pyosc libraries
#  expects serial data to be in the form:
#  ;;....
#  so integers separated by an ASCII ';'
#
import serial,binascii,OSC,string
# the serial USB port, in my case, on OS X
ser = serial.Serial('/dev/cu.usbmodem26232',baudrate = 115200, bytesize = 8,
parity = 'N', stopbits = 1)
if ser.isOpen():
  ser.close()
ser.open()

client = OSC.OSCClient()
msg = OSC.OSCMessage()
msg.setAddress("/freq")

i=100000  # just for a count-down loop
val=''
#iarr=[]
while i:  # or use: while 1: to go on forever
    char = ser.read(1)
    while char<>';':
       val = val + char
       char = ser.read(1)
    print val;
    if len(val)>0:
    	#iarr = [int(val)]
    	msg.append(int(val))
    	client.sendto(msg, ('127.0.0.1', 9000))
    i = i-1
    val=''

--
View this message in context: http://csound.1045644.n5.nabble.com/Csound-and-Arduino-attn-Jake-tp4650481p4658401.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"

Date2011-08-02 17:49
Fromzappfinger
Subject[Csnd] Re: Csound and Arduino (attn: Jake)
Ok, here is a more modern version of serial2OSC, it uses the latest pyosc and
pyserial.  
(corrected version: the msg was only appended to - is now cleared)

Richard 

#
#  basic serial to OSC, uses pyserial and pyosc libraries
#  expects serial data to be in the form:
#  ;;....
#  so integers separated by an ASCII ';'
#
import serial,binascii,OSC,string
# the serial USB port, in my case, on OS X
ser = serial.Serial('/dev/cu.usbmodem26232',baudrate = 115200, bytesize = 8,
parity = 'N', stopbits = 1)
if ser.isOpen():
  ser.close()
ser.open()

client = OSC.OSCClient()
msg = OSC.OSCMessage()
msg.setAddress("/freq")

i=100000  # just for a count-down loop
val=''
while i:  # or use: while 1: to go on forever
    char = ser.read(1)
    while char<>';':
       val = val + char
       char = ser.read(1)
    print val;
    if len(val)>0:
    	msg.clearData()
    	msg.append((val))
    	client.sendto(msg, ('127.0.0.1', 9000))
    i = i-1
    val=''

--
View this message in context: http://csound.1045644.n5.nabble.com/Csound-and-Arduino-attn-Jake-tp4650481p4659436.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"

Date2011-09-02 16:12
Fromk_o_m_p
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
I just wanted to ask if there is any developments concerning arduino and csound. I would love to see it working with csound. Is there a simple way to make arduino communicate with csound without OSC?
Best,
Luis
--
luis antunes pena
http://luisantunespena.eu



Em 31.07.11 00:29, matt ingalls escreveu:
i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:
I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1] http://csoundblog.com/2010/08/photoresistor-theremin/


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"




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"


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"






Date2011-09-02 20:30
Frommatt ingalls
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry --  i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy.. 

any suggestions on what the syntax/functionality of the opcodes should be?
maybe just:

serialPortInit SPortName, iBaudrate
String serialPortRead  SPortName ; dumps all bytes received in last k-pass
serialPortWrite SPortName, String ; sends all bytes in string in this k-pass
( serialPortClose ??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

 ; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness  oscil 255, kOscilSpeed, 1 
SarduinoOut sprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:

I just wanted to ask if there is any developments concerning arduino and csound. I would love to see it working with csound. Is there a simple way to make arduino communicate with csound without OSC?
Best,
Luis
--
luis antunes pena
http://luisantunespena.eu



Em 31.07.11 00:29, matt ingalls escreveu:
i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:
I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1] http://csoundblog.com/2010/08/photoresistor-theremin/


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"



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"

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"







Date2011-09-02 20:40
FromVictor Lazzarini
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
Why don't you place the bytes straight on a numeric variable instead of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:

i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry --  i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy.. 

any suggestions on what the syntax/functionality of the opcodes should be?
maybe just:

serialPortInit  SPortName, iBaudrate
String  serialPortRead  SPortName ; dumps all bytes received in last k-pass
serialPortWrite  SPortName, String ; sends all bytes in string in this k-pass
( serialPortClose  ??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

 ; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness  oscil 255, kOscilSpeed, 1 
SarduinoOut sprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:

I just wanted to ask if there is any developments concerning arduino and csound. I would love to see it working with csound. Is there a simple way to make arduino communicate with csound without OSC?
Best,
Luis
-- 
luis antunes pena
http://luisantunespena.eu



Em 31.07.11 00:29, matt ingalls escreveu:
i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:
I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1] http://csoundblog.com/2010/08/photoresistor-theremin/


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"



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"

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"








Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-09-02 22:08
Frommatt ingalls
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
yes , i had thought about that, but thought there might end up being some possible confusion 
since only unsigned chars are used.  so something like this would have unexpected results:

kValue = 1000
serialPortWrite  SPortName, kValue

but maybe if the opcode was named "serialWriteByte" or something that would be clear enough...
(probably also add a "serialReadByte" opcode too.)
these also would match the Serial.write() and Serial.read() functions in arduino language..



On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:

Why don't you place the bytes straight on a numeric variable instead of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:

i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry --  i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy.. 

any suggestions on what the syntax/functionality of the opcodes should be?
maybe just:

serialPortInit  SPortName, iBaudrate
String  serialPortRead  SPortName ; dumps all bytes received in last k-pass
serialPortWrite  SPortName, String ; sends all bytes in string in this k-pass
( serialPortClose  ??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

 ; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness  oscil 255, kOscilSpeed, 1 
SarduinoOut sprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:

I just wanted to ask if there is any developments concerning arduino and csound. I would love to see it working with csound. Is there a simple way to make arduino communicate with csound without OSC?
Best,
Luis
-- 
luis antunes pena
http://luisantunespena.eu



Em 31.07.11 00:29, matt ingalls escreveu:
i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:
I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1] http://csoundblog.com/2010/08/photoresistor-theremin/


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"



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"

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"








Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Date2011-09-02 22:22
FromVictor Lazzarini
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
Maybe the opcode can also deal with overflow? Plus warnings and a big notice in the man page?

Victor

On 2 Sep 2011, at 22:08, matt ingalls wrote:

yes , i had thought about that, but thought there might end up being some possible confusion 
since only unsigned chars are used.  so something like this would have unexpected results:

kValue = 1000
serialPortWrite  SPortName, kValue

but maybe if the opcode was named "serialWriteByte" or something that would be clear enough...
(probably also add a "serialReadByte" opcode too.)
these also would match the Serial.write() and Serial.read() functions in arduino language..



On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:

Why don't you place the bytes straight on a numeric variable instead of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:

i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry --  i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy.. 

any suggestions on what the syntax/functionality of the opcodes should be?
maybe just:

serialPortInit  SPortName, iBaudrate
String  serialPortRead  SPortName ; dumps all bytes received in last k-pass
serialPortWrite  SPortName, String ; sends all bytes in string in this k-pass
( serialPortClose  ??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

 ; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness  oscil 255, kOscilSpeed, 1 
SarduinoOut sprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:

I just wanted to ask if there is any developments concerning arduino and csound. I would love to see it working with csound. Is there a simple way to make arduino communicate with csound without OSC?
Best,
Luis
-- 
luis antunes pena
http://luisantunespena.eu



Em 31.07.11 00:29, matt ingalls escreveu:
i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:
I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1] http://csoundblog.com/2010/08/photoresistor-theremin/


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"



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"

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"








Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-09-02 22:26
FromVictor Lazzarini
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
In fact, this is also a problem with MIDI (even worse since it's 7-bit unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping etc, which is possibly not relevant or suitable here.

Victor
On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:

Maybe the opcode can also deal with overflow? Plus warnings and a big notice in the man page?

Victor

On 2 Sep 2011, at 22:08, matt ingalls wrote:

yes , i had thought about that, but thought there might end up being some possible confusion 
since only unsigned chars are used.  so something like this would have unexpected results:

kValue = 1000
serialPortWrite  SPortName, kValue

but maybe if the opcode was named "serialWriteByte" or something that would be clear enough...
(probably also add a "serialReadByte" opcode too.)
these also would match the Serial.write() and Serial.read() functions in arduino language..



On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:

Why don't you place the bytes straight on a numeric variable instead of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:

i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry --  i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy.. 

any suggestions on what the syntax/functionality of the opcodes should be?
maybe just:

serialPortInit  SPortName, iBaudrate
String  serialPortRead  SPortName ; dumps all bytes received in last k-pass
serialPortWrite  SPortName, String ; sends all bytes in string in this k-pass
( serialPortClose  ??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

 ; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness  oscil 255, kOscilSpeed, 1 
SarduinoOut sprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:

I just wanted to ask if there is any developments concerning arduino and csound. I would love to see it working with csound. Is there a simple way to make arduino communicate with csound without OSC?
Best,
Luis
-- 
luis antunes pena
http://luisantunespena.eu



Em 31.07.11 00:29, matt ingalls escreveu:
i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:
I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1] http://csoundblog.com/2010/08/photoresistor-theremin/


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"



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"

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"








Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-09-02 22:36
FromMartin Peach
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
So wouldn't it be better to make a serial port interface to the OSC 
commands already in csound?
It just needs a SLIP codec at each end.
Here's an example of the arduino end:
http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work

Martin


On 2011-09-02 17:26, Victor Lazzarini wrote:
> In fact, this is also a problem with MIDI (even worse since it's 7-bit
> unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
> etc, which is possibly not relevant or suitable here.
>
> Victor
> On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:
>
>> Maybe the opcode can also deal with overflow? Plus warnings and a big
>> notice in the man page?
>>
>> Victor
>>
>> On 2 Sep 2011, at 22:08, matt ingalls wrote:
>>
>>> yes , i had thought about that, but thought there might end up being
>>> some possible confusion
>>> since only unsigned chars are used. so something like this would have
>>> unexpected results:
>>>
>>> kValue = 1000
>>> serialPortWrite SPortName, kValue
>>>
>>> but maybe if the opcode was named "serialWriteByte" or something that
>>> would be clear enough...
>>> (probably also add a "serialReadByte" opcode too.)
>>> these also would match the Serial.write() and Serial.read() functions
>>> in arduino language..
>>>
>>>
>>>
>>> On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:
>>>
>>>> Why don't you place the bytes straight on a numeric variable instead
>>>> of a string? Would that not be easier for the user?
>>>>
>>>> On 2 Sep 2011, at 20:30, matt ingalls wrote:
>>>>
>>>>> i had offered port some serial bus code i have into an opcode(s).
>>>>> should work on mac pc & unix.
>>>>> sorry -- i'll try to get into it this weekend..
>>>>>
>>>>> it's been a year or so since i last was playing around with an
>>>>> arduino & serial communication
>>>>> ( i was using a macos commandline app ) so memory is a bit foggy..
>>>>>
>>>>> any suggestions on what the syntax/functionality of the opcodes
>>>>> should be?
>>>>> maybe just:
>>>>>
>>>>> serialPortInitSPortName, iBaudrate
>>>>> StringserialPortRead SPortName; dumps all bytes received in last k-pass
>>>>> serialPortWriteSPortName, String; sends all bytes in string in this
>>>>> k-pass
>>>>> (serialPortClose??needed?? )
>>>>>
>>>>> ; in use would look something like this
>>>>> instr 1
>>>>> ; open serial port to arduino
>>>>> SPortName = "/dev/tty.usbmodemfa131"
>>>>> serialPortInit SPortName, 9600
>>>>>
>>>>> ; read our knob from arduino
>>>>> SarduinoIn serialPortRead SPortName
>>>>> kInValue strtolk SarduinoIn
>>>>>
>>>>> ; make sure input is valid
>>>>> kOscilSpeed init 1
>>>>> if (kInValue > 0 && kInValue < 20) then
>>>>> kOscilSpeed = kInValue
>>>>> endif
>>>>>
>>>>> ; oscillate led brightness
>>>>> kLEDBrightness oscil 255, kOscilSpeed, 1
>>>>> SarduinoOutsprintf "%c", kLEDBrightness
>>>>> serialPortWrite SPortName, SarduinoOut
>>>>> endin
>>>>>
>>>>> On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:
>>>>>
>>>>>> I just wanted to ask if there is any developments concerning
>>>>>> arduino and csound. I would love to see it working with csound. Is
>>>>>> there a simple way to make arduino communicate with csound without
>>>>>> OSC?
>>>>>> Best,
>>>>>> Luis
>>>>>> --
>>>>>> luis antunes pena
>>>>>> http://luisantunespena.eu 
>>>>>>
>>>>>>
>>>>>>
>>>>>> Em 31.07.11 00:29, matt ingalls escreveu:
>>>>>>> i have some posix serial code ive used to make a commandline app to communicate with an arduino.
>>>>>>> probably easy to turn it into a csound opcode, if you were interested.
>>>>>>> -m
>>>>>>>
>>>>>>> On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
>>>>>>>> It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.
>>>>>>>>
>>>>>>>> Martin
>>>>>>>>
>>>>>>>>
>>>>>>>> On 2011-07-30 15:36, Dave Seidel wrote:
>>>>>>>>> I have a nice box my brother me for me with a Arduino on the inside and
>>>>>>>>> a bunch of controls on the outside (six pots, three toggles, and two
>>>>>>>>> momentary push-buttons). Up til now, I've been running Auduino firmware
>>>>>>>>> on the box and using it as a synth, which uses a subset of the controls
>>>>>>>>> (five pots).
>>>>>>>>>
>>>>>>>>> My brother has another similar box he made for himself, and has been
>>>>>>>>> using it as a hardware controller for realtime PD programs, using
>>>>>>>>> Firmata firmware on Arduino and the pduino object in PD.
>>>>>>>>>
>>>>>>>>> I'd love to be able to use my box with Csound in a similar way to what
>>>>>>>>> he's doing with PD, and I'm trying to figure out what my options are.
>>>>>>>>>
>>>>>>>>> Jake has demonstrated[1] how to use Processing and his Csoundo package
>>>>>>>>> to do something like this, but he hasn't published the code yet AFAIK.
>>>>>>>>> Jake, in your Processing code, did you use the cc.arduino package (which
>>>>>>>>> talks to Firmata) or did you write your own serial code? Would you be
>>>>>>>>> willing to make your Processing sources available?
>>>>>>>>>
>>>>>>>>> I'm also interested in hearing if anyone else has succeeded is using an
>>>>>>>>> Arduino with Csound. I know some options have been discussed, e.g. using
>>>>>>>>> OSC, which would require either an Arduino shield with OSC support or
>>>>>>>>> some intermediate software between Csound and the Arduino to translate
>>>>>>>>> between serial and OSC. I think someone suggested doing this in Python,
>>>>>>>>> which is reasonable, but it also would make sense to do this in
>>>>>>>>> Processing. Has anyone tried either of these approaches, and if so,
>>>>>>>>> would you consider sharing your work?
>>>>>>>>>
>>>>>>>>> Thanks in advance for any input.
>>>>>>>>>
>>>>>>>>> - Dave
>>>>>>>>>
>>>>>>>>> [1]http://csoundblog.com/2010/08/photoresistor-theremin/
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> 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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"
>>>>>>>>
>>>>>>> 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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.:+353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>
>>
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.:+353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.:+353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>



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"

Date2011-09-02 23:17
Frommatt ingalls
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
oh, i would have thought the OSC opcodes work on network, not serial ports -- but i really know
nothing about all that stuff...

at any rate, it would be nice to not have to use all that arduino code on adrian's page anyway!
(instead, just use the native Serial.read()/write() in your arduino code)

for the computer side, the POSIX serial code i am using (with author's permission) is pretty straight forward:
http://todbot.com/arduino/host/arduino-serial/arduino-serial.c
and should be fairly trivial to turn into csound opcode.


On Sep 2, 2011, at 2:36 PM, Martin Peach wrote:

> So wouldn't it be better to make a serial port interface to the OSC commands already in csound?
> It just needs a SLIP codec at each end.
> Here's an example of the arduino end:
> http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work
> 
> Martin
> 
> 
> On 2011-09-02 17:26, Victor Lazzarini wrote:
>> In fact, this is also a problem with MIDI (even worse since it's 7-bit
>> unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
>> etc, which is possibly not relevant or suitable here.
>> 
>> Victor
>> On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:
>> 
>>> Maybe the opcode can also deal with overflow? Plus warnings and a big
>>> notice in the man page?
>>> 
>>> Victor
>>> 
>>> On 2 Sep 2011, at 22:08, matt ingalls wrote:
>>> 
>>>> yes , i had thought about that, but thought there might end up being
>>>> some possible confusion
>>>> since only unsigned chars are used. so something like this would have
>>>> unexpected results:
>>>> 
>>>> kValue = 1000
>>>> serialPortWrite SPortName, kValue
>>>> 
>>>> but maybe if the opcode was named "serialWriteByte" or something that
>>>> would be clear enough...
>>>> (probably also add a "serialReadByte" opcode too.)
>>>> these also would match the Serial.write() and Serial.read() functions
>>>> in arduino language..
>>>> 
>>>> 
>>>> 
>>>> On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:
>>>> 
>>>>> Why don't you place the bytes straight on a numeric variable instead
>>>>> of a string? Would that not be easier for the user?
>>>>> 
>>>>> On 2 Sep 2011, at 20:30, matt ingalls wrote:
>>>>> 
>>>>>> i had offered port some serial bus code i have into an opcode(s).
>>>>>> should work on mac pc & unix.
>>>>>> sorry -- i'll try to get into it this weekend..
>>>>>> 
>>>>>> it's been a year or so since i last was playing around with an
>>>>>> arduino & serial communication
>>>>>> ( i was using a macos commandline app ) so memory is a bit foggy..
>>>>>> 
>>>>>> any suggestions on what the syntax/functionality of the opcodes
>>>>>> should be?
>>>>>> maybe just:
>>>>>> 
>>>>>> serialPortInitSPortName, iBaudrate
>>>>>> StringserialPortRead SPortName; dumps all bytes received in last k-pass
>>>>>> serialPortWriteSPortName, String; sends all bytes in string in this
>>>>>> k-pass
>>>>>> (serialPortClose??needed?? )
>>>>>> 
>>>>>> ; in use would look something like this
>>>>>> instr 1
>>>>>> ; open serial port to arduino
>>>>>> SPortName = "/dev/tty.usbmodemfa131"
>>>>>> serialPortInit SPortName, 9600
>>>>>> 
>>>>>> ; read our knob from arduino
>>>>>> SarduinoIn serialPortRead SPortName
>>>>>> kInValue strtolk SarduinoIn
>>>>>> 
>>>>>> ; make sure input is valid
>>>>>> kOscilSpeed init 1
>>>>>> if (kInValue > 0 && kInValue < 20) then
>>>>>> kOscilSpeed = kInValue
>>>>>> endif
>>>>>> 
>>>>>> ; oscillate led brightness
>>>>>> kLEDBrightness oscil 255, kOscilSpeed, 1
>>>>>> SarduinoOutsprintf "%c", kLEDBrightness
>>>>>> serialPortWrite SPortName, SarduinoOut
>>>>>> endin
>>>>>> 
>>>>>> On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:
>>>>>> 
>>>>>>> I just wanted to ask if there is any developments concerning
>>>>>>> arduino and csound. I would love to see it working with csound. Is
>>>>>>> there a simple way to make arduino communicate with csound without
>>>>>>> OSC?
>>>>>>> Best,
>>>>>>> Luis
>>>>>>> --
>>>>>>> luis antunes pena
>>>>>>> http://luisantunespena.eu 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Em 31.07.11 00:29, matt ingalls escreveu:
>>>>>>>> i have some posix serial code ive used to make a commandline app to communicate with an arduino.
>>>>>>>> probably easy to turn it into a csound opcode, if you were interested.
>>>>>>>> -m
>>>>>>>> 
>>>>>>>> On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
>>>>>>>>> It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.
>>>>>>>>> 
>>>>>>>>> Martin
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 2011-07-30 15:36, Dave Seidel wrote:
>>>>>>>>>> I have a nice box my brother me for me with a Arduino on the inside and
>>>>>>>>>> a bunch of controls on the outside (six pots, three toggles, and two
>>>>>>>>>> momentary push-buttons). Up til now, I've been running Auduino firmware
>>>>>>>>>> on the box and using it as a synth, which uses a subset of the controls
>>>>>>>>>> (five pots).
>>>>>>>>>> 
>>>>>>>>>> My brother has another similar box he made for himself, and has been
>>>>>>>>>> using it as a hardware controller for realtime PD programs, using
>>>>>>>>>> Firmata firmware on Arduino and the pduino object in PD.
>>>>>>>>>> 
>>>>>>>>>> I'd love to be able to use my box with Csound in a similar way to what
>>>>>>>>>> he's doing with PD, and I'm trying to figure out what my options are.
>>>>>>>>>> 
>>>>>>>>>> Jake has demonstrated[1] how to use Processing and his Csoundo package
>>>>>>>>>> to do something like this, but he hasn't published the code yet AFAIK.
>>>>>>>>>> Jake, in your Processing code, did you use the cc.arduino package (which
>>>>>>>>>> talks to Firmata) or did you write your own serial code? Would you be
>>>>>>>>>> willing to make your Processing sources available?
>>>>>>>>>> 
>>>>>>>>>> I'm also interested in hearing if anyone else has succeeded is using an
>>>>>>>>>> Arduino with Csound. I know some options have been discussed, e.g. using
>>>>>>>>>> OSC, which would require either an Arduino shield with OSC support or
>>>>>>>>>> some intermediate software between Csound and the Arduino to translate
>>>>>>>>>> between serial and OSC. I think someone suggested doing this in Python,
>>>>>>>>>> which is reasonable, but it also would make sense to do this in
>>>>>>>>>> Processing. Has anyone tried either of these approaches, and if so,
>>>>>>>>>> would you consider sharing your work?
>>>>>>>>>> 
>>>>>>>>>> Thanks in advance for any input.
>>>>>>>>>> 
>>>>>>>>>> - Dave
>>>>>>>>>> 
>>>>>>>>>> [1]http://csoundblog.com/2010/08/photoresistor-theremin/
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"
>>>>>>>>> 
>>>>>>>> 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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.:+353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.:+353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>> 
>>> 
>>> 
>> 
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.:+353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>> 
>> 
>> 
> 
> 
> 
> 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"
> 



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"


Date2011-09-03 21:16
Frommatt ingalls
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
OK, how about this 
(names/functionality mirrored from arduino language)



 iPort  serialBegin         SPortName [, baudRate ]
::::: opens a port.  baudRate defaults to 9600
 
        serialEnd           iPort
::::: closes a port.
 
 kNum   serialAvailable    iPort
::::: returns number of bytes available to read
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
 
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
kByte   serialPeekByte      iPort
::::: returns the next byte in the input buffer
::::: does not remove the byte from the buffer
 
        serialFlush         iPort
::::: clears the input buffer
 
        serialWrite         iPort, Sbytes
::::: sends a buffer of bytes  as a string
 
        serialWriteByte     iPort, kByte
::::: sends a byte of data. 
::::: kByte will be cast to an 1-byte integer (0-255) before sending



On Sep 2, 2011, at 3:17 PM, matt ingalls wrote:

> oh, i would have thought the OSC opcodes work on network, not serial ports -- but i really know
> nothing about all that stuff...
> 
> at any rate, it would be nice to not have to use all that arduino code on adrian's page anyway!
> (instead, just use the native Serial.read()/write() in your arduino code)
> 
> for the computer side, the POSIX serial code i am using (with author's permission) is pretty straight forward:
> http://todbot.com/arduino/host/arduino-serial/arduino-serial.c
> and should be fairly trivial to turn into csound opcode.
> 
> 
> On Sep 2, 2011, at 2:36 PM, Martin Peach wrote:
> 
>> So wouldn't it be better to make a serial port interface to the OSC commands already in csound?
>> It just needs a SLIP codec at each end.
>> Here's an example of the arduino end:
>> http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work
>> 
>> Martin
>> 
>> 
>> On 2011-09-02 17:26, Victor Lazzarini wrote:
>>> In fact, this is also a problem with MIDI (even worse since it's 7-bit
>>> unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
>>> etc, which is possibly not relevant or suitable here.
>>> 
>>> Victor
>>> On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:
>>> 
>>>> Maybe the opcode can also deal with overflow? Plus warnings and a big
>>>> notice in the man page?
>>>> 
>>>> Victor
>>>> 
>>>> On 2 Sep 2011, at 22:08, matt ingalls wrote:
>>>> 
>>>>> yes , i had thought about that, but thought there might end up being
>>>>> some possible confusion
>>>>> since only unsigned chars are used. so something like this would have
>>>>> unexpected results:
>>>>> 
>>>>> kValue = 1000
>>>>> serialPortWrite SPortName, kValue
>>>>> 
>>>>> but maybe if the opcode was named "serialWriteByte" or something that
>>>>> would be clear enough...
>>>>> (probably also add a "serialReadByte" opcode too.)
>>>>> these also would match the Serial.write() and Serial.read() functions
>>>>> in arduino language..
>>>>> 
>>>>> 
>>>>> 
>>>>> On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:
>>>>> 
>>>>>> Why don't you place the bytes straight on a numeric variable instead
>>>>>> of a string? Would that not be easier for the user?
>>>>>> 
>>>>>> On 2 Sep 2011, at 20:30, matt ingalls wrote:
>>>>>> 
>>>>>>> i had offered port some serial bus code i have into an opcode(s).
>>>>>>> should work on mac pc & unix.
>>>>>>> sorry -- i'll try to get into it this weekend..
>>>>>>> 
>>>>>>> it's been a year or so since i last was playing around with an
>>>>>>> arduino & serial communication
>>>>>>> ( i was using a macos commandline app ) so memory is a bit foggy..
>>>>>>> 
>>>>>>> any suggestions on what the syntax/functionality of the opcodes
>>>>>>> should be?
>>>>>>> maybe just:
>>>>>>> 
>>>>>>> serialPortInitSPortName, iBaudrate
>>>>>>> StringserialPortRead SPortName; dumps all bytes received in last k-pass
>>>>>>> serialPortWriteSPortName, String; sends all bytes in string in this
>>>>>>> k-pass
>>>>>>> (serialPortClose??needed?? )
>>>>>>> 
>>>>>>> ; in use would look something like this
>>>>>>> instr 1
>>>>>>> ; open serial port to arduino
>>>>>>> SPortName = "/dev/tty.usbmodemfa131"
>>>>>>> serialPortInit SPortName, 9600
>>>>>>> 
>>>>>>> ; read our knob from arduino
>>>>>>> SarduinoIn serialPortRead SPortName
>>>>>>> kInValue strtolk SarduinoIn
>>>>>>> 
>>>>>>> ; make sure input is valid
>>>>>>> kOscilSpeed init 1
>>>>>>> if (kInValue > 0 && kInValue < 20) then
>>>>>>> kOscilSpeed = kInValue
>>>>>>> endif
>>>>>>> 
>>>>>>> ; oscillate led brightness
>>>>>>> kLEDBrightness oscil 255, kOscilSpeed, 1
>>>>>>> SarduinoOutsprintf "%c", kLEDBrightness
>>>>>>> serialPortWrite SPortName, SarduinoOut
>>>>>>> endin
>>>>>>> 
>>>>>>> On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:
>>>>>>> 
>>>>>>>> I just wanted to ask if there is any developments concerning
>>>>>>>> arduino and csound. I would love to see it working with csound. Is
>>>>>>>> there a simple way to make arduino communicate with csound without
>>>>>>>> OSC?
>>>>>>>> Best,
>>>>>>>> Luis
>>>>>>>> --
>>>>>>>> luis antunes pena
>>>>>>>> http://luisantunespena.eu 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Em 31.07.11 00:29, matt ingalls escreveu:
>>>>>>>>> i have some posix serial code ive used to make a commandline app to communicate with an arduino.
>>>>>>>>> probably easy to turn it into a csound opcode, if you were interested.
>>>>>>>>> -m
>>>>>>>>> 
>>>>>>>>> On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
>>>>>>>>>> It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.
>>>>>>>>>> 
>>>>>>>>>> Martin
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On 2011-07-30 15:36, Dave Seidel wrote:
>>>>>>>>>>> I have a nice box my brother me for me with a Arduino on the inside and
>>>>>>>>>>> a bunch of controls on the outside (six pots, three toggles, and two
>>>>>>>>>>> momentary push-buttons). Up til now, I've been running Auduino firmware
>>>>>>>>>>> on the box and using it as a synth, which uses a subset of the controls
>>>>>>>>>>> (five pots).
>>>>>>>>>>> 
>>>>>>>>>>> My brother has another similar box he made for himself, and has been
>>>>>>>>>>> using it as a hardware controller for realtime PD programs, using
>>>>>>>>>>> Firmata firmware on Arduino and the pduino object in PD.
>>>>>>>>>>> 
>>>>>>>>>>> I'd love to be able to use my box with Csound in a similar way to what
>>>>>>>>>>> he's doing with PD, and I'm trying to figure out what my options are.
>>>>>>>>>>> 
>>>>>>>>>>> Jake has demonstrated[1] how to use Processing and his Csoundo package
>>>>>>>>>>> to do something like this, but he hasn't published the code yet AFAIK.
>>>>>>>>>>> Jake, in your Processing code, did you use the cc.arduino package (which
>>>>>>>>>>> talks to Firmata) or did you write your own serial code? Would you be
>>>>>>>>>>> willing to make your Processing sources available?
>>>>>>>>>>> 
>>>>>>>>>>> I'm also interested in hearing if anyone else has succeeded is using an
>>>>>>>>>>> Arduino with Csound. I know some options have been discussed, e.g. using
>>>>>>>>>>> OSC, which would require either an Arduino shield with OSC support or
>>>>>>>>>>> some intermediate software between Csound and the Arduino to translate
>>>>>>>>>>> between serial and OSC. I think someone suggested doing this in Python,
>>>>>>>>>>> which is reasonable, but it also would make sense to do this in
>>>>>>>>>>> Processing. Has anyone tried either of these approaches, and if so,
>>>>>>>>>>> would you consider sharing your work?
>>>>>>>>>>> 
>>>>>>>>>>> Thanks in advance for any input.
>>>>>>>>>>> 
>>>>>>>>>>> - Dave
>>>>>>>>>>> 
>>>>>>>>>>> [1]http://csoundblog.com/2010/08/photoresistor-theremin/
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"
>>>>>>>>>> 
>>>>>>>>> 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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.:+353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.:+353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>> 
>>>> 
>>>> 
>>> 
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.:+353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>> 
>>> 
>>> 
>> 
>> 
>> 
>> 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"
>> 
> 
> 
> 
> 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"
> 



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"


Date2011-09-03 21:44
Fromk_o_m_p
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
I recently found this minitronic http://minitronics.net which uses HID. Has anyone tried this with csound? Is it possible to use HID with csound?
Best,
Luis

Em 03.09.11 22:16, matt ingalls escreveu:
OK, how about this 
(names/functionality mirrored from arduino language)



 iPort  serialBegin         SPortName [, baudRate ]
::::: opens a port.  baudRate defaults to 9600
 
        serialEnd           iPort
::::: closes a port.
 
 kNum   serialAvailable    iPort
::::: returns number of bytes available to read
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
 
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
kByte   serialPeekByte      iPort
::::: returns the next byte in the input buffer
::::: does not remove the byte from the buffer
 
        serialFlush         iPort
::::: clears the input buffer
 
        serialWrite         iPort, Sbytes
::::: sends a buffer of bytes  as a string
 
        serialWriteByte     iPort, kByte
::::: sends a byte of data. 
::::: kByte will be cast to an 1-byte integer (0-255) before sending



On Sep 2, 2011, at 3:17 PM, matt ingalls wrote:

oh, i would have thought the OSC opcodes work on network, not serial ports -- but i really know
nothing about all that stuff...

at any rate, it would be nice to not have to use all that arduino code on adrian's page anyway!
(instead, just use the native Serial.read()/write() in your arduino code)

for the computer side, the POSIX serial code i am using (with author's permission) is pretty straight forward:
http://todbot.com/arduino/host/arduino-serial/arduino-serial.c
and should be fairly trivial to turn into csound opcode.


On Sep 2, 2011, at 2:36 PM, Martin Peach wrote:

So wouldn't it be better to make a serial port interface to the OSC commands already in csound?
It just needs a SLIP codec at each end.
Here's an example of the arduino end:
http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work

Martin


On 2011-09-02 17:26, Victor Lazzarini wrote:
In fact, this is also a problem with MIDI (even worse since it's 7-bit
unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
etc, which is possibly not relevant or suitable here.

Victor
On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:

Maybe the opcode can also deal with overflow? Plus warnings and a big
notice in the man page?

Victor

On 2 Sep 2011, at 22:08, matt ingalls wrote:

yes , i had thought about that, but thought there might end up being
some possible confusion
since only unsigned chars are used. so something like this would have
unexpected results:

kValue = 1000
serialPortWrite SPortName, kValue

but maybe if the opcode was named "serialWriteByte" or something that
would be clear enough...
(probably also add a "serialReadByte" opcode too.)
these also would match the Serial.write() and Serial.read() functions
in arduino language..



On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:

Why don't you place the bytes straight on a numeric variable instead
of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:

i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry -- i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an
arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy..

any suggestions on what the syntax/functionality of the opcodes
should be?
maybe just:

serialPortInitSPortName, iBaudrate
StringserialPortRead SPortName; dumps all bytes received in last k-pass
serialPortWriteSPortName, String; sends all bytes in string in this
k-pass
(serialPortClose??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness oscil 255, kOscilSpeed, 1
SarduinoOutsprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:

I just wanted to ask if there is any developments concerning
arduino and csound. I would love to see it working with csound. Is
there a simple way to make arduino communicate with csound without
OSC?
Best,
Luis
--
luis antunes pena
http://luisantunespena.eu <http://luisantunespena.eu/>



Em 31.07.11 00:29, matt ingalls escreveu:
i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:
I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1]http://csoundblog.com/2010/08/photoresistor-theremin/


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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"



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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"

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 emailsympa@lists.bath.ac.uk  with body "unsubscribe csound"







--
signatur luis antunes pena
Severinswall 54
D-50678 Köln

http://luisantunespena.eu

+49 (0)221 29020757
+49 (0)176 968 09 867 (mobile)

Date2011-09-04 21:59
Frommatt ingalls
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
ok -- i think i'm done with the serial opcodes..  :)
  anyone on a mac & arduino want to test it out? 

( i'll post code to dev list for those who want to compile on other platforms )

ended up with these opcodes (Victor, you were right!)


open a port.  baudRate defaults to 9600
	iPort  	serialBegin         SPortName [, baudRate ]

 
close a port
			serialEnd           iPort


write byte(s) to the port, at i or k rate
			serialWrite_i       iPort, iByte
			serialWrite_i       iPort, kByte
			serialWrite_i       iPort, Sbytes
			serialWrite         iPort, iByte
			serialWrite         iPort, kByte
			serialWrite         iPort, Sbytes


read the next byte from the input buffer
returned value will be in the range of 0-255
	kByte	serialRead          iPort
    
    
prints to screen any bytes (up to 32k) in input buffer
note that these bytes will be cleared from the buffer.
use this opcode mainly for debugging messages.
if you want to mix debugging and other communication 
messages over the same port, you will need to manually
parse the data with the serialRead opcode.
			serialPrint			iPort

 
clear the input buffer
			serialFlush         iPort

 
 TODO: 
(might not be worth the effort implement?)
 
 returns number of bytes available to read
 	kNum   serialAvailable    iPort
 
 returns the next byte in the input buffer
 does not remove the byte from the buffer
 	kByte   serialPeekByte      iPort




 
> 
> 16, matt ingalls escreveu:
>> OK, how about this 
>> (names/functionality mirrored from arduino language)
>> 
>> 
>> 
>>  iPort  serialBegin         SPortName [, baudRate ]
>> ::::: opens a port.  baudRate defaults to 9600
>>  
>>         serialEnd           iPort
>> ::::: closes a port.
>>  
>>  kNum   serialAvailable    iPort
>> ::::: returns number of bytes available to read
>>  
>> Sbytes  serialRead          iPort
>> ::::: returns all input bytes available as a string
>>  
>> kByte   serialReadByte      iPort
>> ::::: returns the next byte in the input buffer
>> ::::: returned value will be in the range of 0-255
>>  
>> kByte   serialPeekByte      iPort
>> ::::: returns the next byte in the input buffer
>> ::::: does not remove the byte from the buffer
>>  
>>         serialFlush         iPort
>> ::::: clears the input buffer
>>  
>>         serialWrite         iPort, Sbytes
>> ::::: sends a buffer of bytes  as a string
>>  
>>         serialWriteByte     iPort, kByte
>> ::::: sends a byte of data. 
>> ::::: kByte will be cast to an 1-byte integer (0-255) before sending
>> 
>> 
>> 
>> On Sep 2, 2011, at 3:17 PM, matt ingalls wrote:
>> 
>> 
>>> oh, i would have thought the OSC opcodes work on network, not serial ports -- but i really know
>>> nothing about all that stuff...
>>> 
>>> at any rate, it would be nice to not have to use all that arduino code on adrian's page anyway!
>>> (instead, just use the native Serial.read()/write() in your arduino code)
>>> 
>>> for the computer side, the POSIX serial code i am using (with author's permission) is pretty straight forward:
>>> 
>>> http://todbot.com/arduino/host/arduino-serial/arduino-serial.c
>>> 
>>> and should be fairly trivial to turn into csound opcode.
>>> 
>>> 
>>> On Sep 2, 2011, at 2:36 PM, Martin Peach wrote:
>>> 
>>> 
>>>> So wouldn't it be better to make a serial port interface to the OSC commands already in csound?
>>>> It just needs a SLIP codec at each end.
>>>> Here's an example of the arduino end:
>>>> 
>>>> http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work
>>>> 
>>>> 
>>>> Martin
>>>> 
>>>> 
>>>> On 2011-09-02 17:26, Victor Lazzarini wrote:
>>>> 
>>>>> In fact, this is also a problem with MIDI (even worse since it's 7-bit
>>>>> unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
>>>>> etc, which is possibly not relevant or suitable here.
>>>>> 
>>>>> Victor
>>>>> On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:
>>>>> 
>>>>> 
>>>>>> Maybe the opcode can also deal with overflow? Plus warnings and a big
>>>>>> notice in the man page?
>>>>>> 
>>>>>> Victor
>>>>>> 
>>>>>> On 2 Sep 2011, at 22:08, matt ingalls wrote:
>>>>>> 
>>>>>> 
>>>>>>> yes , i had thought about that, but thought there might end up being
>>>>>>> some possible confusion
>>>>>>> since only unsigned chars are used. so something like this would have
>>>>>>> unexpected results:
>>>>>>> 
>>>>>>> kValue = 1000
>>>>>>> serialPortWrite SPortName, kValue
>>>>>>> 
>>>>>>> but maybe if the opcode was named "serialWriteByte" or something that
>>>>>>> would be clear enough...
>>>>>>> (probably also add a "serialReadByte" opcode too.)
>>>>>>> these also would match the Serial.write() and Serial.read() functions
>>>>>>> in arduino language..
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:
>>>>>>> 
>>>>>>> 
>>>>>>>> Why don't you place the bytes straight on a numeric variable instead
>>>>>>>> of a string? Would that not be easier for the user?
>>>>>>>> 
>>>>>>>> On 2 Sep 2011, at 20:30, matt ingalls wrote:
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> i had offered port some serial bus code i have into an opcode(s).
>>>>>>>>> should work on mac pc & unix.
>>>>>>>>> sorry -- i'll try to get into it this weekend..
>>>>>>>>> 
>>>>>>>>> it's been a year or so since i last was playing around with an
>>>>>>>>> arduino & serial communication
>>>>>>>>> ( i was using a macos commandline app ) so memory is a bit foggy..
>>>>>>>>> 
>>>>>>>>> any suggestions on what the syntax/functionality of the opcodes
>>>>>>>>> should be?
>>>>>>>>> maybe just:
>>>>>>>>> 
>>>>>>>>> serialPortInitSPortName, iBaudrate
>>>>>>>>> StringserialPortRead SPortName; dumps all bytes received in last k-pass
>>>>>>>>> serialPortWriteSPortName, String; sends all bytes in string in this
>>>>>>>>> k-pass
>>>>>>>>> (serialPortClose??needed?? )
>>>>>>>>> 
>>>>>>>>> ; in use would look something like this
>>>>>>>>> instr 1
>>>>>>>>> ; open serial port to arduino
>>>>>>>>> SPortName = "/dev/tty.usbmodemfa131"
>>>>>>>>> serialPortInit SPortName, 9600
>>>>>>>>> 
>>>>>>>>> ; read our knob from arduino
>>>>>>>>> SarduinoIn serialPortRead SPortName
>>>>>>>>> kInValue strtolk SarduinoIn
>>>>>>>>> 
>>>>>>>>> ; make sure input is valid
>>>>>>>>> kOscilSpeed init 1
>>>>>>>>> if (kInValue > 0 && kInValue < 20) then
>>>>>>>>> kOscilSpeed = kInValue
>>>>>>>>> endif
>>>>>>>>> 
>>>>>>>>> ; oscillate led brightness
>>>>>>>>> kLEDBrightness oscil 255, kOscilSpeed, 1
>>>>>>>>> SarduinoOutsprintf "%c", kLEDBrightness
>>>>>>>>> serialPortWrite SPortName, SarduinoOut
>>>>>>>>> endin
>>>>>>>>> 
>>>>>>>>> On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> I just wanted to ask if there is any developments concerning
>>>>>>>>>> arduino and csound. I would love to see it working with csound. Is
>>>>>>>>>> there a simple way to make arduino communicate with csound without
>>>>>>>>>> OSC?
>>>>>>>>>> Best,
>>>>>>>>>> Luis
>>>>>>>>>> --
>>>>>>>>>> luis antunes pena
>>>>>>>>>> 
>>>>>>>>>> http://luisantunespena.eu 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Em 31.07.11 00:29, matt ingalls escreveu:
>>>>>>>>>> 
>>>>>>>>>>> i have some posix serial code ive used to make a commandline app to communicate with an arduino.
>>>>>>>>>>> probably easy to turn it into a csound opcode, if you were interested.
>>>>>>>>>>> -m
>>>>>>>>>>> 
>>>>>>>>>>> On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:
>>>>>>>>>>> 
>>>>>>>>>>>> It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.
>>>>>>>>>>>> 
>>>>>>>>>>>> Martin
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> On 2011-07-30 15:36, Dave Seidel wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>>> I have a nice box my brother me for me with a Arduino on the inside and
>>>>>>>>>>>>> a bunch of controls on the outside (six pots, three toggles, and two
>>>>>>>>>>>>> momentary push-buttons). Up til now, I've been running Auduino firmware
>>>>>>>>>>>>> on the box and using it as a synth, which uses a subset of the controls
>>>>>>>>>>>>> (five pots).
>>>>>>>>>>>>> 
>>>>>>>>>>>>> My brother has another similar box he made for himself, and has been
>>>>>>>>>>>>> using it as a hardware controller for realtime PD programs, using
>>>>>>>>>>>>> Firmata firmware on Arduino and the pduino object in PD.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> I'd love to be able to use my box with Csound in a similar way to what
>>>>>>>>>>>>> he's doing with PD, and I'm trying to figure out what my options are.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Jake has demonstrated[1] how to use Processing and his Csoundo package
>>>>>>>>>>>>> to do something like this, but he hasn't published the code yet AFAIK.
>>>>>>>>>>>>> Jake, in your Processing code, did you use the cc.arduino package (which
>>>>>>>>>>>>> talks to Firmata) or did you write your own serial code? Would you be
>>>>>>>>>>>>> willing to make your Processing sources available?
>>>>>>>>>>>>> 
>>>>>>>>>>>>> I'm also interested in hearing if anyone else has succeeded is using an
>>>>>>>>>>>>> Arduino with Csound. I know some options have been discussed, e.g. using
>>>>>>>>>>>>> OSC, which would require either an Arduino shield with OSC support or
>>>>>>>>>>>>> some intermediate software between Csound and the Arduino to translate
>>>>>>>>>>>>> between serial and OSC. I think someone suggested doing this in Python,
>>>>>>>>>>>>> which is reasonable, but it also would make sense to do this in
>>>>>>>>>>>>> Processing. Has anyone tried either of these approaches, and if so,
>>>>>>>>>>>>> would you consider sharing your work?
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Thanks in advance for any input.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> - Dave
>>>>>>>>>>>>> 
>>>>>>>>>>>>> [1]
>>>>>>>>>>>>> http://csoundblog.com/2010/08/photoresistor-theremin/
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 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 
>>>>>>>>>>>>> emailsympa@lists.bath.ac.uk
>>>>>>>>>>>>>   with body "unsubscribe csound"
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>> 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 
>>>>>>>>>>>> emailsympa@lists.bath.ac.uk
>>>>>>>>>>>>   with body "unsubscribe csound"
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 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 
>>>>>>>>>>> emailsympa@lists.bath.ac.uk
>>>>>>>>>>>   with body "unsubscribe csound"
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
> 
> -- 
> luis antunes pena
> Severinswall 54
> D-50678 Köln
> 
> http://luisantunespena.eu
> 
> +49 (0)221 29020757
> +49 (0)176 968 09 867 (mobile)



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"


Date2011-09-04 22:05
Fromk_o_m_p
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
That's fantastic Matt. Thank you very much. As soon as I get my Arduino I'll test it.
Luis

Em 04.09.11 22:59, matt ingalls escreveu:
ok -- i think i'm done with the serial opcodes..  :)
  anyone on a mac & arduino want to test it out? 

( i'll post code to dev list for those who want to compile on other platforms )

ended up with these opcodes (Victor, you were right!)


open a port.  baudRate defaults to 9600
	iPort  	serialBegin         SPortName [, baudRate ]

 
close a port
			serialEnd           iPort


write byte(s) to the port, at i or k rate
			serialWrite_i       iPort, iByte
			serialWrite_i       iPort, kByte
			serialWrite_i       iPort, Sbytes
			serialWrite         iPort, iByte
			serialWrite         iPort, kByte
			serialWrite         iPort, Sbytes


read the next byte from the input buffer
returned value will be in the range of 0-255
	kByte	serialRead          iPort
    
    
prints to screen any bytes (up to 32k) in input buffer
note that these bytes will be cleared from the buffer.
use this opcode mainly for debugging messages.
if you want to mix debugging and other communication 
messages over the same port, you will need to manually
parse the data with the serialRead opcode.
			serialPrint			iPort

 
clear the input buffer
			serialFlush         iPort

 
 TODO: 
(might not be worth the effort implement?)
 
 returns number of bytes available to read
 	kNum   serialAvailable    iPort
 
 returns the next byte in the input buffer
 does not remove the byte from the buffer
 	kByte   serialPeekByte      iPort




 
16, matt ingalls escreveu:
OK, how about this 
(names/functionality mirrored from arduino language)



 iPort  serialBegin         SPortName [, baudRate ]
::::: opens a port.  baudRate defaults to 9600
 
        serialEnd           iPort
::::: closes a port.
 
 kNum   serialAvailable    iPort
::::: returns number of bytes available to read
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
 
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
kByte   serialPeekByte      iPort
::::: returns the next byte in the input buffer
::::: does not remove the byte from the buffer
 
        serialFlush         iPort
::::: clears the input buffer
 
        serialWrite         iPort, Sbytes
::::: sends a buffer of bytes  as a string
 
        serialWriteByte     iPort, kByte
::::: sends a byte of data. 
::::: kByte will be cast to an 1-byte integer (0-255) before sending



On Sep 2, 2011, at 3:17 PM, matt ingalls wrote:


oh, i would have thought the OSC opcodes work on network, not serial ports -- but i really know
nothing about all that stuff...

at any rate, it would be nice to not have to use all that arduino code on adrian's page anyway!
(instead, just use the native Serial.read()/write() in your arduino code)

for the computer side, the POSIX serial code i am using (with author's permission) is pretty straight forward:

http://todbot.com/arduino/host/arduino-serial/arduino-serial.c

and should be fairly trivial to turn into csound opcode.


On Sep 2, 2011, at 2:36 PM, Martin Peach wrote:


So wouldn't it be better to make a serial port interface to the OSC commands already in csound?
It just needs a SLIP codec at each end.
Here's an example of the arduino end:

http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work


Martin


On 2011-09-02 17:26, Victor Lazzarini wrote:

In fact, this is also a problem with MIDI (even worse since it's 7-bit
unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
etc, which is possibly not relevant or suitable here.

Victor
On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:


Maybe the opcode can also deal with overflow? Plus warnings and a big
notice in the man page?

Victor

On 2 Sep 2011, at 22:08, matt ingalls wrote:


yes , i had thought about that, but thought there might end up being
some possible confusion
since only unsigned chars are used. so something like this would have
unexpected results:

kValue = 1000
serialPortWrite SPortName, kValue

but maybe if the opcode was named "serialWriteByte" or something that
would be clear enough...
(probably also add a "serialReadByte" opcode too.)
these also would match the Serial.write() and Serial.read() functions
in arduino language..



On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:


Why don't you place the bytes straight on a numeric variable instead
of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:


i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry -- i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an
arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy..

any suggestions on what the syntax/functionality of the opcodes
should be?
maybe just:

serialPortInitSPortName, iBaudrate
StringserialPortRead SPortName; dumps all bytes received in last k-pass
serialPortWriteSPortName, String; sends all bytes in string in this
k-pass
(serialPortClose??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness oscil 255, kOscilSpeed, 1
SarduinoOutsprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:


I just wanted to ask if there is any developments concerning
arduino and csound. I would love to see it working with csound. Is
there a simple way to make arduino communicate with csound without
OSC?
Best,
Luis
--
luis antunes pena

http://luisantunespena.eu <http://luisantunespena.eu/>




Em 31.07.11 00:29, matt ingalls escreveu:

i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:

It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:

I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1]
http://csoundblog.com/2010/08/photoresistor-theremin/



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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"




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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"


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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"






                      

                    

Date2011-09-05 12:28
FromOeyvind Brandtsegg
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
+1, yes, this is very nice.
 
I wonder if it would be ok to also have the "read input buffer as string" functionality?
It might make it easier to parse in some cases.
So, keep both of these:
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
It could perhaps be named serialReadString and serial ReadNum(?), but any naming scheme would be fine.
 
best
Oeyvind
 

 
2011/9/4 k_o_m_p <k_o_m_p@yahoo.de>
That's fantastic Matt. Thank you very much. As soon as I get my Arduino I'll test it.
Luis

Em 04.09.11 22:59, matt ingalls escreveu:
ok -- i think i'm done with the serial opcodes..  :)
  anyone on a mac & arduino want to test it out? 

( i'll post code to dev list for those who want to compile on other platforms )

ended up with these opcodes (Victor, you were right!)


open a port.  baudRate defaults to 9600
	iPort  	serialBegin         SPortName [, baudRate ]

 
close a port
			serialEnd           iPort


write byte(s) to the port, at i or k rate
			serialWrite_i       iPort, iByte
			serialWrite_i       iPort, kByte
			serialWrite_i       iPort, Sbytes
			serialWrite         iPort, iByte
			serialWrite         iPort, kByte
			serialWrite         iPort, Sbytes


read the next byte from the input buffer
returned value will be in the range of 0-255
	kByte	serialRead          iPort
    
    
prints to screen any bytes (up to 32k) in input buffer
note that these bytes will be cleared from the buffer.
use this opcode mainly for debugging messages.
if you want to mix debugging and other communication 
messages over the same port, you will need to manually
parse the data with the serialRead opcode.
			serialPrint			iPort

 
clear the input buffer
			serialFlush         iPort

 
 TODO: 
(might not be worth the effort implement?)
 
 returns number of bytes available to read
 	kNum   serialAvailable    iPort
 
 returns the next byte in the input buffer
 does not remove the byte from the buffer
 	kByte   serialPeekByte      iPort




 
16, matt ingalls escreveu:
OK, how about this 
(names/functionality mirrored from arduino language)



 iPort  serialBegin         SPortName [, baudRate ]
::::: opens a port.  baudRate defaults to 9600
 
        serialEnd           iPort
::::: closes a port.
 
 kNum   serialAvailable    iPort
::::: returns number of bytes available to read
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
 
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
kByte   serialPeekByte      iPort
::::: returns the next byte in the input buffer
::::: does not remove the byte from the buffer
 
        serialFlush         iPort
::::: clears the input buffer
 
        serialWrite         iPort, Sbytes
::::: sends a buffer of bytes  as a string
 
        serialWriteByte     iPort, kByte
::::: sends a byte of data. 
::::: kByte will be cast to an 1-byte integer (0-255) before sending



On Sep 2, 2011, at 3:17 PM, matt ingalls wrote:


oh, i would have thought the OSC opcodes work on network, not serial ports -- but i really know
nothing about all that stuff...

at any rate, it would be nice to not have to use all that arduino code on adrian's page anyway!
(instead, just use the native Serial.read()/write() in your arduino code)

for the computer side, the POSIX serial code i am using (with author's permission) is pretty straight forward:

http://todbot.com/arduino/host/arduino-serial/arduino-serial.c

and should be fairly trivial to turn into csound opcode.


On Sep 2, 2011, at 2:36 PM, Martin Peach wrote:


So wouldn't it be better to make a serial port interface to the OSC commands already in csound?
It just needs a SLIP codec at each end.
Here's an example of the arduino end:

http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work


Martin


On 2011-09-02 17:26, Victor Lazzarini wrote:

In fact, this is also a problem with MIDI (even worse since it's 7-bit
unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
etc, which is possibly not relevant or suitable here.

Victor
On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:


Maybe the opcode can also deal with overflow? Plus warnings and a big
notice in the man page?

Victor

On 2 Sep 2011, at 22:08, matt ingalls wrote:


yes , i had thought about that, but thought there might end up being
some possible confusion
since only unsigned chars are used. so something like this would have
unexpected results:

kValue = 1000
serialPortWrite SPortName, kValue

but maybe if the opcode was named "serialWriteByte" or something that
would be clear enough...
(probably also add a "serialReadByte" opcode too.)
these also would match the Serial.write() and Serial.read() functions
in arduino language..



On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:


Why don't you place the bytes straight on a numeric variable instead
of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:


i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry -- i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an
arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy..

any suggestions on what the syntax/functionality of the opcodes
should be?
maybe just:

serialPortInitSPortName, iBaudrate
StringserialPortRead SPortName; dumps all bytes received in last k-pass
serialPortWriteSPortName, String; sends all bytes in string in this
k-pass
(serialPortClose??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness oscil 255, kOscilSpeed, 1
SarduinoOutsprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:


I just wanted to ask if there is any developments concerning
arduino and csound. I would love to see it working with csound. Is
there a simple way to make arduino communicate with csound without
OSC?
Best,
Luis
--
luis antunes pena

http://luisantunespena.eu <http://luisantunespena.eu/>




Em 31.07.11 00:29, matt ingalls escreveu:

i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:

It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:

I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1]
http://csoundblog.com/2010/08/photoresistor-theremin/



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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"




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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"


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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"




                        

                      

                    
-- 



Date2011-09-05 23:38
Frommatt ingalls
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
hi oeyvind:

i actually tried getting that to work and was having problems and since victor was suggesting to just do 
single bytes, i gave up.  i also was trying to think in what cases it would be easier to grab a string
besides printing to screen and i couldnt think of anything obvious.  there are also syncing issues 
baud rate vs krate -- which may also get more complicated with strings.. 

but, if you really think a "readstring" is necessary, i can try again..


On Sep 5, 2011, at 4:28 AM, Oeyvind Brandtsegg wrote:

+1, yes, this is very nice.
 
I wonder if it would be ok to also have the "read input buffer as string" functionality?
It might make it easier to parse in some cases.
So, keep both of these:
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
It could perhaps be named serialReadString and serial ReadNum(?), but any naming scheme would be fine.
 
best
Oeyvind
 

 
2011/9/4 k_o_m_p <k_o_m_p@yahoo.de>
That's fantastic Matt. Thank you very much. As soon as I get my Arduino I'll test it.
Luis

Em 04.09.11 22:59, matt ingalls escreveu:
ok -- i think i'm done with the serial opcodes..  :)
  anyone on a mac & arduino want to test it out? 

( i'll post code to dev list for those who want to compile on other platforms )

ended up with these opcodes (Victor, you were right!)


open a port.  baudRate defaults to 9600
	iPort  	serialBegin         SPortName [, baudRate ]

 
close a port
			serialEnd           iPort


write byte(s) to the port, at i or k rate
			serialWrite_i       iPort, iByte
			serialWrite_i       iPort, kByte
			serialWrite_i       iPort, Sbytes
			serialWrite         iPort, iByte
			serialWrite         iPort, kByte
			serialWrite         iPort, Sbytes


read the next byte from the input buffer
returned value will be in the range of 0-255
	kByte	serialRead          iPort
    
    
prints to screen any bytes (up to 32k) in input buffer
note that these bytes will be cleared from the buffer.
use this opcode mainly for debugging messages.
if you want to mix debugging and other communication 
messages over the same port, you will need to manually
parse the data with the serialRead opcode.
			serialPrint			iPort

 
clear the input buffer
			serialFlush         iPort

 
 TODO: 
(might not be worth the effort implement?)
 
 returns number of bytes available to read
 	kNum   serialAvailable    iPort
 
 returns the next byte in the input buffer
 does not remove the byte from the buffer
 	kByte   serialPeekByte      iPort




 
16, matt ingalls escreveu:
OK, how about this 
(names/functionality mirrored from arduino language)



 iPort  serialBegin         SPortName [, baudRate ]
::::: opens a port.  baudRate defaults to 9600
 
        serialEnd           iPort
::::: closes a port.
 
 kNum   serialAvailable    iPort
::::: returns number of bytes available to read
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
 
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
kByte   serialPeekByte      iPort
::::: returns the next byte in the input buffer
::::: does not remove the byte from the buffer
 
        serialFlush         iPort
::::: clears the input buffer
 
        serialWrite         iPort, Sbytes
::::: sends a buffer of bytes  as a string
 
        serialWriteByte     iPort, kByte
::::: sends a byte of data. 
::::: kByte will be cast to an 1-byte integer (0-255) before sending



On Sep 2, 2011, at 3:17 PM, matt ingalls wrote:


oh, i would have thought the OSC opcodes work on network, not serial ports -- but i really know
nothing about all that stuff...

at any rate, it would be nice to not have to use all that arduino code on adrian's page anyway!
(instead, just use the native Serial.read()/write() in your arduino code)

for the computer side, the POSIX serial code i am using (with author's permission) is pretty straight forward:

http://todbot.com/arduino/host/arduino-serial/arduino-serial.c

and should be fairly trivial to turn into csound opcode.


On Sep 2, 2011, at 2:36 PM, Martin Peach wrote:


So wouldn't it be better to make a serial port interface to the OSC commands already in csound?
It just needs a SLIP codec at each end.
Here's an example of the arduino end:

http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work


Martin


On 2011-09-02 17:26, Victor Lazzarini wrote:

In fact, this is also a problem with MIDI (even worse since it's 7-bit
unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
etc, which is possibly not relevant or suitable here.

Victor
On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:


Maybe the opcode can also deal with overflow? Plus warnings and a big
notice in the man page?

Victor

On 2 Sep 2011, at 22:08, matt ingalls wrote:


yes , i had thought about that, but thought there might end up being
some possible confusion
since only unsigned chars are used. so something like this would have
unexpected results:

kValue = 1000
serialPortWrite SPortName, kValue

but maybe if the opcode was named "serialWriteByte" or something that
would be clear enough...
(probably also add a "serialReadByte" opcode too.)
these also would match the Serial.write() and Serial.read() functions
in arduino language..



On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:


Why don't you place the bytes straight on a numeric variable instead
of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:


i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry -- i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an
arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy..

any suggestions on what the syntax/functionality of the opcodes
should be?
maybe just:

serialPortInitSPortName, iBaudrate
StringserialPortRead SPortName; dumps all bytes received in last k-pass
serialPortWriteSPortName, String; sends all bytes in string in this
k-pass
(serialPortClose??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness oscil 255, kOscilSpeed, 1
SarduinoOutsprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:


I just wanted to ask if there is any developments concerning
arduino and csound. I would love to see it working with csound. Is
there a simple way to make arduino communicate with csound without
OSC?
Best,
Luis
--
luis antunes pena

http://luisantunespena.eu <http://luisantunespena.eu/>




Em 31.07.11 00:29, matt ingalls escreveu:

i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:

It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:

I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1]
http://csoundblog.com/2010/08/photoresistor-theremin/



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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"




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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"


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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"




                        

                      

                    
-- 




Date2011-09-06 08:49
FromOeyvind Brandtsegg
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
Ok. Thanks a lot for the effort.
I should do some practical experimentation with it, and then report back if I discover any problems.

The thing I thought would be easier with strings is for example something like:

* arduino reading 3 sensor channels, writing data sequentially to the buffer
* we add a newline character after reading all 3 sensors, to be able to parse and route the data at the receiver
* csound reading the string in the buffer, dividing it into separate string segments using the newline as a separator
* csound dividing this string into 3 separate segments, each containing a valuerepresenting a sensor value

If csound reads single bytes and put them in a k rate variable, then we would need to rely on some sort of k-rate looping to parse these 3 sensor values to 3 different k-rate variables. I can't get my head around exactly how to do this right now, but then again I don't have *that* much experience in parsing serial buffer data. If I can't figure out how to do the k-rate loop, I guess I can convert the values to strings, then concatenate, then parse the result as I originally had intended to do with the serial string read.

best
Oeyvind


2011/9/6 matt ingalls <matt@sonomatics.com>
hi oeyvind:

i actually tried getting that to work and was having problems and since victor was suggesting to just do 
single bytes, i gave up.  i also was trying to think in what cases it would be easier to grab a string
besides printing to screen and i couldnt think of anything obvious.  there are also syncing issues 
baud rate vs krate -- which may also get more complicated with strings.. 

but, if you really think a "readstring" is necessary, i can try again..


On Sep 5, 2011, at 4:28 AM, Oeyvind Brandtsegg wrote:

+1, yes, this is very nice.
 
I wonder if it would be ok to also have the "read input buffer as string" functionality?
It might make it easier to parse in some cases.
So, keep both of these:
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
It could perhaps be named serialReadString and serial ReadNum(?), but any naming scheme would be fine.
 
best
Oeyvind
 

 
2011/9/4 k_o_m_p <k_o_m_p@yahoo.de>
That's fantastic Matt. Thank you very much. As soon as I get my Arduino I'll test it.
Luis

Em 04.09.11 22:59, matt ingalls escreveu:
ok -- i think i'm done with the serial opcodes..  :)
  anyone on a mac & arduino want to test it out? 

( i'll post code to dev list for those who want to compile on other platforms )

ended up with these opcodes (Victor, you were right!)


open a port.  baudRate defaults to 9600
	iPort  	serialBegin         SPortName [, baudRate ]

 
close a port
			serialEnd           iPort


write byte(s) to the port, at i or k rate
			serialWrite_i       iPort, iByte
			serialWrite_i       iPort, kByte
			serialWrite_i       iPort, Sbytes
			serialWrite         iPort, iByte
			serialWrite         iPort, kByte
			serialWrite         iPort, Sbytes


read the next byte from the input buffer
returned value will be in the range of 0-255
	kByte	serialRead          iPort
    
    
prints to screen any bytes (up to 32k) in input buffer
note that these bytes will be cleared from the buffer.
use this opcode mainly for debugging messages.
if you want to mix debugging and other communication 
messages over the same port, you will need to manually
parse the data with the serialRead opcode.
			serialPrint			iPort

 
clear the input buffer
			serialFlush         iPort

 
 TODO: 
(might not be worth the effort implement?)
 
 returns number of bytes available to read
 	kNum   serialAvailable    iPort
 
 returns the next byte in the input buffer
 does not remove the byte from the buffer
 	kByte   serialPeekByte      iPort




 
16, matt ingalls escreveu:
OK, how about this 
(names/functionality mirrored from arduino language)



 iPort  serialBegin         SPortName [, baudRate ]
::::: opens a port.  baudRate defaults to 9600
 
        serialEnd           iPort
::::: closes a port.
 
 kNum   serialAvailable    iPort
::::: returns number of bytes available to read
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
 
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
kByte   serialPeekByte      iPort
::::: returns the next byte in the input buffer
::::: does not remove the byte from the buffer
 
        serialFlush         iPort
::::: clears the input buffer
 
        serialWrite         iPort, Sbytes
::::: sends a buffer of bytes  as a string
 
        serialWriteByte     iPort, kByte
::::: sends a byte of data. 
::::: kByte will be cast to an 1-byte integer (0-255) before sending



On Sep 2, 2011, at 3:17 PM, matt ingalls wrote:


oh, i would have thought the OSC opcodes work on network, not serial ports -- but i really know
nothing about all that stuff...

at any rate, it would be nice to not have to use all that arduino code on adrian's page anyway!
(instead, just use the native Serial.read()/write() in your arduino code)

for the computer side, the POSIX serial code i am using (with author's permission) is pretty straight forward:

http://todbot.com/arduino/host/arduino-serial/arduino-serial.c

and should be fairly trivial to turn into csound opcode.


On Sep 2, 2011, at 2:36 PM, Martin Peach wrote:


So wouldn't it be better to make a serial port interface to the OSC commands already in csound?
It just needs a SLIP codec at each end.
Here's an example of the arduino end:

http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work


Martin


On 2011-09-02 17:26, Victor Lazzarini wrote:

In fact, this is also a problem with MIDI (even worse since it's 7-bit
unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
etc, which is possibly not relevant or suitable here.

Victor
On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:


Maybe the opcode can also deal with overflow? Plus warnings and a big
notice in the man page?

Victor

On 2 Sep 2011, at 22:08, matt ingalls wrote:


yes , i had thought about that, but thought there might end up being
some possible confusion
since only unsigned chars are used. so something like this would have
unexpected results:

kValue = 1000
serialPortWrite SPortName, kValue

but maybe if the opcode was named "serialWriteByte" or something that
would be clear enough...
(probably also add a "serialReadByte" opcode too.)
these also would match the Serial.write() and Serial.read() functions
in arduino language..



On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:


Why don't you place the bytes straight on a numeric variable instead
of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:


i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry -- i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an
arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy..

any suggestions on what the syntax/functionality of the opcodes
should be?
maybe just:

serialPortInitSPortName, iBaudrate
StringserialPortRead SPortName; dumps all bytes received in last k-pass
serialPortWriteSPortName, String; sends all bytes in string in this
k-pass
(serialPortClose??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness oscil 255, kOscilSpeed, 1
SarduinoOutsprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:


I just wanted to ask if there is any developments concerning
arduino and csound. I would love to see it working with csound. Is
there a simple way to make arduino communicate with csound without
OSC?
Best,
Luis
--
luis antunes pena

http://luisantunespena.eu <http://luisantunespena.eu/>




Em 31.07.11 00:29, matt ingalls escreveu:

i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:

It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:

I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1]
http://csoundblog.com/2010/08/photoresistor-theremin/



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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"




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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"


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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"



-- 





Date2011-09-06 09:36
Frommatt ingalls
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)

i'm pretty sure looping can be done with a kgoto:

; read all available bytes
loop:  
kByte readSerial iPort
if (kByte != -1) kgoto loop

or a recursive UDO
or just use a fast enough k-rate (see below)

BUT i still think there might a problem syncing krate with the serial data stream
-- either reading single byte or by buffer, i don't think you can
safely assume you will always get all values on a single k-pass.   

if i were to handle the scenario you talk about, i would just make sure my krate is faster than the rate 
i am transmitting from the arduino and then just handle one byte per k-pass, using the "built-in" looping
of an instrument:

instr 1
  iPort seralBegin "portname"

  kSensorVal1 init 0
  kSenosrVal2 init 0
  kSensorVal3 init 0
  kLastVal init 0

  kNewByte serialRead iPad

if (kNewByte == -1) then
; no new data - do nothing
elseif (kNewByte == 255) then ; our special start code
    kLastVal = 4
elseif (kLastVal == 4) then ; last byte was a newline, this one must be our val #1
      kSensorVal1 = kNewByte
      kLastVal = 1
elseif (kLastVal == 1) then ; last byte was a val1, this one must be our val #2
      kSensorVal2 = kNewByte
      kLastVal = 2
 elseif (kLastVal == 2) then ; last byte was a val2, this one must be our val #3
      kSensorVal3 = kNewByte
      kLastVal = 3
 endif

endin

a more flexible way to do this create a "special code" for every sensor value, so you can just send over each at its own rate...



On Sep 6, 2011, at 12:49 AM, Oeyvind Brandtsegg wrote:

Ok. Thanks a lot for the effort.
I should do some practical experimentation with it, and then report back if I discover any problems.

The thing I thought would be easier with strings is for example something like:

* arduino reading 3 sensor channels, writing data sequentially to the buffer
* we add a newline character after reading all 3 sensors, to be able to parse and route the data at the receiver
* csound reading the string in the buffer, dividing it into separate string segments using the newline as a separator
* csound dividing this string into 3 separate segments, each containing a valuerepresenting a sensor value

If csound reads single bytes and put them in a k rate variable, then we would need to rely on some sort of k-rate looping to parse these 3 sensor values to 3 different k-rate variables.
I can't get my head around exactly how to do this right now, but then again I don't have *that* much experience in parsing serial buffer data. If I can't figure out how to do the k-rate loop, I guess I can convert the values to strings, then concatenate, then parse the result as I originally had intended to do with the serial string read.




best
Oeyvind


2011/9/6 matt ingalls <matt@sonomatics.com>
hi oeyvind:

i actually tried getting that to work and was having problems and since victor was suggesting to just do 
single bytes, i gave up.  i also was trying to think in what cases it would be easier to grab a string
besides printing to screen and i couldnt think of anything obvious.  there are also syncing issues 
baud rate vs krate -- which may also get more complicated with strings.. 

but, if you really think a "readstring" is necessary, i can try again..


On Sep 5, 2011, at 4:28 AM, Oeyvind Brandtsegg wrote:

+1, yes, this is very nice.
 
I wonder if it would be ok to also have the "read input buffer as string" functionality?
It might make it easier to parse in some cases.
So, keep both of these:
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
It could perhaps be named serialReadString and serial ReadNum(?), but any naming scheme would be fine.
 
best
Oeyvind
 

 
2011/9/4 k_o_m_p <k_o_m_p@yahoo.de>
That's fantastic Matt. Thank you very much. As soon as I get my Arduino I'll test it.
Luis

Em 04.09.11 22:59, matt ingalls escreveu:
ok -- i think i'm done with the serial opcodes..  :)
  anyone on a mac & arduino want to test it out? 

( i'll post code to dev list for those who want to compile on other platforms )

ended up with these opcodes (Victor, you were right!)


open a port.  baudRate defaults to 9600
	iPort  	serialBegin         SPortName [, baudRate ]

 
close a port
			serialEnd           iPort


write byte(s) to the port, at i or k rate
			serialWrite_i       iPort, iByte
			serialWrite_i       iPort, kByte
			serialWrite_i       iPort, Sbytes
			serialWrite         iPort, iByte
			serialWrite         iPort, kByte
			serialWrite         iPort, Sbytes


read the next byte from the input buffer
returned value will be in the range of 0-255
	kByte	serialRead          iPort
    
    
prints to screen any bytes (up to 32k) in input buffer
note that these bytes will be cleared from the buffer.
use this opcode mainly for debugging messages.
if you want to mix debugging and other communication 
messages over the same port, you will need to manually
parse the data with the serialRead opcode.
			serialPrint			iPort

 
clear the input buffer
			serialFlush         iPort

 
 TODO: 
(might not be worth the effort implement?)
 
 returns number of bytes available to read
 	kNum   serialAvailable    iPort
 
 returns the next byte in the input buffer
 does not remove the byte from the buffer
 	kByte   serialPeekByte      iPort




 
16, matt ingalls escreveu:
OK, how about this 
(names/functionality mirrored from arduino language)



 iPort  serialBegin         SPortName [, baudRate ]
::::: opens a port.  baudRate defaults to 9600
 
        serialEnd           iPort
::::: closes a port.
 
 kNum   serialAvailable    iPort
::::: returns number of bytes available to read
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
 
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
kByte   serialPeekByte      iPort
::::: returns the next byte in the input buffer
::::: does not remove the byte from the buffer
 
        serialFlush         iPort
::::: clears the input buffer
 
        serialWrite         iPort, Sbytes
::::: sends a buffer of bytes  as a string
 
        serialWriteByte     iPort, kByte
::::: sends a byte of data. 
::::: kByte will be cast to an 1-byte integer (0-255) before sending



On Sep 2, 2011, at 3:17 PM, matt ingalls wrote:


oh, i would have thought the OSC opcodes work on network, not serial ports -- but i really know
nothing about all that stuff...

at any rate, it would be nice to not have to use all that arduino code on adrian's page anyway!
(instead, just use the native Serial.read()/write() in your arduino code)

for the computer side, the POSIX serial code i am using (with author's permission) is pretty straight forward:

http://todbot.com/arduino/host/arduino-serial/arduino-serial.c

and should be fairly trivial to turn into csound opcode.


On Sep 2, 2011, at 2:36 PM, Martin Peach wrote:


So wouldn't it be better to make a serial port interface to the OSC commands already in csound?
It just needs a SLIP codec at each end.
Here's an example of the arduino end:

http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work


Martin


On 2011-09-02 17:26, Victor Lazzarini wrote:

In fact, this is also a problem with MIDI (even worse since it's 7-bit
unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
etc, which is possibly not relevant or suitable here.

Victor
On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:


Maybe the opcode can also deal with overflow? Plus warnings and a big
notice in the man page?

Victor

On 2 Sep 2011, at 22:08, matt ingalls wrote:


yes , i had thought about that, but thought there might end up being
some possible confusion
since only unsigned chars are used. so something like this would have
unexpected results:

kValue = 1000
serialPortWrite SPortName, kValue

but maybe if the opcode was named "serialWriteByte" or something that
would be clear enough...
(probably also add a "serialReadByte" opcode too.)
these also would match the Serial.write() and Serial.read() functions
in arduino language..



On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:


Why don't you place the bytes straight on a numeric variable instead
of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:


i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry -- i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an
arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy..

any suggestions on what the syntax/functionality of the opcodes
should be?
maybe just:

serialPortInitSPortName, iBaudrate
StringserialPortRead SPortName; dumps all bytes received in last k-pass
serialPortWriteSPortName, String; sends all bytes in string in this
k-pass
(serialPortClose??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness oscil 255, kOscilSpeed, 1
SarduinoOutsprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:


I just wanted to ask if there is any developments concerning
arduino and csound. I would love to see it working with csound. Is
there a simple way to make arduino communicate with csound without
OSC?
Best,
Luis
--
luis antunes pena

http://luisantunespena.eu <http://luisantunespena.eu/>




Em 31.07.11 00:29, matt ingalls escreveu:

i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:

It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:

I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1]
http://csoundblog.com/2010/08/photoresistor-theremin/



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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"




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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"


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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"



-- 






Date2011-09-06 11:46
FromOeyvind Brandtsegg
SubjectRe: [Csnd] Csound and Arduino (attn: Jake)
Ah, this makes sense. Thanks.
Oeyvind

2011/9/6 matt ingalls <matt@sonomatics.com>

i'm pretty sure looping can be done with a kgoto:

; read all available bytes
loop:  
kByte readSerial iPort
if (kByte != -1) kgoto loop

or a recursive UDO
or just use a fast enough k-rate (see below)

BUT i still think there might a problem syncing krate with the serial data stream
-- either reading single byte or by buffer, i don't think you can
safely assume you will always get all values on a single k-pass.   

if i were to handle the scenario you talk about, i would just make sure my krate is faster than the rate 
i am transmitting from the arduino and then just handle one byte per k-pass, using the "built-in" looping
of an instrument:

instr 1
  iPort seralBegin "portname"

  kSensorVal1 init 0
  kSenosrVal2 init 0
  kSensorVal3 init 0
  kLastVal init 0

  kNewByte serialRead iPad

if (kNewByte == -1) then
; no new data - do nothing
elseif (kNewByte == 255) then ; our special start code
    kLastVal = 4
elseif (kLastVal == 4) then ; last byte was a newline, this one must be our val #1
      kSensorVal1 = kNewByte
      kLastVal = 1
elseif (kLastVal == 1) then ; last byte was a val1, this one must be our val #2
      kSensorVal2 = kNewByte
      kLastVal = 2
 elseif (kLastVal == 2) then ; last byte was a val2, this one must be our val #3
      kSensorVal3 = kNewByte
      kLastVal = 3
 endif

endin

a more flexible way to do this create a "special code" for every sensor value, so you can just send over each at its own rate...



On Sep 6, 2011, at 12:49 AM, Oeyvind Brandtsegg wrote:

Ok. Thanks a lot for the effort.
I should do some practical experimentation with it, and then report back if I discover any problems.

The thing I thought would be easier with strings is for example something like:

* arduino reading 3 sensor channels, writing data sequentially to the buffer
* we add a newline character after reading all 3 sensors, to be able to parse and route the data at the receiver
* csound reading the string in the buffer, dividing it into separate string segments using the newline as a separator
* csound dividing this string into 3 separate segments, each containing a valuerepresenting a sensor value

If csound reads single bytes and put them in a k rate variable, then we would need to rely on some sort of k-rate looping to parse these 3 sensor values to 3 different k-rate variables.
I can't get my head around exactly how to do this right now, but then again I don't have *that* much experience in parsing serial buffer data. If I can't figure out how to do the k-rate loop, I guess I can convert the values to strings, then concatenate, then parse the result as I originally had intended to do with the serial string read.




best
Oeyvind


2011/9/6 matt ingalls <matt@sonomatics.com>
hi oeyvind:

i actually tried getting that to work and was having problems and since victor was suggesting to just do 
single bytes, i gave up.  i also was trying to think in what cases it would be easier to grab a string
besides printing to screen and i couldnt think of anything obvious.  there are also syncing issues 
baud rate vs krate -- which may also get more complicated with strings.. 

but, if you really think a "readstring" is necessary, i can try again..


On Sep 5, 2011, at 4:28 AM, Oeyvind Brandtsegg wrote:

+1, yes, this is very nice.
 
I wonder if it would be ok to also have the "read input buffer as string" functionality?
It might make it easier to parse in some cases.
So, keep both of these:
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
It could perhaps be named serialReadString and serial ReadNum(?), but any naming scheme would be fine.
 
best
Oeyvind
 

 
2011/9/4 k_o_m_p <k_o_m_p@yahoo.de>
That's fantastic Matt. Thank you very much. As soon as I get my Arduino I'll test it.
Luis

Em 04.09.11 22:59, matt ingalls escreveu:
ok -- i think i'm done with the serial opcodes..  :)
  anyone on a mac & arduino want to test it out? 

( i'll post code to dev list for those who want to compile on other platforms )

ended up with these opcodes (Victor, you were right!)


open a port.  baudRate defaults to 9600
	iPort  	serialBegin         SPortName [, baudRate ]

 
close a port
			serialEnd           iPort


write byte(s) to the port, at i or k rate
			serialWrite_i       iPort, iByte
			serialWrite_i       iPort, kByte
			serialWrite_i       iPort, Sbytes
			serialWrite         iPort, iByte
			serialWrite         iPort, kByte
			serialWrite         iPort, Sbytes


read the next byte from the input buffer
returned value will be in the range of 0-255
	kByte	serialRead          iPort
    
    
prints to screen any bytes (up to 32k) in input buffer
note that these bytes will be cleared from the buffer.
use this opcode mainly for debugging messages.
if you want to mix debugging and other communication 
messages over the same port, you will need to manually
parse the data with the serialRead opcode.
			serialPrint			iPort

 
clear the input buffer
			serialFlush         iPort

 
 TODO: 
(might not be worth the effort implement?)
 
 returns number of bytes available to read
 	kNum   serialAvailable    iPort
 
 returns the next byte in the input buffer
 does not remove the byte from the buffer
 	kByte   serialPeekByte      iPort




 
16, matt ingalls escreveu:
OK, how about this 
(names/functionality mirrored from arduino language)



 iPort  serialBegin         SPortName [, baudRate ]
::::: opens a port.  baudRate defaults to 9600
 
        serialEnd           iPort
::::: closes a port.
 
 kNum   serialAvailable    iPort
::::: returns number of bytes available to read
 
Sbytes  serialRead          iPort
::::: returns all input bytes available as a string
 
kByte   serialReadByte      iPort
::::: returns the next byte in the input buffer
::::: returned value will be in the range of 0-255
 
kByte   serialPeekByte      iPort
::::: returns the next byte in the input buffer
::::: does not remove the byte from the buffer
 
        serialFlush         iPort
::::: clears the input buffer
 
        serialWrite         iPort, Sbytes
::::: sends a buffer of bytes  as a string
 
        serialWriteByte     iPort, kByte
::::: sends a byte of data. 
::::: kByte will be cast to an 1-byte integer (0-255) before sending



On Sep 2, 2011, at 3:17 PM, matt ingalls wrote:


oh, i would have thought the OSC opcodes work on network, not serial ports -- but i really know
nothing about all that stuff...

at any rate, it would be nice to not have to use all that arduino code on adrian's page anyway!
(instead, just use the native Serial.read()/write() in your arduino code)

for the computer side, the POSIX serial code i am using (with author's permission) is pretty straight forward:

http://todbot.com/arduino/host/arduino-serial/arduino-serial.c

and should be fairly trivial to turn into csound opcode.


On Sep 2, 2011, at 2:36 PM, Martin Peach wrote:


So wouldn't it be better to make a serial port interface to the OSC commands already in csound?
It just needs a SLIP codec at each end.
Here's an example of the arduino end:

http://adrianfreed.com/content/oscuino-arduino-osc-sketch-open-sound-control-work


Martin


On 2011-09-02 17:26, Victor Lazzarini wrote:

In fact, this is also a problem with MIDI (even worse since it's 7-bit
unsigned), but the MIDI opcodes all use k-vars. Some of them do mapping
etc, which is possibly not relevant or suitable here.

Victor
On 2 Sep 2011, at 22:22, Victor Lazzarini wrote:


Maybe the opcode can also deal with overflow? Plus warnings and a big
notice in the man page?

Victor

On 2 Sep 2011, at 22:08, matt ingalls wrote:


yes , i had thought about that, but thought there might end up being
some possible confusion
since only unsigned chars are used. so something like this would have
unexpected results:

kValue = 1000
serialPortWrite SPortName, kValue

but maybe if the opcode was named "serialWriteByte" or something that
would be clear enough...
(probably also add a "serialReadByte" opcode too.)
these also would match the Serial.write() and Serial.read() functions
in arduino language..



On Sep 2, 2011, at 12:40 PM, Victor Lazzarini wrote:


Why don't you place the bytes straight on a numeric variable instead
of a string? Would that not be easier for the user?

On 2 Sep 2011, at 20:30, matt ingalls wrote:


i had offered port some serial bus code i have into an opcode(s).
should work on mac pc & unix.
sorry -- i'll try to get into it this weekend..

it's been a year or so since i last was playing around with an
arduino & serial communication
( i was using a macos commandline app ) so memory is a bit foggy..

any suggestions on what the syntax/functionality of the opcodes
should be?
maybe just:

serialPortInitSPortName, iBaudrate
StringserialPortRead SPortName; dumps all bytes received in last k-pass
serialPortWriteSPortName, String; sends all bytes in string in this
k-pass
(serialPortClose??needed?? )

; in use would look something like this
instr 1
; open serial port to arduino
SPortName = "/dev/tty.usbmodemfa131"
serialPortInit SPortName, 9600

; read our knob from arduino
SarduinoIn serialPortRead SPortName
kInValue strtolk SarduinoIn

; make sure input is valid
kOscilSpeed init 1
if (kInValue > 0 && kInValue < 20) then
kOscilSpeed = kInValue
endif

; oscillate led brightness
kLEDBrightness oscil 255, kOscilSpeed, 1
SarduinoOutsprintf "%c", kLEDBrightness
serialPortWrite SPortName, SarduinoOut
endin

On Sep 2, 2011, at 8:12 AM, k_o_m_p wrote:


I just wanted to ask if there is any developments concerning
arduino and csound. I would love to see it working with csound. Is
there a simple way to make arduino communicate with csound without
OSC?
Best,
Luis
--
luis antunes pena

http://luisantunespena.eu <http://luisantunespena.eu/>




Em 31.07.11 00:29, matt ingalls escreveu:

i have some posix serial code ive used to make a commandline app to communicate with an arduino.
probably easy to turn it into a csound opcode, if you were interested.
-m

On Jul 30, 2011, at 2:37 PM, Martin Peach wrote:

It sounds like a MIDI controller box. If you have a MIDI interface, you can easily turn arduino into a MIDI device with two 220 Ohm resistors and a MIDI connector. (Do a Serial.begin(31250) and send MIDI packets) Then you can talk directly to csound.

Martin


On 2011-07-30 15:36, Dave Seidel wrote:

I have a nice box my brother me for me with a Arduino on the inside and
a bunch of controls on the outside (six pots, three toggles, and two
momentary push-buttons). Up til now, I've been running Auduino firmware
on the box and using it as a synth, which uses a subset of the controls
(five pots).

My brother has another similar box he made for himself, and has been
using it as a hardware controller for realtime PD programs, using
Firmata firmware on Arduino and the pduino object in PD.

I'd love to be able to use my box with Csound in a similar way to what
he's doing with PD, and I'm trying to figure out what my options are.

Jake has demonstrated[1] how to use Processing and his Csoundo package
to do something like this, but he hasn't published the code yet AFAIK.
Jake, in your Processing code, did you use the cc.arduino package (which
talks to Firmata) or did you write your own serial code? Would you be
willing to make your Processing sources available?

I'm also interested in hearing if anyone else has succeeded is using an
Arduino with Csound. I know some options have been discussed, e.g. using
OSC, which would require either an Arduino shield with OSC support or
some intermediate software between Csound and the Arduino to translate
between serial and OSC. I think someone suggested doing this in Python,
which is reasonable, but it also would make sense to do this in
Processing. Has anyone tried either of these approaches, and if so,
would you consider sharing your work?

Thanks in advance for any input.

- Dave

[1]
http://csoundblog.com/2010/08/photoresistor-theremin/



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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"




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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"


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 
emailsympa@lists.bath.ac.uk
  with body "unsubscribe csound"



--