Ezeer / JomTobo

Jomtobo
0 stars 0 forks source link

Midi remote control #9

Open jonjamcam opened 8 years ago

jonjamcam commented 8 years ago

I connected my keyboard and voilá. most CC on CH1 controls first track!

wow. this is cool, but we need to use a standard midi mapping

Ezeer commented 8 years ago

no problem . ^^

jonjamcam commented 8 years ago

Ezee can you point me to where is the code for this feature?

Ezeer commented 8 years ago

i was looking to that , it's dispatched in several files , from midimessage to audionodes , need to work a little to remember the flow ...

jonjamcam commented 8 years ago

k. In the meantime this is my idea of where to start with this:

d3200 midicontrol

I have a portable studio KORG D3200 that has already mapped all this and the standard is very interesting....

Ezeer commented 8 years ago

the very simple implementation is here : https://github.com/Ezeer/JomTobo/blob/JonJamConcept/Client/src/MainController.cpp#L610

if(msg.isControl()){ int inputTrackIndex = 0;//just for test for while, we need get this index from the mapping pair char cc = msg.getData1(); char ccValue = msg.getData2(); qCDebug(jtMidi) << "Control Change received: " << QString::number(cc) << " -> " << QString::number(ccValue); getInputTrack(inputTrackIndex)->setGain(ccValue/127.0); }

jonjamcam commented 8 years ago

Ok Good, I can start studying that code...thx

Ezeer commented 8 years ago

yeah , if you do : int inputTrackIndex = 1;

then the control will be affected to track 1 ( 0=first , 1=second etc ...) BUT if the track doesn't exist you may have a crash ....

jonjamcam commented 8 years ago

ok. thx. I have first to translate the chart above....

Ezeer commented 8 years ago

char cc = msg.getData1(); <--- the type of control char ccValue = msg.getData2();<--- the value of control

Ezeer commented 8 years ago

peerhaps it's better to create a midi branch for that work , because it could be merged after with any new project/branch ...

jonjamcam commented 8 years ago

Yes, good idea

Ezeer commented 8 years ago

ok , i create one so . ( from master )

Ezeer commented 8 years ago

the branch is here : https://github.com/Ezeer/JomTobo/tree/midiCC

jonjamcam commented 8 years ago

So my problem is the following:

we have 16 midi channels and each channel 128 CC. The most common uses are for example CC7 FADER, CC 10 PAN, etc, so if we follow a standard we will have

CH1, CC7 (FADER 1st Channel) CH1, CC10 (PAN 1st Channel) CH2, CC7 (FADER 2nd Channel) ....

This is a problem because if you plug a keyboard you will need this same mappings for your instruments......

So we have several choices to solve this:

1.- Use non-standard CC. 2.- Use other than CH1,2,3, etc.

CH10 is reserved for drums and CH1,2,3,4 are mostly used by the user so:

For example:

1.- As Jamconcept has max 8 channels for the control section we can use CH 6,7,8,9 for the 4 first subchannels and CH 13,14,15,16 for the second subchannels. this way we can map CC7 to FADER CC10 to pan, etc.....and we have a consistent standard mapping.

2.- A second approach could be use non-standard CC combined with standard Channeling, so in this case we could use CH1 for fader 1 and CC 107 for fader adn CC110 for PAN, CH2 for fader 2, etc. With this approach we risk moving a jamconcept control while trying to map a instrument control

3.- A third option could be combine the two above: unconventional CHanneling with unconventional CC mapping..

Ezeer commented 8 years ago

i understand ... a button to enable/disabled CC on track(s) could be a quick answer . You enable when you mix , you disable when you play ?

jonjamcam commented 8 years ago

mmmm....in my experience every fader can be needed at any time, so if someone has a 10000 channel controller he could map anything independently....

But this is just a "default" mapping. You were working on a learn function for special tweaks

Ezeer commented 8 years ago

perhaps i don't understand your problem here ? It's not a question of learn , because if you give your keyboard volume to control the volume of a track, when you play , if you use the volume , that will control the midi note volume + the track .

jonjamcam commented 8 years ago

" if you give your keyboard volume to control the volume of a track, when you play , if you use the volume , that will control the midi note volume + the track ."

Yes and that's a problem. I explain:

one track can have 16 different instruments controlled and assigned independently, so if you are in:

TRACK1---> instrument 3 (CH3) vol fader (CC7)......you may think you are controlling you instrument, but you may be controllig Jamconcept track 3 (fader) too which may be a guitar for example and not knowing it. This is why studios an PA systems have large consoles. When you adjust one instrument you want it to stay that way...

jonjamcam commented 8 years ago

So let's have a practical example:

you load Hypersonic on track 1 on Jamconcept and assign your keyboard to ALL channels:

hypersonic

You can control all 16 instruments with 1 keyboard. Just change the channel and use the CC.

The mapping of Hypersonic is standard(but can be changed)...so

CC7 controls volume CC10 controls PAN etc..

Now say you want to control Track 2 PAN of JAmconcept with your keyboard....what will be the most convenient?

I think CH2 CC10 is a bad choice, you see? because you'll be changing the pan of Ch2 of hypersonic, co I think we should use CH7, cc110 in this case. or CH2 CC110 maybe can work too

Ezeer commented 8 years ago

yes , i think we'll find a solution on the way , we must start with very simple logic and solve the problems steps by steps by experimentation . In the case of channels , we can skip that parameter for example to control a track , just use the map ( trackindex/controltype ), that would apply to active track only ( selected for cc control ) .

jonjamcam commented 8 years ago

So in practical terms:

CH1 (no subs) : FADER: CC107, PAN CC110 (midi Channel 6) CH1 (2nd sub) : FADER: CC107, PAN CC110 (midi Channel 7) CH1 (3rd sub) : FADER: CC107, PAN CC110 (midi Channel 8) CH1 (4th sub) : FADER: CC107, PAN CC110 (midi Channel 9)

CH2 (no subs) : FADER: CC107, PAN CC110 (midi Channel 13) CH2 (2nd sub) : FADER: CC107, PAN CC110 (midi Channel 14) CH2 (3rd sub) : FADER: CC107, PAN CC110 (midi Channel 15) CH2 (4th sub) : FADER: CC107, PAN CC110 (midi Channel 16)

to have something to start...

Ezeer commented 8 years ago

honestly , i don't know . Perhaps , everything is to be tried , that is new to me ...

jonjamcam commented 8 years ago

Standard mapping:

standard mapping

You see CC 107 and 110 are not used for standarization

jonjamcam commented 8 years ago

We can use this mapping to test and as we go...change it....but I'm 100% sure wi'll have no conflicts

jonjamcam commented 8 years ago

" everything is to be tried "

haha....of course....the beauty of creating stuff!!!

your idea of "a button to enable/disabled CC on track(s) could be a quick answer ." is good if you don't want to use a controller for Jamconcept. quick and simple....

jonjamcam commented 8 years ago

so to use the branch I type "git branch https://github.com/Ezeer/JomTobo/tree/midiCC"?

Ezeer commented 8 years ago

no . ( i have a working static dev man !! ^^ )

first you must go to master git checkout master git checkout -b midiCC ( this time use EXACTLY the same name as remote ... ^^ -b create a branch ..)

jonjamcam commented 8 years ago

ok.

git checkout master git checkout -b https://github.com/Ezeer/JomTobo/tree/midiCC

" i have a working static dev man !! ^^"

Congratulations!!

jonjamcam commented 8 years ago

wait...I0m doing something wrong

jonjamcam commented 8 years ago

git checkout master git checkout -b midiCC

or

git checkout master git checkout -b https://github.com/Ezeer/JomTobo/tree/midiCC

Ezeer commented 8 years ago

git checkout -b midiCC

and thank you for the excellent widi guide !

jonjamcam commented 8 years ago

Ok I'm in midiCC, but Qt is asking me this..?

maincpp

Ezeer commented 8 years ago

click yes , Qt has switched of project . normal yes to all in fact ...

jonjamcam commented 8 years ago

Ok One more question. I need to use some variables (int) for this part. Were do I declare them?

EDIT: maybe constants is what I really need to set the CH, and CC at the beggining

Ezeer commented 8 years ago

depends of the use . local or global . inside a class or outside a class ... what do you plan to do ?

jonjamcam commented 8 years ago

Let's say CH1:

constant CH = 6 (for midi channel number which will be used to control) constakt CC = 107 (for PAN)

this so we can change in the declaration later if we want another map

jonjamcam commented 8 years ago

Let me think about it better tomorrow.....I may be mixing apples with oranges here...can't see that clear now

jonjamcam commented 8 years ago

one more question, Ezee: the funk setGain(ccValue/127.0) what parameter does it use (max, min)?

Ezeer commented 8 years ago

well , storing data is an art .. you should first experiment some basic things in the site i've mentioned earlier for C . You need to learn what is a struct , what is a member of a class , a variable in a function , etc ...

i need to work on the static setup now , and can't provide to you a quick solution .

one more question, Ezee: the funk setGain(ccValue/127.0) what parameter does it use (max, min)? no , it's just a normalization of the ccValue with the slider range . ( from 0 to 1 )

Ezeer commented 8 years ago

use the doc , i give you the link to the class that uses setGain , look to the other funks to play with ! http://makeitezeeah.esy.es/jomtobo/doc/class_audio_1_1_audio_node.html

try setPan(..)for exemple ... ^^

jonjamcam commented 8 years ago

ok. good..thx...mo hurries... gonna get some more sleep. I need to get this headache out of my brain now.....cya later, man

Ezeer commented 8 years ago

ah ah ah ... yeah , you'll see clear after a good rest for your brain . you try to learn so much in so little time .... dream free ! ^^

jonjamcam commented 8 years ago

you know I worked this kind of stuff in basic. I still remember......very familiar....but it's true....I need to know more....well it will be fun. Night man

Ezeer commented 8 years ago

night ! :)

Ezeer commented 8 years ago

i just created an object ( class ) that will be used to manage and control the MidiCC as an interface for the MainController class that actually filters midi and audio : http://makeitezeeah.esy.es/jomtobo/doc/class_controller_1_1_main_controller.html

That way , we concentrate our efforts on a new object that must be connected to Midi and to LocalTracks ( and more if needed , like metronome etc ... )

It's just a starter class , you should take the time to study what is a c++ class , with constructor and destructor , and the members that are public, protected or private . Learn how to access members in a class using " -> " for a pointer of the class , or " . " for the class itself . Read that page : http://www.cplusplus.com/doc/tutorial/classes/ that will introduce you slowly in c++ , then compare with the class ( very simple actually ) i just created to do the CC control :

In that files we will put the variables you asked for ( and funks to use them ! ) , but under a format that you don't know actually, the vectors , map , etc :

read that , and you will find inspiration ! ^^

Ezeer commented 8 years ago

You can follow the implemention of the MidiControl class inside of MainController in that commit : https://github.com/Ezeer/JomTobo/commit/36bf440a8fc320020883c25d480d5a4614888a3f

Think that MainController is a motherboard and MidiControl a Pci card . MainController starts and stop the midiControl :

create :
https://github.com/Ezeer/JomTobo/blob/midiCC/Client/src/MainController.h#L256 https://github.com/Ezeer/JomTobo/blob/midiCC/Client/src/MainController.cpp#L298 https://github.com/Ezeer/JomTobo/blob/midiCC/Client/src/MainController.cpp#L1137

kill :
https://github.com/Ezeer/JomTobo/blob/midiCC/Client/src/MainController.h#L256 https://github.com/Ezeer/JomTobo/blob/midiCC/Client/src/MainController.cpp#L1144

jonjamcam commented 8 years ago

Hi Ezee....My head's better now.....before I forget.....I was studying the code and I understood what's happening......so I changed this part of the code and could move more than one fader with the knobs of my SPD simultaneously.:

lines 615-618

if(msg.isControl()){ char cc = msg.getData1(); char ccValue = msg.getData2(); int inputTrackIndex = 19 - cc;//just for test for while, we need get this index from the mapping pair

In this example my spd sends CC 17,18,19 and faders 2,1,0 moves respectively. All this works only for channel 1.

Each fader is assigned to a different CC nmber, but that's not what I need. The only thing I need to make it work as planned is the midi channel information, but it isn't there. I only get CC number and CC value, so how can we have CC channel info as variable too?

midi imp

Ezeer commented 8 years ago

Hi ! You really should read the doc , doc . lol -> http://makeitezeeah.esy.es/jomtobo/doc/class_midi_1_1_midi_message.html#a70b2e308e5b802e90dee5540e9afabf7

int Midi::MidiMessage::getChannel() is the funk you need . msg->getChannel() should return the channel . Hope that will help you . :)

jonjamcam commented 8 years ago

k. reading now......thx

Ezeer commented 8 years ago

Also , we use the RtMidi API here , there is a doc that will help too to start with datas : https://www.music.mcgill.ca/~gary/rtmidi/ ( look midi output chapter for your subject ) ^^