Csound Csound-dev Csound-tekno Search About

Pitch bend quantization/correction

Date2016-04-09 13:59
FromGerard Rodríguez
SubjectPitch bend quantization/correction
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

Date2016-04-09 18:41
FromRory Walsh
SubjectRe: Pitch bend quantization/correction
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

Date2016-04-09 19:10
FromGerard Rodríguez
SubjectRe: Pitch bend quantization/correction
That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

Date2016-04-09 19:33
FromIain McCurdy
SubjectRe: Pitch bend quantization/correction
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE

That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

Date2016-04-09 20:31
FromGerard Rodríguez
SubjectRe: Pitch bend quantization/correction
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

Date2016-04-09 20:40
FromRory Walsh
SubjectRe: Pitch bend quantization/correction
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

Date2016-04-09 20:54
FromGerard Rodríguez
SubjectRe: Pitch bend quantization/correction
That doesn't prevent a slow slide from changing the pitch, so you can press the pad and slide slightly and it's going to sound out of tune. Also it always changes, it's continuous, and it's quite sensitive so it has very small variations.
What I was thinking is filtering the bend message with a low pass filter so those very fast small variations are ignored, and with a high pass filter so only the wanted movements like a vibrato with a fast enough frequency are used.
But I don't know if that would work (again new to dsp) and it probably has other problems.
I hope I cleared out a bit the problem, It's a bit hard for me to describe, but It's not as trivial as it sounds (at least for me)

2016-04-09 21:40 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

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

Date2016-04-09 21:06
FromIain McCurdy
SubjectRe: Pitch bend quantization/correction
Maybe you want small area around the centre of a note wherein pitch bend remains zero, but upon straying beyond this safe area, pitch bending begins. This is something that hardware pitch bend controls do to account for mechanical wear and drift that may mean that the control doesn't return precisely to its equlibrium position. You could just map pchbend, normalised 0 to 1, through something like:
f 1 0 1024 -7 -1 450 0 124 0 450 1
The output then would be a line from -1 to 1, but with a small flat area in the middle around zero.


Date: Sat, 9 Apr 2016 20:40:14 +0100
From: rorywalsh@EAR.IE
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE

Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

Date2016-04-09 21:06
FromRory Walsh
SubjectRe: Pitch bend quantization/correction
Ok, lowpass filtering with something like tonek should smooth the signal. It's still sending values between 0 and 127 yeah? Why not do something like this:

kPitchBend cpsmidib
kPitchBend tonek kPitchBend, 10
;quantise to 10 steps
kscl scale k1/127, 10, 0
kscl = int(kscl)
printk2 kscl

This will only print something if the signal has changed by 10% of the full range. Is this any better?


On 9 April 2016 at 20:54, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
That doesn't prevent a slow slide from changing the pitch, so you can press the pad and slide slightly and it's going to sound out of tune. Also it always changes, it's continuous, and it's quite sensitive so it has very small variations.
What I was thinking is filtering the bend message with a low pass filter so those very fast small variations are ignored, and with a high pass filter so only the wanted movements like a vibrato with a fast enough frequency are used.
But I don't know if that would work (again new to dsp) and it probably has other problems.
I hope I cleared out a bit the problem, It's a bit hard for me to describe, but It's not as trivial as it sounds (at least for me)

2016-04-09 21:40 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

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

Date2016-04-09 21:54
FromGerard Rodríguez
SubjectRe: Pitch bend quantization/correction

I tried my idea of high filtering the signal and it kinda works, the only disadvantage is that I can't slide outside the pad, but I fix it by just filtering inside the pad, that means that if I slide outside and land on a note then I can still get that note out of tune but It's OK. I guess I shouldn't have been afraid to try, Csound scares me a bit :P


kPchBnd tonek kPchBnd, 10

if (kPchBnd < 0.5) then

     kPchBnd atonek kPchBnd, 4

endif

you get a float between  0 and the pich bend range with  pchbend (well you can get whatever you want but you want that to be able to sum it to the midi note number) I tried your idea but I don't quite get it Rory.

Ideally I still would like to get the note after a long slide to be filtered in the same way but it doesn't bother me that much.



Thanks for your ideas.


2016-04-09 22:06 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ok, lowpass filtering with something like tonek should smooth the signal. It's still sending values between 0 and 127 yeah? Why not do something like this:

kPitchBend cpsmidib
kPitchBend tonek kPitchBend, 10
;quantise to 10 steps
kscl scale k1/127, 10, 0
kscl = int(kscl)
printk2 kscl

This will only print something if the signal has changed by 10% of the full range. Is this any better?


On 9 April 2016 at 20:54, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
That doesn't prevent a slow slide from changing the pitch, so you can press the pad and slide slightly and it's going to sound out of tune. Also it always changes, it's continuous, and it's quite sensitive so it has very small variations.
What I was thinking is filtering the bend message with a low pass filter so those very fast small variations are ignored, and with a high pass filter so only the wanted movements like a vibrato with a fast enough frequency are used.
But I don't know if that would work (again new to dsp) and it probably has other problems.
I hope I cleared out a bit the problem, It's a bit hard for me to describe, but It's not as trivial as it sounds (at least for me)

2016-04-09 21:40 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

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

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

Date2016-04-09 22:59
FromRory Walsh
SubjectRe: Pitch bend quantization/correction

My idea assumes that the pitch bend varies between 0 and 127 but you can change that. It basically quantises the signal so a call to changed doesn't return 1 until you've moved your figure 1/10 of the width of the pad. I'm not sure how the high pass filter helps here but if it's working for you then plough ahead.

On 9 Apr 2016 9:54 pm, "Gerard Rodríguez" <binbiniqegabenik@gmail.com> wrote:

I tried my idea of high filtering the signal and it kinda works, the only disadvantage is that I can't slide outside the pad, but I fix it by just filtering inside the pad, that means that if I slide outside and land on a note then I can still get that note out of tune but It's OK. I guess I shouldn't have been afraid to try, Csound scares me a bit :P


kPchBnd tonek kPchBnd, 10

if (kPchBnd < 0.5) then

     kPchBnd atonek kPchBnd, 4

endif

you get a float between  0 and the pich bend range with  pchbend (well you can get whatever you want but you want that to be able to sum it to the midi note number) I tried your idea but I don't quite get it Rory.

Ideally I still would like to get the note after a long slide to be filtered in the same way but it doesn't bother me that much.



Thanks for your ideas.


2016-04-09 22:06 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ok, lowpass filtering with something like tonek should smooth the signal. It's still sending values between 0 and 127 yeah? Why not do something like this:

kPitchBend cpsmidib
kPitchBend tonek kPitchBend, 10
;quantise to 10 steps
kscl scale k1/127, 10, 0
kscl = int(kscl)
printk2 kscl

This will only print something if the signal has changed by 10% of the full range. Is this any better?


On 9 April 2016 at 20:54, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
That doesn't prevent a slow slide from changing the pitch, so you can press the pad and slide slightly and it's going to sound out of tune. Also it always changes, it's continuous, and it's quite sensitive so it has very small variations.
What I was thinking is filtering the bend message with a low pass filter so those very fast small variations are ignored, and with a high pass filter so only the wanted movements like a vibrato with a fast enough frequency are used.
But I don't know if that would work (again new to dsp) and it probably has other problems.
I hope I cleared out a bit the problem, It's a bit hard for me to describe, but It's not as trivial as it sounds (at least for me)

2016-04-09 21:40 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

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

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

Date2016-04-09 23:21
FromGerard Rodríguez
SubjectRe: Pitch bend quantization/correction
It works because when the signal doesn't change faster than the high pass filter frequency then it stays at 0, so no pitch bend unless you do a vibrato faster than the high pass frequency. At least that's how I understand it.
What you propose still would allow for a slow slide on the pad to change pitch right?

2016-04-09 23:59 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:

My idea assumes that the pitch bend varies between 0 and 127 but you can change that. It basically quantises the signal so a call to changed doesn't return 1 until you've moved your figure 1/10 of the width of the pad. I'm not sure how the high pass filter helps here but if it's working for you then plough ahead.

On 9 Apr 2016 9:54 pm, "Gerard Rodríguez" <binbiniqegabenik@gmail.com> wrote:

I tried my idea of high filtering the signal and it kinda works, the only disadvantage is that I can't slide outside the pad, but I fix it by just filtering inside the pad, that means that if I slide outside and land on a note then I can still get that note out of tune but It's OK. I guess I shouldn't have been afraid to try, Csound scares me a bit :P


kPchBnd tonek kPchBnd, 10

if (kPchBnd < 0.5) then

     kPchBnd atonek kPchBnd, 4

endif

you get a float between  0 and the pich bend range with  pchbend (well you can get whatever you want but you want that to be able to sum it to the midi note number) I tried your idea but I don't quite get it Rory.

Ideally I still would like to get the note after a long slide to be filtered in the same way but it doesn't bother me that much.



Thanks for your ideas.


2016-04-09 22:06 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ok, lowpass filtering with something like tonek should smooth the signal. It's still sending values between 0 and 127 yeah? Why not do something like this:

kPitchBend cpsmidib
kPitchBend tonek kPitchBend, 10
;quantise to 10 steps
kscl scale k1/127, 10, 0
kscl = int(kscl)
printk2 kscl

This will only print something if the signal has changed by 10% of the full range. Is this any better?


On 9 April 2016 at 20:54, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
That doesn't prevent a slow slide from changing the pitch, so you can press the pad and slide slightly and it's going to sound out of tune. Also it always changes, it's continuous, and it's quite sensitive so it has very small variations.
What I was thinking is filtering the bend message with a low pass filter so those very fast small variations are ignored, and with a high pass filter so only the wanted movements like a vibrato with a fast enough frequency are used.
But I don't know if that would work (again new to dsp) and it probably has other problems.
I hope I cleared out a bit the problem, It's a bit hard for me to describe, but It's not as trivial as it sounds (at least for me)

2016-04-09 21:40 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

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

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

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

Date2016-04-09 23:28
FromGerard Rodríguez
SubjectRe: Pitch bend quantization/correction
How would I check if a signal hasn't changed in x seconds? I think I know how to fix the issue with the high filter method. If I quantize the signal to get the pad my finger is on during a slide, I can check if it stays longer than x seconds there and then filter the signal like I do in the initial touch.

2016-04-10 0:21 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:
It works because when the signal doesn't change faster than the high pass filter frequency then it stays at 0, so no pitch bend unless you do a vibrato faster than the high pass frequency. At least that's how I understand it.
What you propose still would allow for a slow slide on the pad to change pitch right?

2016-04-09 23:59 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:

My idea assumes that the pitch bend varies between 0 and 127 but you can change that. It basically quantises the signal so a call to changed doesn't return 1 until you've moved your figure 1/10 of the width of the pad. I'm not sure how the high pass filter helps here but if it's working for you then plough ahead.

On 9 Apr 2016 9:54 pm, "Gerard Rodríguez" <binbiniqegabenik@gmail.com> wrote:

I tried my idea of high filtering the signal and it kinda works, the only disadvantage is that I can't slide outside the pad, but I fix it by just filtering inside the pad, that means that if I slide outside and land on a note then I can still get that note out of tune but It's OK. I guess I shouldn't have been afraid to try, Csound scares me a bit :P


kPchBnd tonek kPchBnd, 10

if (kPchBnd < 0.5) then

     kPchBnd atonek kPchBnd, 4

endif

you get a float between  0 and the pich bend range with  pchbend (well you can get whatever you want but you want that to be able to sum it to the midi note number) I tried your idea but I don't quite get it Rory.

Ideally I still would like to get the note after a long slide to be filtered in the same way but it doesn't bother me that much.



Thanks for your ideas.


2016-04-09 22:06 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ok, lowpass filtering with something like tonek should smooth the signal. It's still sending values between 0 and 127 yeah? Why not do something like this:

kPitchBend cpsmidib
kPitchBend tonek kPitchBend, 10
;quantise to 10 steps
kscl scale k1/127, 10, 0
kscl = int(kscl)
printk2 kscl

This will only print something if the signal has changed by 10% of the full range. Is this any better?


On 9 April 2016 at 20:54, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
That doesn't prevent a slow slide from changing the pitch, so you can press the pad and slide slightly and it's going to sound out of tune. Also it always changes, it's continuous, and it's quite sensitive so it has very small variations.
What I was thinking is filtering the bend message with a low pass filter so those very fast small variations are ignored, and with a high pass filter so only the wanted movements like a vibrato with a fast enough frequency are used.
But I don't know if that would work (again new to dsp) and it probably has other problems.
I hope I cleared out a bit the problem, It's a bit hard for me to describe, but It's not as trivial as it sounds (at least for me)

2016-04-09 21:40 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

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

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


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

Date2016-04-10 00:07
FromGerard Rodríguez
SubjectRe: Pitch bend quantization/correction

Ok this does the trick, not the pretiest code ever though :P


kChangePadTime init 0

kLastPad init 0

ktime timeinsts

kPortTime linseg 0,0.001,0.01


iRange = 12 ; pitch bend range in semitones

iMin = 0 ; equilibrium position

kPchBnd pchbend iMin, 2*iRange

kPchBnd tonek kPchBnd, 10

kPchBnd portk kPchBnd,kPortTime


kCurrentPad = round(kPchBnd)


if (kCurrentPad > kLastPad) then

   kLastPad = kCurrentPad

   kChangePadTime = ktime

endif


if (ktime - kChangePadTime) > 0.4 || kCurrentPad == 0 then

   if (kPchBnd < 0.5 && kPchBnd > -0.5) then

     kPchBnd atonek kPchBnd, 3

   endif

endif


2016-04-10 0:28 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:
How would I check if a signal hasn't changed in x seconds? I think I know how to fix the issue with the high filter method. If I quantize the signal to get the pad my finger is on during a slide, I can check if it stays longer than x seconds there and then filter the signal like I do in the initial touch.

2016-04-10 0:21 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:
It works because when the signal doesn't change faster than the high pass filter frequency then it stays at 0, so no pitch bend unless you do a vibrato faster than the high pass frequency. At least that's how I understand it.
What you propose still would allow for a slow slide on the pad to change pitch right?

2016-04-09 23:59 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:

My idea assumes that the pitch bend varies between 0 and 127 but you can change that. It basically quantises the signal so a call to changed doesn't return 1 until you've moved your figure 1/10 of the width of the pad. I'm not sure how the high pass filter helps here but if it's working for you then plough ahead.

On 9 Apr 2016 9:54 pm, "Gerard Rodríguez" <binbiniqegabenik@gmail.com> wrote:

I tried my idea of high filtering the signal and it kinda works, the only disadvantage is that I can't slide outside the pad, but I fix it by just filtering inside the pad, that means that if I slide outside and land on a note then I can still get that note out of tune but It's OK. I guess I shouldn't have been afraid to try, Csound scares me a bit :P


kPchBnd tonek kPchBnd, 10

if (kPchBnd < 0.5) then

     kPchBnd atonek kPchBnd, 4

endif

you get a float between  0 and the pich bend range with  pchbend (well you can get whatever you want but you want that to be able to sum it to the midi note number) I tried your idea but I don't quite get it Rory.

Ideally I still would like to get the note after a long slide to be filtered in the same way but it doesn't bother me that much.



Thanks for your ideas.


2016-04-09 22:06 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ok, lowpass filtering with something like tonek should smooth the signal. It's still sending values between 0 and 127 yeah? Why not do something like this:

kPitchBend cpsmidib
kPitchBend tonek kPitchBend, 10
;quantise to 10 steps
kscl scale k1/127, 10, 0
kscl = int(kscl)
printk2 kscl

This will only print something if the signal has changed by 10% of the full range. Is this any better?


On 9 April 2016 at 20:54, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
That doesn't prevent a slow slide from changing the pitch, so you can press the pad and slide slightly and it's going to sound out of tune. Also it always changes, it's continuous, and it's quite sensitive so it has very small variations.
What I was thinking is filtering the bend message with a low pass filter so those very fast small variations are ignored, and with a high pass filter so only the wanted movements like a vibrato with a fast enough frequency are used.
But I don't know if that would work (again new to dsp) and it probably has other problems.
I hope I cleared out a bit the problem, It's a bit hard for me to describe, but It's not as trivial as it sounds (at least for me)

2016-04-09 21:40 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

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

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



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

Date2016-04-10 00:37
FromGerard Rodríguez
SubjectRe: Pitch bend quantization/correction
Not quite, it has to be a bit uglier

if (ktime - kChangePadTime) > 0.4 || kCurrentPad == 0 then

   if (kPchBnd < 0.5+kCurrentPad && kPchBnd > -0.5-kCurrentPad) then

     kPchBndT atonek kPchBnd, 3

     if (kPchBndT < 0.5 && kPchBndT > -0.5) then

       kPchBnd = kPchBndT+kCurrentPad

     endif

   endif

endif

Well, with this I'd consider my problem solved, thanks for reading and helping



2016-04-10 1:07 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:

Ok this does the trick, not the pretiest code ever though :P


kChangePadTime init 0

kLastPad init 0

ktime timeinsts

kPortTime linseg 0,0.001,0.01


iRange = 12 ; pitch bend range in semitones

iMin = 0 ; equilibrium position

kPchBnd pchbend iMin, 2*iRange

kPchBnd tonek kPchBnd, 10

kPchBnd portk kPchBnd,kPortTime


kCurrentPad = round(kPchBnd)


if (kCurrentPad > kLastPad) then

   kLastPad = kCurrentPad

   kChangePadTime = ktime

endif


if (ktime - kChangePadTime) > 0.4 || kCurrentPad == 0 then

   if (kPchBnd < 0.5 && kPchBnd > -0.5) then

     kPchBnd atonek kPchBnd, 3

   endif

endif


2016-04-10 0:28 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:
How would I check if a signal hasn't changed in x seconds? I think I know how to fix the issue with the high filter method. If I quantize the signal to get the pad my finger is on during a slide, I can check if it stays longer than x seconds there and then filter the signal like I do in the initial touch.

2016-04-10 0:21 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:
It works because when the signal doesn't change faster than the high pass filter frequency then it stays at 0, so no pitch bend unless you do a vibrato faster than the high pass frequency. At least that's how I understand it.
What you propose still would allow for a slow slide on the pad to change pitch right?

2016-04-09 23:59 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:

My idea assumes that the pitch bend varies between 0 and 127 but you can change that. It basically quantises the signal so a call to changed doesn't return 1 until you've moved your figure 1/10 of the width of the pad. I'm not sure how the high pass filter helps here but if it's working for you then plough ahead.

On 9 Apr 2016 9:54 pm, "Gerard Rodríguez" <binbiniqegabenik@gmail.com> wrote:

I tried my idea of high filtering the signal and it kinda works, the only disadvantage is that I can't slide outside the pad, but I fix it by just filtering inside the pad, that means that if I slide outside and land on a note then I can still get that note out of tune but It's OK. I guess I shouldn't have been afraid to try, Csound scares me a bit :P


kPchBnd tonek kPchBnd, 10

if (kPchBnd < 0.5) then

     kPchBnd atonek kPchBnd, 4

endif

you get a float between  0 and the pich bend range with  pchbend (well you can get whatever you want but you want that to be able to sum it to the midi note number) I tried your idea but I don't quite get it Rory.

Ideally I still would like to get the note after a long slide to be filtered in the same way but it doesn't bother me that much.



Thanks for your ideas.


2016-04-09 22:06 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ok, lowpass filtering with something like tonek should smooth the signal. It's still sending values between 0 and 127 yeah? Why not do something like this:

kPitchBend cpsmidib
kPitchBend tonek kPitchBend, 10
;quantise to 10 steps
kscl scale k1/127, 10, 0
kscl = int(kscl)
printk2 kscl

This will only print something if the signal has changed by 10% of the full range. Is this any better?


On 9 April 2016 at 20:54, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
That doesn't prevent a slow slide from changing the pitch, so you can press the pad and slide slightly and it's going to sound out of tune. Also it always changes, it's continuous, and it's quite sensitive so it has very small variations.
What I was thinking is filtering the bend message with a low pass filter so those very fast small variations are ignored, and with a high pass filter so only the wanted movements like a vibrato with a fast enough frequency are used.
But I don't know if that would work (again new to dsp) and it probably has other problems.
I hope I cleared out a bit the problem, It's a bit hard for me to describe, but It's not as trivial as it sounds (at least for me)

2016-04-09 21:40 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

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

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




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

Date2016-04-10 09:51
FromRory Walsh
SubjectRe: Pitch bend quantization/correction
Nice one. I wouldn't worry if it's ugly code. It works. Happy days. 

On 10 April 2016 at 00:37, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Not quite, it has to be a bit uglier

if (ktime - kChangePadTime) > 0.4 || kCurrentPad == 0 then

   if (kPchBnd < 0.5+kCurrentPad && kPchBnd > -0.5-kCurrentPad) then

     kPchBndT atonek kPchBnd, 3

     if (kPchBndT < 0.5 && kPchBndT > -0.5) then

       kPchBnd = kPchBndT+kCurrentPad

     endif

   endif

endif

Well, with this I'd consider my problem solved, thanks for reading and helping



2016-04-10 1:07 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:

Ok this does the trick, not the pretiest code ever though :P


kChangePadTime init 0

kLastPad init 0

ktime timeinsts

kPortTime linseg 0,0.001,0.01


iRange = 12 ; pitch bend range in semitones

iMin = 0 ; equilibrium position

kPchBnd pchbend iMin, 2*iRange

kPchBnd tonek kPchBnd, 10

kPchBnd portk kPchBnd,kPortTime


kCurrentPad = round(kPchBnd)


if (kCurrentPad > kLastPad) then

   kLastPad = kCurrentPad

   kChangePadTime = ktime

endif


if (ktime - kChangePadTime) > 0.4 || kCurrentPad == 0 then

   if (kPchBnd < 0.5 && kPchBnd > -0.5) then

     kPchBnd atonek kPchBnd, 3

   endif

endif


2016-04-10 0:28 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:
How would I check if a signal hasn't changed in x seconds? I think I know how to fix the issue with the high filter method. If I quantize the signal to get the pad my finger is on during a slide, I can check if it stays longer than x seconds there and then filter the signal like I do in the initial touch.

2016-04-10 0:21 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:
It works because when the signal doesn't change faster than the high pass filter frequency then it stays at 0, so no pitch bend unless you do a vibrato faster than the high pass frequency. At least that's how I understand it.
What you propose still would allow for a slow slide on the pad to change pitch right?

2016-04-09 23:59 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:

My idea assumes that the pitch bend varies between 0 and 127 but you can change that. It basically quantises the signal so a call to changed doesn't return 1 until you've moved your figure 1/10 of the width of the pad. I'm not sure how the high pass filter helps here but if it's working for you then plough ahead.

On 9 Apr 2016 9:54 pm, "Gerard Rodríguez" <binbiniqegabenik@gmail.com> wrote:

I tried my idea of high filtering the signal and it kinda works, the only disadvantage is that I can't slide outside the pad, but I fix it by just filtering inside the pad, that means that if I slide outside and land on a note then I can still get that note out of tune but It's OK. I guess I shouldn't have been afraid to try, Csound scares me a bit :P


kPchBnd tonek kPchBnd, 10

if (kPchBnd < 0.5) then

     kPchBnd atonek kPchBnd, 4

endif

you get a float between  0 and the pich bend range with  pchbend (well you can get whatever you want but you want that to be able to sum it to the midi note number) I tried your idea but I don't quite get it Rory.

Ideally I still would like to get the note after a long slide to be filtered in the same way but it doesn't bother me that much.



Thanks for your ideas.


2016-04-09 22:06 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ok, lowpass filtering with something like tonek should smooth the signal. It's still sending values between 0 and 127 yeah? Why not do something like this:

kPitchBend cpsmidib
kPitchBend tonek kPitchBend, 10
;quantise to 10 steps
kscl scale k1/127, 10, 0
kscl = int(kscl)
printk2 kscl

This will only print something if the signal has changed by 10% of the full range. Is this any better?


On 9 April 2016 at 20:54, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
That doesn't prevent a slow slide from changing the pitch, so you can press the pad and slide slightly and it's going to sound out of tune. Also it always changes, it's continuous, and it's quite sensitive so it has very small variations.
What I was thinking is filtering the bend message with a low pass filter so those very fast small variations are ignored, and with a high pass filter so only the wanted movements like a vibrato with a fast enough frequency are used.
But I don't know if that would work (again new to dsp) and it probably has other problems.
I hope I cleared out a bit the problem, It's a bit hard for me to describe, but It's not as trivial as it sounds (at least for me)

2016-04-09 21:40 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

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

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




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

Date2016-04-10 17:01
FromOeyvind Brandtsegg
SubjectRe: Pitch bend quantization/correction

Aren't you the one with the obsessive coding syndrome? :-)

10. apr. 2016 10.52 skrev "Rory Walsh" <rorywalsh@ear.ie>:
Nice one. I wouldn't worry if it's ugly code. It works. Happy days. 

On 10 April 2016 at 00:37, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Not quite, it has to be a bit uglier

if (ktime - kChangePadTime) > 0.4 || kCurrentPad == 0 then

   if (kPchBnd < 0.5+kCurrentPad && kPchBnd > -0.5-kCurrentPad) then

     kPchBndT atonek kPchBnd, 3

     if (kPchBndT < 0.5 && kPchBndT > -0.5) then

       kPchBnd = kPchBndT+kCurrentPad

     endif

   endif

endif

Well, with this I'd consider my problem solved, thanks for reading and helping



2016-04-10 1:07 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:

Ok this does the trick, not the pretiest code ever though :P


kChangePadTime init 0

kLastPad init 0

ktime timeinsts

kPortTime linseg 0,0.001,0.01


iRange = 12 ; pitch bend range in semitones

iMin = 0 ; equilibrium position

kPchBnd pchbend iMin, 2*iRange

kPchBnd tonek kPchBnd, 10

kPchBnd portk kPchBnd,kPortTime


kCurrentPad = round(kPchBnd)


if (kCurrentPad > kLastPad) then

   kLastPad = kCurrentPad

   kChangePadTime = ktime

endif


if (ktime - kChangePadTime) > 0.4 || kCurrentPad == 0 then

   if (kPchBnd < 0.5 && kPchBnd > -0.5) then

     kPchBnd atonek kPchBnd, 3

   endif

endif


2016-04-10 0:28 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:
How would I check if a signal hasn't changed in x seconds? I think I know how to fix the issue with the high filter method. If I quantize the signal to get the pad my finger is on during a slide, I can check if it stays longer than x seconds there and then filter the signal like I do in the initial touch.

2016-04-10 0:21 GMT+02:00 Gerard Rodríguez <binbiniqegabenik@gmail.com>:
It works because when the signal doesn't change faster than the high pass filter frequency then it stays at 0, so no pitch bend unless you do a vibrato faster than the high pass frequency. At least that's how I understand it.
What you propose still would allow for a slow slide on the pad to change pitch right?

2016-04-09 23:59 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:

My idea assumes that the pitch bend varies between 0 and 127 but you can change that. It basically quantises the signal so a call to changed doesn't return 1 until you've moved your figure 1/10 of the width of the pad. I'm not sure how the high pass filter helps here but if it's working for you then plough ahead.

On 9 Apr 2016 9:54 pm, "Gerard Rodríguez" <binbiniqegabenik@gmail.com> wrote:

I tried my idea of high filtering the signal and it kinda works, the only disadvantage is that I can't slide outside the pad, but I fix it by just filtering inside the pad, that means that if I slide outside and land on a note then I can still get that note out of tune but It's OK. I guess I shouldn't have been afraid to try, Csound scares me a bit :P


kPchBnd tonek kPchBnd, 10

if (kPchBnd < 0.5) then

     kPchBnd atonek kPchBnd, 4

endif

you get a float between  0 and the pich bend range with  pchbend (well you can get whatever you want but you want that to be able to sum it to the midi note number) I tried your idea but I don't quite get it Rory.

Ideally I still would like to get the note after a long slide to be filtered in the same way but it doesn't bother me that much.



Thanks for your ideas.


2016-04-09 22:06 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ok, lowpass filtering with something like tonek should smooth the signal. It's still sending values between 0 and 127 yeah? Why not do something like this:

kPitchBend cpsmidib
kPitchBend tonek kPitchBend, 10
;quantise to 10 steps
kscl scale k1/127, 10, 0
kscl = int(kscl)
printk2 kscl

This will only print something if the signal has changed by 10% of the full range. Is this any better?


On 9 April 2016 at 20:54, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
That doesn't prevent a slow slide from changing the pitch, so you can press the pad and slide slightly and it's going to sound out of tune. Also it always changes, it's continuous, and it's quite sensitive so it has very small variations.
What I was thinking is filtering the bend message with a low pass filter so those very fast small variations are ignored, and with a high pass filter so only the wanted movements like a vibrato with a fast enough frequency are used.
But I don't know if that would work (again new to dsp) and it probably has other problems.
I hope I cleared out a bit the problem, It's a bit hard for me to describe, but It's not as trivial as it sounds (at least for me)

2016-04-09 21:40 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Use your note-on message to set the pitch, then you react to a pitch bend message only if it has changed from the initial pad press. In pseudo code it might look like this (I'm assuming that each pad press triggers an instrument to start)

iNote notnum
kPtichBend cpsmidib

if changed:k(kPitchBend)==1 then
   //code here will only be reached if you change the pitch bend value after the initial press
endif

This might be be a little work depending on how sensitive the pads are to movement. But you get the idea? 


On 9 April 2016 at 20:31, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Yes I am using Csound, although sometimes I also use supercollider that's why I asked more generally for an algorithm.

You didn't understand me right, I want the pitch bend data, I don't want to ignore it, I want it to be corrected for the initial touch, and the following movements, for example if I do a slow slide I don't want it to affect pitch but I want to be able to do vibratos. If it's easier to understand think a theremin, that was slightly quantized so your initial pitch lands on the correct note but you have a bit of a wiggle room to move without affecting pitch, however if you move faster to do a vibrato or a slide it works as expected (the theremini does this).

2016-04-09 20:33 GMT+02:00 Iain McCurdy <i_mccurdy@hotmail.com>:
If you are using Csound as your synthesiser then it is easy just to ignore the pitch bend data if you don't want it to affect tuning. Are you using Csound as your synthesiser? I don't think that you have stated that explicitly yet.
Iain


Date: Sat, 9 Apr 2016 20:10:40 +0200
From: binbiniqegabenik@GMAIL.COM
Subject: Re: [Csnd] Pitch bend quantization/correction
To: CSOUND@LISTSERV.HEANET.IE


That's right you get a note on, and then a continuous stream of pitch bend messages.

2016-04-09 19:41 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
When you hit a square, you get a note on message, AND a pitch bend message? As in you get two separate MIDI messages or? 

On 9 April 2016 at 13:59, Gerard Rodríguez <binbiniqegabenik@gmail.com> wrote:
Hi everyone,

I want to correct a pitch bend message so that the note on always sounds in tune but allows for vibratos and pitch slides (and ignores slow movements).

For a bit of context, this is the controller that I'm using. http://www.rogerlinndesign.com/linnstrument.html

When I hit a square, the pitch bend message depends on the x position of the finger, so if I were to hit the square on the right side, and use the pitch bend message as is it would sound a quarter step out of tune.

The controller does have a pitch correction feature, but I want to use the x position to control other things so I need the original pitch bend message (and sometimes their correction is a bit buggy)

I don't know much about dsp and this is a tricky problem that I don't know how to tackle.

Any ideas?

Thanks.


PD: I hope it's OK to use this list for these kind of general questions
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

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

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

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

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




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
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