[linux-audio-user] remapping midi notes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hallo,
Joey Reid hat gesagt: // Joey Reid wrote:

> thanks, Frank. I am looking at pd now - trying to figure out where to 
> start form the docs is not obvious

First read the html-docs ("doc/1.manual"), then go through the other
directories in "doc" by number. The patches in "2.control.examples"
should help you most, as you don't need audio currently. The patches
are numbered as well, they should be read like a tutorial in order.

But please read the html-manual first.

After that you will have mastered Pd already, as there's not much to
it besides some shortcuts involving the Ctl-key. ;)

Every (well, most) Pd object has a help-file, that you can open by
right-clicking (Command(?)-click on OS-X) and selecting "Help".
Tip 1: You can edit the help-files, too.

> I am looking at these now. I am not on my linux pc, and it seems there 
> is an annoying bug in the OS X version where the mouse pointer is not 
> getting interpreted at the correct location. very annoying (could be a 
> tk bug, but I don't have any other tk apps to check against.

I've heard this happen on OS-X before. I think, it might be a clash
with a certain tcl/tk version, but I don't know for sure, as I don't
run OS-X. 

> so in my case, it would look like the following:
> 
> [notein]
>   |     /
> [<do something to change note value>]
>   |  |   /
> [noteout]
> 
> the <do something to change note value> would have to be something that 
> will read only the note value, change it based on a
> set of rules, and then pass it on without modifying the velocity/type.  

Yep, that's it. The early Max systems didn't know audio, so all you
did and could do with them was creating and modifying (midi) numbers.

Using Pd actually means looking for the "do something to change
something" part. And it also means finding out what to do. 

"Pd development" == "what should I do?" + "how the heck do I do it?"

> i probably should be filtering for note-on.
> 
> the help files show notein like this:
> 
> [notein]
> |\\
> [0] [0] [0]
> 
> i assume this means that it produces three numbers. do these represent 
> type, key and velocity? 
>
> which is which? and how do i modify the value of one of those
> numbers? 

The values are note, key and midi channel (left to right). If you
create notein with a number it is used as midi channel, so [notein 7]
only will have two outlets, for note and velocity. You can attach
number objects to the outlets. Go into Edit Mode (Ctl-E), add a number
(Ctl-3), connect the notein-outlet to that number by dragging, then
leave Edit Mode (Ctl-E again). If oyu now play something on the midi
port, you should see the notes come in. You can then do math on them. 

Add a [+ 10] object  by Ctl-E, Ctl-1 to create an object, then type "+
10" into the object box. Connect another number box there. You will
see that 10 get added to the notein value you connected the [+ 10] to.

> i assume this is where pack/unpack come in, but i don't
> quite get that. sorry if i'm being dense here.

You can modify the numbers as single entities as I showed above, but
you can also create lists. This is very useful, as notes are actually
at least two values: note value and velocity value, that then can be
transported in union. 

To create a list, you [pack] those two numbers. [pack] needs to know
what to pack into a list, so you need to create it with default
arguments. That is, what the [pack 0 0] in my example does: It accepts
two numbers (both 0 as default) and outputs a list of two numbers. 

Tip 2: Try connecting a [print] object to the pack and watch the
console output on note changes: It will print something like 

print: list 60 109

[unpack 0 0] would unpack the two-floats-list again so you get back at
the two floats --- which is needed because [noteout] doesn't like
lists (or maybe it does?)

Ciao
-- 
 Frank Barknecht                               _ ______footils.org__

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux