Forums > MaxMSP

MIDI>Audio?

January 16, 2009 | 4:19 pm

Hi folks,

I’m playing around with Max and MSP (and Jitter, I suppose) pulling data from assorted sources to be used in the playing of audio. So far, I have been using a scaled RGBA output from [suckah] being moved around over an image, and it is working pretty well. However, what i’d like to do is start making these numbers into (melodic?) audio.

Obviously it would be quite easy to scale these outputted numbers from 0-108 for use with MIDI. However, this requires that I output MIDI information from Max into either another VST or some piece of MIDI-enabled hardware, but i’d like to try and keep it all ‘in-house’ if possible

Is there a way to transfer a MIDI note number into say, [cycle~] as a frequency? I could obviously use [coll] with a huge list of data in it, but that seems quite labour intensive for something that should be simple, and I much prefer to work smart, not hard ;)

As an extension to that, I wonder if it would be possible to filter or scale a mess of MIDI note numbers into a specific key?

I have played e–j’s ‘MIDI2freq’ external – I can’t even seem to even find it in the objects list, but i’d like to get along without it as well if possible.

Hope i’ve used the right words to make myself understood – kinda new to Max/MSP!

Thanks,

Loki.


January 16, 2009 | 4:33 pm

the [mtof] object turns MIDI note numbers into frequencies. Have a look through the max tutorials, I know that sometimes you might wanna dive in and start patching but the tutorials are a great resource for beginners.

lh


January 16, 2009 | 6:29 pm

>
> As an extension to that, I wonder if it would be possible to filter or scale a mess of MIDI note numbers into a specific key?
>
—————————————————-

One helpful place to start is to send midi pitch numbers through % 12, which will output the absolute pitch as a # from 0-11, representing C to B over the whole 12 semitones. This will at least let you play with the absolute pitch classes of each, but not the octave it’s played in.

Regarding keys/scales, that’s a bit more work, but you can readily make a filter on the notes (after going thru the % 12) using select. For example, a major scale pitch series is this:

0 2 4 5 7 9 11 (in C, is C D E F G A B, but it’s the same for all keys).
If you use the *inverse* of this in a select, or
sel 1 3 6 8 10
then any values coming out the *rightmost* outlet of the select will necessarily be in the major scale, as they will have to be one of the series 0 2 4 5 7 9 11. Take this as a starting point, add some multiple of 12 to go up octaves, then add 1 to 11 to this to transpose up by semitones. So, to create only a G major scale three octaves up from the bottom of MIDI (note 0), send the values through:
sel 1 3 6 8 10
take the right outlet values and go through
+ 36 (three octaves up)
+ 7 (a perfect 5th up)

and you’ll only output notes in G major, at that octave. Using number boxes attached to these + objects (better yet, a drop-down with 0 12 24 36 48 60 72 84 96 108 for the octaves) will let you choose what transposition you want on the fly. Preset these to change them quickly.

For fancier (and lots more) scales, rather than having tons of select objects, use a coll with the scale degree numbers in each entry, then find a way to compare the incoming numbers with them. Many ways to do this, look into coll help file.

hth, CJ


January 16, 2009 | 6:36 pm

Wow, thanks very much for the help guys – I must’ve completely blanked out [mtof] when I was looking. I’ve been steadily moving up through the Max and MSP tutorials, but I also wanna try and get started on my own stuff – ‘learn by doing’ and all that.

seejayjames, thank you for your miniature essay there on tuning to scales – i’ve bookmarked this thread as i’m sure that will come in handy more than once. Perhaps once I get my Max technique down, i’ll be able to create some kind of object to do all that automatically and put it up for everyone to play with.

Anyways, now that the tuning’s sorted, it’s time to experiment with [cycle~] and [adsr~] (and quite possibly a few other objects) to get a nice simple playable oscillator going.

Thanks again! :)


January 16, 2009 | 7:52 pm

> seejayjames, thank you for your miniature essay there on tuning to scales – i’ve bookmarked this thread as i’m sure that will come in handy more than once.
>

My pleasure, you’ll soon see that the choices are endless for anything you want to do. It’s pretty shocking how straightforward most of this stuff is once you’re comfortable with how things hook together. Look into pattr, mtr, tables, the many audio-mangling objects like filtergraph~, tapin~, teeth~, and good old *~, and don’t forget to come up for air once in awhile :)

–CJ


January 16, 2009 | 9:35 pm

Another similar method that CJ touches upon is to use the [coll] object to store the intervals of a particular scale.

Here is a small example patch that I’ve modified from one I made a while ago. It uses [%] and a [coll] containing the intervals of a scale within one octave. It then uses a [/] and [* 12] to work over multiple octaves. You can then set the key with a simple addition and voila you have your MIDI input forced to a particular key.

This method has an advantage over the [select] in that it turns every value into a note and doesn’t just ignore the ones it doesn’t like. However you will find that at the top end of the input range the notes become too high for MIDI.

Included in the patch is another [coll] which stores the individual semitone steps between notes in certain scales and formats them for use in the main [coll] although you might not find this part quite so useful.

I hope it opens your eyes to the possibilities you have before you and doesn’t stop you from exploring and trying to patch something useful together by yourself.

lh

– Pasted Max Patch, click to expand. –

January 17, 2009 | 2:48 pm

I have another couple of questions about Max and MSP operation which don’t seem to be covered in the references available – help files, tutorial entries, etc.

Rather than spamming the Max forum with new threads, I thought i’d ask here instead:

Is there a way to get a [counter] to increment by a non-1 value? I’m currently using a couple of [counter]s to give an X/Y coordinate for [suckah] as it scrolls across a picture dumping out RGBA values, which are then scaled and input into a [coll] to give me a nice easy to access data store – but i’m getting too much information and Max starts to bog down after about 40 rows of 320 pixels, so I want to spread out the reading a little.

Secondly, i’ve been looking for a way for a while now of creating a simple triggerable monophonic oscillator+envelope pair, a la Reaktor. I’ve looked in a few of the tutorials at objects such as [line~] and [adsr~] combined with [*~], but I think i’ve just managed to confuse myself. Some of the Max example patches (specifically, Max Examples>adsr_advanced>’Basic’ subpatcher) seem to show exactly what I want, but then wander into a [poly~] object as well?

I guess my point is that to me this seems a bit too complex of a solution, even for a program like MSP – what am I missing?

If anyone’s interested, i’ll post my patch for you guys to dissect and show me where i’m going wrong, but I don’t expect someone to bugfix my mistakes – links to tutorials and manual entries are OK, providing I can follow them(!).

Thanks again for your help,

Loki.


January 17, 2009 | 3:01 pm

Grey Loki skrev:
> Is there a way to get a [counter] to increment by a non-1 value?
You’ll want [accum] I think?
Andreas.


January 17, 2009 | 3:02 pm

Quote: Grey Loki wrote on Sat, 17 January 2009 14:48
—————————————————-
> Is there a way to get a [counter] to increment by a non-1 value?

How about just a simple multiplier ([* 2], [* 1.5], [* 4], etc.) object fed by the counter?

> If anyone’s interested, i’ll post my patch for you guys to dissect and show me where i’m going wrong, but I don’t expect someone to bugfix my mistakes – links to tutorials and manual entries are OK, providing I can follow them(!).

Would you mind posting it? I’ve got a little bit before I’m back to the grind… In the meantime, [function] is your friend.

–Brennon


January 17, 2009 | 3:40 pm

Heh, seems like the simplest solutions are the best ones, yes?

Here’s what I think is my patch – this is the first time i’ve done it, so things could get interesting…

– Pasted Max Patch, click to expand. –

You’ll need an image – any size works, but the window itself is 320×240.


January 17, 2009 | 3:56 pm

I’m not sure what exactly you want to envelope here… :)


January 17, 2009 | 4:00 pm

Heh, sorry, I should have explained that. At the time, I wanted to envelope the [phasor~] in [p melodycontrols], however I believe i’ve managed to work out a system using [line~] which you can see in this new and improved patch:

– Pasted Max Patch, click to expand. –

Thank you for looking :)


January 17, 2009 | 4:09 pm

That certainly works. As I said before, you could use [function], as well, if you want some graphical feedback/manipulation ability.


January 17, 2009 | 4:18 pm

My eventual plan is to have everything but the bare operational essentials hidden from the end-user’s view, so there’s no need for it, though i’ll certainly be remembering [function] as i’m sure it’ll be incredibly useful for any patches I make down in the future.

Thanks very much for your help, Brennon.


Viewing 14 posts - 1 through 14 (of 14 total)