electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Developers' Corner
Midi to CV design -- Soliciting advice
Post new topic   Reply to topic Moderators: DrJustice
Page 3 of 3 [59 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: Previous 1, 2, 3
Author Message
Grumble



Joined: Nov 23, 2015
Posts: 1164
Location: Netherlands
Audio files: 29

PostPosted: Wed Apr 10, 2019 9:52 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
PHOBoS



Joined: Jan 14, 2010
Posts: 4922
Location: Moon Base
Audio files: 659

PostPosted: Fri Apr 12, 2019 7:12 am    Post subject: Reply with quote  Mark this post and the followings unread

just want to say it's nice to see people having a respectful discussion. Some of the info is a bit over my head
but I might look into more if I want to make a midi2CV device myself Very Happy

_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
cloudberry



Joined: Jun 30, 2009
Posts: 48
Location: uk

PostPosted: Wed Sep 16, 2020 2:53 pm    Post subject: control change Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
JovianPyx



Joined: Nov 20, 2007
Posts: 1985
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Wed Sep 16, 2020 3:38 pm    Post subject: Re: control change Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
cloudberry



Joined: Jun 30, 2009
Posts: 48
Location: uk

PostPosted: Thu Sep 17, 2020 2:02 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 23356
Location: The Netherlands, Enschede
Audio files: 258
G2 patch files: 320

PostPosted: Thu Sep 17, 2020 3:21 am    Post subject: Reply with quote  Mark this post and the followings unread

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.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
cloudberry



Joined: Jun 30, 2009
Posts: 48
Location: uk

PostPosted: Thu Sep 17, 2020 5:51 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 23356
Location: The Netherlands, Enschede
Audio files: 258
G2 patch files: 320

PostPosted: Thu Sep 17, 2020 6:48 am    Post subject: Reply with quote  Mark this post and the followings unread

Ah, yeah cool thing WX11, does CC2 alright, having one here too Very Happy

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.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
cloudberry



Joined: Jun 30, 2009
Posts: 48
Location: uk

PostPosted: Thu Sep 17, 2020 6:52 am    Post subject: Reply with quote  Mark this post and the followings unread

Thanks again for your help!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: DrJustice
Page 3 of 3 [59 Posts]
View unread posts
View new posts in the last week
Goto page: Previous 1, 2, 3
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Developers' Corner
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use