Help with MAX MIDI

Matt's icon

Hey guys, I'm a beginner with Max but I've been trying to create a bass sampling instrument. I'm having issues with getting the transratio object to work as it does recognize what notes I'm playing however it doesn't actually change the note of my buffer.

Does anyone know why it's not working?

Rob Ramirez's icon

the subtraction object is missing a space between the minus sign and the number arg, and you need to utilize the trigger object to send the bang after processing the midi note, e.g. trigger b i

Rob Ramirez's icon

think about what you want to happen. sometime it helps to say it out loud.

ie, the midi note is processed and sent to the instrument, and then then instrument is triggered via bang (i'm assuming that's what you want, since you didn't provide a patch all I can do is assume).

then remember that max ordering is right to left, so t b i (t is max shorthand for trigger, you'll see it everywhere) means "upon receiving an integer, first send that integer out my right outlet, then send a bang out my left outlet".

LSka's icon

in your [p bass] subpatcher, the second inlet must go to the [sig~] object, which is what tells [groove~] at what speed it should play.
from the first inlet comes just a bang, so you should put a message with a "0" to tell [groove~] to start playing from the beginning of the sample.

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

regarding the sample loading, the path you wrote is leading to the root of your filesystem, because it's starting with a "/". I suggest you read this article: https://docs.cycling74.com/userguide/search_path/ to learn how to manage file paths in Max

Roman Thilenius's icon

the calling and "inclusion" (are you coming from c++?) is identically for presentation mode, presenation mode is simply an optional feature to any patch.

filepaths can be relative, full paths - or you can put things into the search path, whose default settings you can find under ""file preferences" and of course you can modify them and e.g. add your dektop or your media HD.
in that case you must make sure to use unique names, expect a slap when you attempt to open "sound.wav" with "player.json"

if [transratio] is the right function to convert note numbers to something else depends on the exact target. there might be player objects other than play~ or wave~ which expect and accept other input values, for example hertz, wavelenght or delay time.

however, "ratio" or "playspeed" is quite similar to frequency, one could almost use [mtof] instead of [transatio] (which is a newer object)

midi to hertz: [expr (440. exp(.057762265 ($f1 - 69.)))]

midi to "ratio": [expr (1. exp(.057762265 (($f1+9) - 69.)))]

Roman Thilenius's icon

sorry, forgot that part. it is in the inspector (contextmenu) of the object.

Roman Thilenius's icon

while it is possible, you normally would use p.m. for subpatches only when they are opened regulary by the user. moving obejcts across levels isnt possible, you would have ot implelemnt that yourself by (re-)crating the GUI stiff in the main window and connecting it to the sub.

have you seen the [bpatcher] object yet? i think you will like it a lot.