Semitone set-up

Steven's icon

Hi, I am trying to implement a semitone control for an oscillator that will operate at plus/minus four octaves in semitone steps. At the moment when I try to turn the numbers to minus values it increases the pitch instead of decreasing it. Can you advice me on how to get this to work?
Many thanks,
Ste

Steven Miller's icon

Can you post an example patch showing how you're currently trying it?
It might make it easier to give you specific tips.

On Jan 30, 2007, at 12:53 PM, Steven Holt wrote:

>
> Hi, I am trying to implement a semitone control for an oscillator
> that will operate at plus/minus four octaves in semitone steps. At
> the moment when I try to turn the numbers to minus values it
> increases the pitch instead of decreasing it. Can you advice me on
> how to get this to work?
> Many thanks,
> Ste

----
Steven M. Miller

http://pubweb.csf.edu/~smill
SFIFEM
Atrium Sound Space
OVOS

Steven's icon

Sorry I prefer not to post it but it's a poly~ synth where I have the MIDI note info coming into the subpatch to play an oscillator. After the mtof object I have a + object with a poly~ in on its right inlet. I then have a number box going into that in on poly~ which is centred at 0 with plus/minus 48 to cover four octaves. The problem is either way I go it increases the pitch instead of decreasing it in the minus values. I hope you can help.
Ste

davidestevens's icon

Difficult to know without seeing the patch, but if you put a number
box inside the poly~ patch to see what values are actually arriving
at the oscillator, it might give you an idea as to where the numbers
are going wrong. I would suspect something missing (like an offset)
in the chain which modifies the midi note before sending it to the
oscillator.

David

On 31 Jan 2007, at 11:44, Steven Holt wrote:

>
> Sorry I prefer not to post it but it's a poly~ synth where I have
> the MIDI note info coming into the subpatch to play an oscillator.
> After the mtof object I have a + object with a poly~ in on its
> right inlet. I then have a number box going into that in on poly~
> which is centred at 0 with plus/minus 48 to cover four octaves. The
> problem is either way I go it increases the pitch instead of
> decreasing it in the minus values. I hope you can help.
> Ste

redhexagonal's icon

it would be alot easier if you posted at least a partial patch of the bit thats not working. otherwise, isolate the problem. use the max window, print, and number boxes to view data, eventually youll find the problem

Steven's icon

Fair enough here is my patches in text form. I want to include a semitone control mainly to enhance the effects of FM between oscillators 1 and 2. Can you also advice me on the best way to set up an FM synth effect between oscillators 1 and 2? I just sent their outputs to *~ but I don't think it is this simple. Its not really doing a great deal to the overal tone...
Thanks.
Ste

Host patch

Max Patch
Copy patch and select New From Clipboard in Max.

Sub patch

Max Patch
Copy patch and select New From Clipboard in Max.

davidestevens's icon

One thing that's immediately apparent -
You're sending a midi note value (0-127) to the synthesizer module,
and then adding/subtracting a float value _before_ you convert the
note to a frequency. If you're going to slightly vary the pitch
value, you'll need to do it _after the conversion to frequency.
(There's no such thing as float midi values!)

David

On 31 Jan 2007, at 12:56, Steven Holt wrote:

>
> Fair enough here is my patches in text form. I want to include a
> semitone control mainly to enhance the effects of FM between
> oscillators 1 and 2. Can you also advice me on the best way to set
> up an FM synth effect between oscillators 1 and 2? I just sent
> their outputs to *~ but I don't think it is this simple. Its not
> really doing a great deal to the overal tone...
> Thanks.
> Ste

nathan wolek's icon

On Jan 31, 2007, at 9:24 AM, David Stevens wrote:
> (There's no such thing as float midi values!)

Actually David, there is *if* you are using [mtof]. This actually
very nice for detuning applications like Steven has here. But for
straight up MIDI, yes you are correct.

-------------------
Nathan Wolek, PhD --- nwolek@stetson.edu
Assistant Professor of Music Technology
Stetson University - DeLand, FL
http://www.nathanwolek.com

lawrence casserley's icon

Not completely true - if, for example, you use the mtof object to
convert from midi to Hz this will accept float or int as an input.

Best

L

On 31 Jan 2007, at 14:24, David Stevens wrote:

> One thing that's immediately apparent -
> You're sending a midi note value (0-127) to the synthesizer module,
> and then adding/subtracting a float value _before_ you convert the
> note to a frequency. If you're going to slightly vary the pitch
> value, you'll need to do it _after the conversion to frequency.
> (There's no such thing as float midi values!)
>
> David

Lawrence Casserley - lawrence@lcasserley.co.uk
Lawrence Electronic Operations - www.lcasserley.co.uk
Colourscape Music Festivals - www.colourscape.org.uk

davidestevens's icon

On 31 Jan 2007, at 14:45, Nathan Wolek wrote:

>
>> (There's no such thing as float midi values!)
>
> Actually David, there is *if* you are using [mtof]. This actually
> very nice for detuning applications like Steven has here. But for
> straight up MIDI, yes you are correct.

You can send intermediate (float) values to [mtof] ? I didn't realise
that! (hence my response). I've always done detuning after converting
midi to frequency (or more generally, buffer play speed). Hm - I
guess that's not the problem then.

David

seejayjames's icon

I haven't seen the patch (away from Max at the moment). However it sounds like you need to add the value at poly~ *before* the mtof. If you're adding it afterwards, the poly~ value acts like adding / subtracting frequencies. Which is what you want, but not the way you're envisioning---your +/- 48 semitones needs to get added / subtracted before going into the mtof. Each semitone / MIDI note represents an increase / decrease in frequency, but they're represented as integers. The actual frequency is in floats and is exponential--hence the nasty math is handled in the mtof (expr 12-th root of 2 etc... 12 semitones makes a doubling of frequency).

Frequency is mirrored on both sides of 0 Hz, as I'm sure you're aware. Perhaps when you decrease the value and the pitch goes up, it's actually going into the negative zone? Put some number boxes in there for testing and you'll figure it out.

-C

Peter Castine's icon

On 31-Jan-2007, at 16:23, David Stevens wrote:

> You can send intermediate (float) values to [mtof] ? I didn't
> realise that!

It's worth taking a look at mtof.help

-------------- http://www.bek.no/~pcastine/Litter/ -------------
Peter Castine +--> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de

AlexHarker's icon

Quote: Steven wrote on Wed, 31 January 2007 05:56
----------------------------------------------------
> Can you also advice me on the best way to set up an FM synth effect between oscillators 1 and 2? I just sent their outputs to *~ but I don't think it is this simple. Its not really doing a great deal to the overal tone...
> Thanks.

As far as I can see there is no problem with the semitone control at all. The problem is that you are ring-modulating the output of your two oscillators (multiplying them together), which results in different frequencies at the output to those of the two oscillators (the sum and difference of the two oscillators frequencies). Hence when you change the frequency of the second oscillator with the semitone control the result is not a simple "+ = higher - = lower". To see this is the case connect only the righthand osc to the biquad~, disconnecting the left-hand one and it will work as expected. This is a good example of a problem that would have been impossible to diagnose without seeing the patch, because the problem wasn't what you thought it was.

For advice on doing FM correctly it might just be worth a look at the tutorials which contain all kinds of useful tips and patches for achieving many basic dsp techniques.....

Regards

Alex