Author |
Message |
Grumble
Joined: Nov 23, 2015 Posts: 1294 Location: Netherlands
Audio files: 30
|
Posted: Wed Apr 10, 2019 9:52 pm Post subject:
|
|
|
If you want to measure the speed of calculations, shouldn’t you measure the difference between a loop with and without the calculation?
like:
Code: | while (1) {
PORTC.6 = 1;
PORTC.6 = 0;
}
|
and
Code: | while (1) {
PORTC.6 = 1;
val1 = val1 / val2;
PORTC.6 = 0;
}
|
_________________ my synth |
|
Back to top
|
|
|
PHOBoS
Joined: Jan 14, 2010 Posts: 5591 Location: Moon Base
Audio files: 705
|
|
Back to top
|
|
|
cloudberry
Joined: Jun 30, 2009 Posts: 51 Location: uk
|
Posted: Wed Sep 16, 2020 2:53 pm Post subject:
control change |
|
|
I've been looking over this, and I'm trying to work out what 'control change' means. Does this mean continuous controllers etc? And, (cos my coding is, er, poor, and I may have overlooked the bleedin' obvious: it happens) I'm struggling to see how one assigns a particular CC to be output. How would I get it to output breath (CC#2), for example? |
|
Back to top
|
|
|
JovianPyx
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Wed Sep 16, 2020 3:38 pm Post subject:
Re: control change |
|
|
cloudberry wrote: | I've been looking over this, and I'm trying to work out what 'control change' means. Does this mean continuous controllers etc? And, (cos my coding is, er, poor, and I may have overlooked the bleedin' obvious: it happens) I'm struggling to see how one assigns a particular CC to be output. How would I get it to output breath (CC#2), for example? |
Control Change is a type of MIDI message. They all begin with hex Bx where x is the channel. Some control change messages are also continuous controllers messages others are switched controller messages. More Info
The structure of the messages is Bx NN VV where x is the channel, NN is the controller number and VV is the value for that controller. You need to know the controller number, construct the message and send it. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
Last edited by JovianPyx on Wed Sep 16, 2020 4:12 pm; edited 1 time in total |
|
Back to top
|
|
|
cloudberry
Joined: Jun 30, 2009 Posts: 51 Location: uk
|
Posted: Thu Sep 17, 2020 2:02 am Post subject:
|
|
|
Thanks for the reply.
OK. Got it. But it's the code:
Code: | case midi::ControlChange:
d1 = MIDI.getData1();
d2 = MIDI.getData2(); // From 0 to 127
// CC range from 0 to 4095 mV Left shift d2 by 5 to scale from 0 to 4095,
// and choose gain = 2X
setVoltage(DAC2, 1, 1, d2<<5); // DAC2, channel 1, gain = 2X
break; |
I can't see where MIDI.getData are being set to a particular CC value. |
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Thu Sep 17, 2020 3:21 am Post subject:
|
|
|
cloudberry wrote: |
I can't see where MIDI.getData are being set to a particular CC value. |
Let me try to explain the flow of stuff.
MIDI is an object, objects are entities with values and methods.
getData1() and getData2() are methods of the MIDI object, and a method is a function call oprating on an object. These are the abstract naming conventions.
The notation is Object.Method() - the parenthesis indicate a funtiion (or a method) call, and the dot indicates that a member of an object is being used. getData1() is a member of the MIDI object.
So, getData1() calls into the MIDI object to get some value from there. That value in turn is extracted from a received MIDI message, and the MIDI message got there because an external device sent it.
The code internal to the MIDI object looked into the received message and extracted the data from it, which it then stored away to be retreived later with the getData1() and getData2() calls.
Once the message is completely received the MIDI object calls into your code to eventually end up in the code fragment you posted. This is a common way to implement a driver in code, the MIDI driver in this case.
When you want to receive CC2 (breath controller) messages, there will need to be a MIDI transmitter sending such messages and usually that would be a breath controller device, such as a MIDI sax, but there are standalone breath controllers too, and some synths have one built in.
Now when you do not have or do not want a breath controller, your MIDI device might still be able to send other usable CC messages you could use - maybe CC7 for volume, but that is something to be looked up in the MIDI implementation chart of that device - and this should be in it's manual (as such is part of the MIDI specifications: MIDI devices should have an implementation chart in their manuals).
May this clear it up a bit :-) _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
cloudberry
Joined: Jun 30, 2009 Posts: 51 Location: uk
|
Posted: Thu Sep 17, 2020 5:51 am Post subject:
|
|
|
Thank-you for the crash course!
Yes, this is for a wind controller (a WX11).
So this code grabs whatever CC passes through and spits it out to the DAC? That would work for a specific device I suppose. |
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Thu Sep 17, 2020 6:48 am Post subject:
|
|
|
Ah, yeah cool thing WX11, does CC2 alright, having one here too
The code indeed seems to pick up any CC as is, as I do not see a selection on the CC number .. so you might want an extra condition .. probably on d1 .. so something like :
Code: |
case midi::ControlChange:
d1 = MIDI.getData1();
if( d1 == 2) // To let trough CC2 messages only
{
d2 = MIDI.getData2(); // From 0 to 127
// CC range from 0 to 4095 mV Left shift d2 by 5 to scale from 0 to 4095,
// and choose gain = 2X
setVoltage(DAC2, 1, 1, d2<<5); // DAC2, channel 1, gain = 2X
}
break; |
_________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
cloudberry
Joined: Jun 30, 2009 Posts: 51 Location: uk
|
Posted: Thu Sep 17, 2020 6:52 am Post subject:
|
|
|
Thanks again for your help! |
|
Back to top
|
|
|
|