Conversion of k-rate variables to i-rate variables

Hello

I have a set of frequencies in a k-rate vector called kcps.

I want to use these frequencies with an instrument but the instrument accepts only an i-variable.

When I use the conversion operator 'i' i(kcps), I only get the first note to convert.

How do I convert the rest of the k-rate values in my vector to create a set of i-rate values?

Thanks

David

Can you elaborate a bit?

I'm probably being dumb, but I can't visualize what you're trying to do. What do you mean by a 'k-rate vector'? A k-variable is normally a scalar [the manual even says so!].

If you have one instrument that's generating some k-values at various times, and you want to use these for some other instrument to play, you should be able to use an 'event' opcode to invoke the other instrument with the current value passed as a parameter. Or if you want to vary the value over time in a single instance, you may just have to rewrite the instrument. But as I say, I'm not clear...

?

Hi,
to solve your problem would be necessary to understand what you want to do and also be able to see the CSD file...

e

k-variable

Dr. David M. Horowitz

I run a process that produces a k-variable. It has a set of frequencies. When I use dumpk, I get an ascii file that lists many frequencies.

The instrument I want to use (Pianoteq and Pre-piano) only accepts an i-variable.

When I use the conversion operator 'i', it only converts the first frequency from a k to an i-variable.

How do I convert the rest.

I'm trying to feed a list of frequencies from dumpk to control an instrument that only accepts an i-variable.

To march down the k-variable set of frequencies (which are updated at the k-rate, I could use a for statement but I cant find that in the documentation.

So basically I have a list of frequencies produced in a k-variable and I want a list of frequencies that can be accepted by my instrument as i-variables.

Hope that clarifies.

Thanks for your feedback and comments.

David

Hi,
but,
why do not you enter the values (ifreq - The basic frequency of the string) by the score rather than through dumpk?

e

pianoteq

…I am sorry,
but I do not know well pianoteq
what is it exactly?
thanks,

e

Answer to your question - entering i-rate variables in the score

Hi

Thanks for your question.

I dont want to enter i-rate variables in the score because I want to 'automatically' control the instrument with a set of k-rate frequencies.

My custom process produces a k-rate variable that is update at the k-rate.

I know k-rate variable is a scalar, but it changes with k.

However, an i-rate variable is a scalar and it does not change.

If I had a 'C' like for-statement with a '++' operand then I could incriment along the list of frequencies.

I only use dumpk to examing the frequencies to know they are correct. It is the k-rate variable I want to convert to an i-rate variable and synthesize notes at the k-rate.

There is a conversion opcode called 'i' but it only converts the first frequency at the k-rate and I dont know how to move on to the next.

Hope this clarifies.

David

What's Pianoteq?

ok!

I do not know well opcode Pianoteq
what is it exactly?
thanks,

e

test

…for example like this?

sr = 44100
kr = 20
nchnls = 1

instr 1

knumber init 0
koldnumber init 1
ktrans init 1
ktrans = knumber
knumber = knumber + koldnumber
koldnumber = ktrans

dumpk knumber, "fibonacci.txt", 7, 0

printk2 knumber, 30

vai:
ifreq = i(knumber)
timout 0, .001, chiama
reinit vai
chiama:

a1 oscil 10000, ifreq, 1
out a1

print ifreq

endin

f0 9999
f1 0 1024 10 1
i1 0 1
e

bye!

e

I believe I have a solution

1. obtain kcps value - a scalar that changes with each k cycle
2. make a conditional statement - if (kcps > 0) kgoto inst 1
3. inst 1 prepiano (param, param, i(kcps), param...) - where I am only noting the one param to convert kcps to an i-rate variable using the opcode 'i'

Now, these three lines of code get executed with every incremental value of k.

Thoughts welcome.

David

... at K-rate...?

OK, I think I'm getting a handle on your thinking now.
For one thing, please distinguish between "Instrument" and "Opcode"! [I'd heard of Pianoteq -- knew it was a VST plugin, and so I assumed "Pre-Piano" was the old Rhodes voice for that. However, I looked it up in the manual and find that it is an opcode!]

The critical point is that this opcode takes an i-rate parameter, which means that it only uses it at initialization. You cannot change it (by whatever means) at k-rate, and expect the opcode to use it. The only time the opcode is going to use the value is when it is triggered, and you certainly don't want to retrigger the piano note (and its attack) several thousand times a second at k-rate!!

I'd guess that what you're trying to do is modulate a piano note in some unconventional fashion, but I'm afraid that won't be possible with that opcode. If you really want to get close to a 'piano' sound, you may have to play sampled data or something.

Update from Barry Vercoe

Thanks 'e' and Pete.

'e' I will try your code example.

Pete, I understand what you said in your email, but according to Barry Vercoe (my old prof), the example I wrote should work.

I think the key statement is the opcode 'i' which is to convert a k-rate variable into an i-rate variable.

What I would do is take the first k-rate value and play an i-rate variable, and ignore subsequent k-rate variables until a new note is to be played.

In this sense I take care of the duration of the note.

I agree, I don't want 1000 attacks per second.

Ill keep you both posted on my progress.

Thanks again

David

e - it worked!

Dear e

Thank you very much for your example using the timeout opcode.

Nothing in the csound documentation pointed us to that.

I tried in vain to use the kgoto statement and couldnt get my instrument to update at the krate.

I tried your example, added an if statement and it worked.

Thanks again and hope to see your postings with interest.

David

zpack z-pack zpak viagra online Canadian pharmacy viagra z-pak buy zithromax cialis online viagra uk pharmacy uk z pack kamagra uk avanafil Canadian pharmacy cheap generic viagra generic cialis z pak cialis uk ed pills generic viagra staxyn buy viagra uk ed drugs