Csound Csound-dev Csound-tekno Search About

[Csnd] storing data for later use

Date2010-02-22 02:23
FromSeiya Matsumiya
Subject[Csnd] storing data for later use
Hello all,

I am trying to see if there's a way to keep receiving values from an outside
source, in my case MaxMSP, and store that data, and once a certain condition
is met switch from using the stream of data to the stored data. 

This will probably clear things up:

	instr 100
ksun invalue "sunx"

if (ksun == 58.27) kgoto zerofreq 
	kgoto normfreq

zerofreq: 
ksun	=	112.358
	goto zakwrite

normfreq: 
ksun = ksun
	goto zakwrite

zakwrite:
zkw 	ksun, 1
	endin

What the code above does is once ksun reaches 58.27, it goes to zerofreq
which assigns the value of 112.358 to ksun. I've put this value in now just
as a place holder. 

What I want to do is as follows: store(and keep updating) the value of ksun
until it reaches 58.27, and once it does, start using the value of ksun just
before it was 58.27.

I hope someone can point me in the right direction. Thanks in advance!

Seiya

Date2010-02-22 04:22
FromMike Moser-Booth
Subject[Csnd] Re: storing data for later use
Maybe something like this?

instr 100
    ksun    init 0

    if (ksun != 58.27) then
       ksunold   = ksun
       ksun    invalue "sunx"
    else
       ksun   = ksunold
    endif

    zkw ksun, 1

endin

.mmb

Seiya Matsumiya wrote:
> Hello all,
>
> I am trying to see if there's a way to keep receiving values from an outside
> source, in my case MaxMSP, and store that data, and once a certain condition
> is met switch from using the stream of data to the stored data. 
>
> This will probably clear things up:
>
> 	instr 100
> ksun invalue "sunx"
>
> if (ksun == 58.27) kgoto zerofreq 
> 	kgoto normfreq
>
> zerofreq: 
> ksun	=	112.358
> 	goto zakwrite
>
> normfreq: 
> ksun = ksun
> 	goto zakwrite
>
> zakwrite:
> zkw 	ksun, 1
> 	endin
>
> What the code above does is once ksun reaches 58.27, it goes to zerofreq
> which assigns the value of 112.358 to ksun. I've put this value in now just
> as a place holder. 
>
> What I want to do is as follows: store(and keep updating) the value of ksun
> until it reaches 58.27, and once it does, start using the value of ksun just
> before it was 58.27.
>
> I hope someone can point me in the right direction. Thanks in advance!
>
> Seiya
>   



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-02-22 16:17
FromMatsumiya Seiya
Subject[Csnd] Re: Re: storing data for later use
Mm, nice. Really smart!

Thank you!

Seiya


On Feb 21, 2010, at 11:22 PM, Mike Moser-Booth wrote:

> Maybe something like this?
> 
> instr 100
>   ksun    init 0
> 
>   if (ksun != 58.27) then
>      ksunold   = ksun
>      ksun    invalue "sunx"
>   else
>      ksun   = ksunold
>   endif
> 
>   zkw ksun, 1
> 
> endin
> 
> .mmb
> 
> Seiya Matsumiya wrote:
>> Hello all,
>> 
>> I am trying to see if there's a way to keep receiving values from an outside
>> source, in my case MaxMSP, and store that data, and once a certain condition
>> is met switch from using the stream of data to the stored data. 
>> This will probably clear things up:
>> 
>> 	instr 100
>> ksun invalue "sunx"
>> 
>> if (ksun == 58.27) kgoto zerofreq 	kgoto normfreq
>> 
>> zerofreq: ksun	=	112.358
>> 	goto zakwrite
>> 
>> normfreq: ksun = ksun
>> 	goto zakwrite
>> 
>> zakwrite:
>> zkw 	ksun, 1
>> 	endin
>> 
>> What the code above does is once ksun reaches 58.27, it goes to zerofreq
>> which assigns the value of 112.358 to ksun. I've put this value in now just
>> as a place holder. 
>> What I want to do is as follows: store(and keep updating) the value of ksun
>> until it reaches 58.27, and once it does, start using the value of ksun just
>> before it was 58.27.
>> 
>> I hope someone can point me in the right direction. Thanks in advance!
>> 
>> Seiya
>>  
> 
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"