Csound Csound-dev Csound-tekno Search About

Quantising control signals

Date2017-04-30 00:34
From"Jeanette C."
SubjectQuantising control signals
Hey hey,
I'm trying to quantise a control signal to a certain scale. What is the best 
way to do it.

I've come up with two initial ideas, but can't figure out an efficient method 
to implement either.

1. Use samphold and set the trigger whenever the control signal value divided 
by the quantisation step value is an integer (ksig % step) == 0?
Tried it, didn't work.

2. Use some mathematics to directly quantise the control signal, some sort of 
modified bit reduction. No idea how to work that one, if it can be performed 
on control signals at all.

Any ideas?

Thanks and best wishes,

Jeanette

--------
When you need someone, you just turn around and I will be there <3

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-04-30 00:44
Frommskala@ANSUZ.SOOKE.BC.CA
SubjectRe: Quantising control signals
On Sun, 30 Apr 2017, Jeanette C. wrote:
> 2. Use some mathematics to directly quantise the control signal, some sort of
> modified bit reduction. No idea how to work that one, if it can be performed
> on control signals at all.
>
> Any ideas?

Table lookup without interpolation.

Date2017-04-30 06:38
FromOeyvind Brandtsegg
SubjectRe: Quantising control signals
Also, if you want to quantize a signal to for example 8 equal steps,
you can multiply by 8, take the integer part, and then divide by 8.
... assuming that your original signal was in the 0.0-1.0 range

2017-04-29 16:44 GMT-07:00 <mskala@ansuz.sooke.bc.ca>:
On Sun, 30 Apr 2017, Jeanette C. wrote:
> 2. Use some mathematics to directly quantise the control signal, some sort of
> modified bit reduction. No idea how to work that one, if it can be performed
> on control signals at all.
>
> Any ideas?

Table lookup without interpolation.

--
Matthew Skala
mskala@ansuz.sooke.bc.ca                 People before principles.
http://ansuz.sooke.bc.ca/

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-04-30 08:53
From"Jeanette C."
SubjectRe: Quantising control signals
Hi,
thank you both for your answers, but I am afraid that I may have used the 
wrong term. So here's what I'd like to do:
klfo oscil 16, kfreq, 1
now step the klfo signal so that it conforms to a grid of i,e. 1 and hold it 
there.
0...1...2...3...4...
Or take a stepping of 2:
0...2...4...6...8...

I now found a viable method with the expression
if abs(klfo % kstep) <.001 then ; NOT == 0
I use that as a condition to set a gate signal for samphold.

The next step would be to have a formula to allow stepping on an exponential 
scale, so that - applied to frequencies - the control signal could step 
through a 12-tone scale or octaves. But I think my best way there is really 
table lookup?

Best wishes and thanks again for your help thus far,

Jeanette

--------
When you need someone, you just turn around and I will be there <3

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-04-30 09:20
FromOeyvind Brandtsegg
SubjectRe: Quantising control signals
Unless I misunderstand what you want, I think you can do the stepping to a grid of 1 simply by
kquantized = int(kflo)
Then the grid with stepsize 2:
kquantized = int(kflo/2)

Then, to map your quantized signal to a nonlinear scale, like exponential, you apply the nonlinear transformation on the quantized signal.
e.g. 
kquantized = int(kflo/2)
koutput = kquantized*kquantized
will give you the output sequence
0,4,16,36,64...


2017-04-30 0:53 GMT-07:00 Jeanette C. <julien@mail.upb.de>:
Hi,
thank you both for your answers, but I am afraid that I may have used the wrong term. So here's what I'd like to do:
klfo oscil 16, kfreq, 1
now step the klfo signal so that it conforms to a grid of i,e. 1 and hold it there.
0...1...2...3...4...
Or take a stepping of 2:
0...2...4...6...8...

I now found a viable method with the expression
if abs(klfo % kstep) <.001 then ; NOT == 0
I use that as a condition to set a gate signal for samphold.

The next step would be to have a formula to allow stepping on an exponential scale, so that - applied to frequencies - the control signal could step through a 12-tone scale or octaves. But I think my best way there is really table lookup?

Best wishes and thanks again for your help thus far,

Jeanette

--------
When you need someone, you just turn around and I will be there <3

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-04-30 13:07
From"Jeanette C."
SubjectRe: Quantising control signals
Apr 30 2017, Oeyvind Brandtsegg has written:

> Unless I misunderstand what you want, I think you can do the stepping to a
> grid of 1 simply by
> kquantized = int(kflo)
> Then the grid with stepsize 2:
> kquantized = int(kflo/2)
Thank you Oeyvind, this might be a feasible and simple solution. I must
think about the context of my control signals. Namely, if I can always
know the maximum amplitude.
...
Best wishes,

Jeanette

--------
When you need someone, you just turn around and I will be there <3

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-04-30 14:35
FromStankevich
SubjectRe: Quantising control signals
instr    11
  kquality = 1 ; Max quality.
  kstep = 50
  ksig random 200, 1000
  ksig = ksig + (round(ksig/kstep) * kstep - ksig) * kquality
  printk2 ksig
endin

On Sun, Apr 30, 2017 at 3:07 PM, Jeanette C.  wrote:
> Apr 30 2017, Oeyvind Brandtsegg has written:
>
>> Unless I misunderstand what you want, I think you can do the stepping to a
>> grid of 1 simply by
>> kquantized = int(kflo)
>> Then the grid with stepsize 2:
>> kquantized = int(kflo/2)
>
> Thank you Oeyvind, this might be a feasible and simple solution. I must
> think about the context of my control signals. Namely, if I can always
> know the maximum amplitude.
> ...
> Best wishes,
>
>
> Jeanette
>
> --------
> When you need someone, you just turn around and I will be there <3
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-04-30 15:39
From"Jeanette C."
SubjectRe: Quantising control signals
Apr 30 2017, Stankevich has written:

> instr    11
>  kquality = 1 ; Max quality.
>  kstep = 50
>  ksig random 200, 1000
>  ksig = ksig + (round(ksig/kstep) * kstep - ksig) * kquality
>  printk2 ksig
> endin
...
Nice one! Thanks!

Best Wishes,

Jeanette

--------
When you need someone, you just turn around and I will be there <3

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here