[Csnd] writing OSC values into a table
| Date | 2011-08-06 22:05 |
| From | zappfinger |
| Subject | [Csnd] writing OSC values into a table |
I would like to write values received over OSC into a table, to be played
back at different speeds.
I am not sure if this is possible, to create tables dynamically this way.
Any ideas?
Richard
--
View this message in context: http://csound.1045644.n5.nabble.com/writing-OSC-values-into-a-table-tp4673599p4673599.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"
|
| Date | 2011-08-06 22:21 |
| From | joachim heintz |
| Subject | Re: [Csnd] writing OSC values into a table |
can you describe this more in detail? which kind of values: just floats,
ints, or anything else? is the number of values fix, or is there at
least a reasonable maximum?
bye -
joachim
Am 06.08.2011 23:05, schrieb zappfinger:
> I would like to write values received over OSC into a table, to be played
> back at different speeds.
> I am not sure if this is possible, to create tables dynamically this way.
>
> Any ideas?
>
> Richard
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/writing-OSC-values-into-a-table-tp4673599p4673599.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"
|
| Date | 2011-08-06 22:35 |
| From | zappfinger |
| Subject | [Csnd] Re: writing OSC values into a table |
For now just ints. And the table size is of course limited, but that is not
important, say N.
The OSC messages are coming in at k-rate, if am not mistaken
I was thinking of a structure like this, in pseudocode:
do loop
get value via OSClisten
write value into next table position
until table index = N
turn off OSC (or continue with OSClisten, but discard the values)
playback table at an audio rate.
--
View this message in context: http://csound.1045644.n5.nabble.com/writing-OSC-values-into-a-table-tp4673599p4673644.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"
|
| Date | 2011-08-07 09:19 |
| From | joachim heintz |
| Subject | Re: [Csnd] Re: writing OSC values into a table |
yes this should be pretty easy. perhaps this can help:
http://en.flossmanuals.net/csound/ch019_d-function-tables
actually you just need to adjust the pointer, and write via tabw, read
via tab (or tablew/table if you work with powof2 table sizes). as
looping is done in each k-cycle, you may not need something like do
loop. either just increment the pointer with something like kndx =
kndx+1, or increment the pointer when a new osc value has been received.
send some code, if you like. best -
joachim
Am 06.08.2011 23:35, schrieb zappfinger:
> For now just ints. And the table size is of course limited, but that is not
> important, say N.
> The OSC messages are coming in at k-rate, if am not mistaken
> I was thinking of a structure like this, in pseudocode:
>
> do loop
> get value via OSClisten
> write value into next table position
> until table index = N
>
> turn off OSC (or continue with OSClisten, but discard the values)
>
> playback table at an audio rate.
>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/writing-OSC-values-into-a-table-tp4673599p4673644.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"
|
| Date | 2011-08-07 13:09 |
| From | zappfinger |
| Subject | [Csnd] Re: writing OSC values into a table |
Ok here is a sample. It is not quote working yet. I was also hoping I could see the wave form in the table after it is filled, but I guess the waveform display is not updated? Floats are coming in over OSC, forming many periods of a triangle waveform, max amplitude =1.0 Richard |
| Date | 2011-08-07 16:26 |
| From | joachim heintz |
| Subject | Re: [Csnd] Re: writing OSC values into a table |
hi richard - i think it might be better to use the same method in instr 2 as in instr 1 for the pointer. and you need another function table for the audio in instrument 2. below is a suggestion. note that it is important to set kndx to 0 just at init-time. otherwise it will always be reset to 0 in each k-cycle (sorry about my wrong suggestion in my previous mail). does it work now? best - joachim |
| Date | 2011-08-07 19:01 |
| From | zappfinger |
| Subject | [Csnd] Re: writing OSC values into a table |
Hi Joachim,
Unfortunately, it does't work.
This is the output:
/new alloc for instr 1:
RECORDING!
B 0.000 .. 31.000 T 31.000 TT 31.000 M: 0.00000 0.00000
new alloc for instr 2:
PLAYING!
B 31.000 .. 33.000 T 33.000 TT 33.000 M: 0.00000 0.00000
Score finished in csoundPerform().
inactive allocs returned to freespace
end of score. overall amps: 0.00000 0.00000
overall samples out of range: 0 0
0 errors in performance
Elapsed time at end of performance: real: 35.891s, CPU: 27.296s
11370 512-byte soundblks of shorts written to dac3/
Also what I do not understand, why do you introduce this second (sine)
table?
I just want to store values in the giFt table (at k-rate) and play those
back at a-rate.
Maybe I should use a phasor?
Richard
--
View this message in context: http://csound.1045644.n5.nabble.com/writing-OSC-values-into-a-table-tp4673599p4675411.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"
|
| Date | 2011-08-07 19:43 |
| From | joachim heintz |
| Subject | Re: [Csnd] Re: writing OSC values into a table |
hi richard -
at least this is no error ...
can you print out some values both while recording and while playing, as
you did before with printk? and perhaps you should play instrument 2 for
30 seconds, too.
as to the table: i understood you record frequency information at
k-rate, for instance from some moving control device. something like:
starting at 200 hz, after 1 second moving to 100 hz, and so on. when you
record these data to a table, you need a table with a stored waveform.
you cannot play back the data as samples.
or did i misunderstand what you meant by "frequency" data?
joachim
Am 07.08.2011 20:01, schrieb zappfinger:
> Hi Joachim,
>
> Unfortunately, it does't work.
> This is the output:
>
> /new alloc for instr 1:
> RECORDING!
> B 0.000 .. 31.000 T 31.000 TT 31.000 M: 0.00000 0.00000
> new alloc for instr 2:
> PLAYING!
> B 31.000 .. 33.000 T 33.000 TT 33.000 M: 0.00000 0.00000
> Score finished in csoundPerform().
> inactive allocs returned to freespace
> end of score. overall amps: 0.00000 0.00000
> overall samples out of range: 0 0
> 0 errors in performance
> Elapsed time at end of performance: real: 35.891s, CPU: 27.296s
> 11370 512-byte soundblks of shorts written to dac3/
>
> Also what I do not understand, why do you introduce this second (sine)
> table?
> I just want to store values in the giFt table (at k-rate) and play those
> back at a-rate.
> Maybe I should use a phasor?
>
> Richard
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/writing-OSC-values-into-a-table-tp4673599p4675411.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"
|
| Date | 2011-08-07 20:53 |
| From | zappfinger |
| Subject | [Csnd] Re: writing OSC values into a table |
Hi Joachim,
Sorry I was not clear enough. The data coming in over OSC could be sensor
data, or, for now, a waveform generated in Python. Below is the simple
Python code. It generates many periods of a triangle.
These are stored in the table at k-rate and should be played back at a-rate.
#
# wave2OSC, send values representing samples from a signal
# this one creates a triangle by ramping up and down
#
import binascii,OSC,string
client = OSC.OSCClient()
msg = OSC.OSCMessage()
msg.setAddress("/freq")
MAX = 100
i = MAX
down = True
while 1:
msg.clearData()
fl = float(i)/MAX
msg.append(fl)
print fl,
client.sendto(msg, ('127.0.0.1', 9000))
if down:
i = i - 1
else:
i = i + 1
if i <= 0: down = False
if i >= MAX: down = True
--
View this message in context: http://csound.1045644.n5.nabble.com/writing-OSC-values-into-a-table-tp4673599p4675684.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"
|
| Date | 2011-08-07 21:12 |
| From | joachim heintz |
| Subject | Re: [Csnd] Re: writing OSC values into a table |
i see ...
in this case, you should certainly use a phasor in instr 2, i think.
and for writing the data properly in the table, it might be good to use
the kans output of the OSClisten opcode, and to write the next index
whenever kans==1. something like this:
kndx init 0
loop:
kans OSClisten ...
if kans == 1 then
tablew kval, kndx, giFt
kndx = kndx+1
kgoto loop
endif
not sure if this works or ends in an endless loop ...
good luck -
joachim
Am 07.08.2011 21:53, schrieb zappfinger:
> Hi Joachim,
>
> Sorry I was not clear enough. The data coming in over OSC could be sensor
> data, or, for now, a waveform generated in Python. Below is the simple
> Python code. It generates many periods of a triangle.
> These are stored in the table at k-rate and should be played back at a-rate.
>
> #
> # wave2OSC, send values representing samples from a signal
> # this one creates a triangle by ramping up and down
> #
> import binascii,OSC,string
>
> client = OSC.OSCClient()
> msg = OSC.OSCMessage()
> msg.setAddress("/freq")
>
> MAX = 100
> i = MAX
> down = True
> while 1:
> msg.clearData()
> fl = float(i)/MAX
> msg.append(fl)
> print fl,
> client.sendto(msg, ('127.0.0.1', 9000))
> if down:
> i = i - 1
> else:
> i = i + 1
> if i <= 0: down = False
> if i >= MAX: down = True
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/writing-OSC-values-into-a-table-tp4673599p4675684.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"
|
| Date | 2011-08-08 07:22 |
| From | Tarmo Johannes |
| Subject | Re: [Csnd] Re: writing OSC values into a table |
hi,
with generating the waveform in python - isn't there a timing problem between python and csound? Python computes and sends the OSC messages as fast it can but csound reads osc messages just every k-cycle - so a lot of information can be lost?
In that case, perpahs you can use python inside csound http://www.csounds.com/journal/issue6/pythonOpcodes.html to ensure the sync
or use csound API, where, I think, you can create tables in your programming language, send values to channel at k or a rate and do many miracolous things. But I am not very experienced, though.
http://en.flossmanuals.net/csound/ch063_the-csound-api/
greetings,
tarmo
On Sunday 07 August 2011 22:53:45 zappfinger wrote:
> Hi Joachim,
>
> Sorry I was not clear enough. The data coming in over OSC could be sensor
> data, or, for now, a waveform generated in Python. Below is the simple
> Python code. It generates many periods of a triangle.
> These are stored in the table at k-rate and should be played back at a-rate.
>
> #
> # wave2OSC, send values representing samples from a signal
> # this one creates a triangle by ramping up and down
> #
> import binascii,OSC,string
>
> client = OSC.OSCClient()
> msg = OSC.OSCMessage()
> msg.setAddress("/freq")
>
> MAX = 100
> i = MAX
> down = True
> while 1:
> msg.clearData()
> fl = float(i)/MAX
> msg.append(fl)
> print fl,
> client.sendto(msg, ('127.0.0.1', 9000))
> if down:
> i = i - 1
> else:
> i = i + 1
> if i <= 0: down = False
> if i >= MAX: down = True
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/writing-OSC-values-into-a-table-tp4673599p4675684.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"
|
| Date | 2011-08-08 10:52 |
| From | zappfinger |
| Subject | [Csnd] Re: writing OSC values into a table |
Hi Tarmo,
Thanks for the tips.
Yes, in this case the Python program sends data as fast as possible over the
network. In my testing I have noticed that this is buffered neatly in Csound
(OSC).
But the input could be much slower, for instance if I want to get serial
data from a sensor and convert that to OSC. That is the whole idea: storing
slowly changing data (maybe a user drawing a wave form on the screen) in a
csound table and then play it back at audio rate.
regards,
Richard
--
View this message in context: http://csound.1045644.n5.nabble.com/writing-OSC-values-into-a-table-tp4673599p4677154.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"
|