Old 01-16-2017, 06:27 AM   #1
sonicowl
Human being with feelings
 
sonicowl's Avatar
 
Join Date: Oct 2015
Posts: 72
Default OSCII-bot to BCF2000

OK, been trying for few hours to get faders moving on Behringer BCF2000. No luck yet.
Is there a simple way to setup this?
Where do I even start? Anybody maybe has step by step description of how to make it work?
Thnx.
sonicowl is online now   Reply With Quote
Old 01-16-2017, 06:45 AM   #2
sonicowl
Human being with feelings
 
sonicowl's Avatar
 
Join Date: Oct 2015
Posts: 72
Default

So, here is what I did, on Win10:
1. Downloaded MIDI2OSC-II.txt.zip from http://www.cockos.com/oscii-bot/, and unpacked it to folder.
2. Created folder OSCII-bot in ../AppData/Roaming.
3. Copied example script alphatrack.txt to above folder, renamed it to "BCF2000".
4. After running OSCII-bot i got errors:
Listening on '*:9000'
Warning: tried to open device matching 'AlphaTrack'(0) but failed, will retry
Warning: tried to open device matching 'AlphaTrack'(0) but failed, will retry
2 inputs, 2 outputs
5. Went into "Control Panel\Hardware and Sound\Devices and Printers", anc check for device name in BCF2000 hardware properties, and name of controller is B-CONTROL.
6. Input that device name into script - no more device error. Says:
Listening on '*:9000'
2 inputs, 2 outputs

Total: 1 scripts, 2 inputs, 2 outputs
sonicowl is online now   Reply With Quote
Old 01-16-2017, 06:53 AM   #3
sonicowl
Human being with feelings
 
sonicowl's Avatar
 
Join Date: Oct 2015
Posts: 72
Default

Next,
7. In Reaper, Settings/Control Surface Settings, I created OSC control surface, with name "OSCII-bot", as in attached image.
Attached Images
File Type: png osc setup.PNG (10.8 KB, 226 views)

Last edited by sonicowl; 02-11-2017 at 05:08 AM.
sonicowl is online now   Reply With Quote
Old 01-16-2017, 07:00 AM   #4
sonicowl
Human being with feelings
 
sonicowl's Avatar
 
Join Date: Oct 2015
Posts: 72
Default

Script is like this. I cannot get fader to move. What am I doing wrong?


Code:
// generic REAPER<-->alphatrack OSC, for REAPER's Default.ReaperOSC
// Only a basic volume fader works now, needs a lot more work

@input osc_in OSC "*:9000"
@output osc_out OSC "localhost:8000"

@output midi_out MIDI "B-CONTROL"
@input midi_in MIDI "B-CONTROL"

@init

track_index = 1;

track_voltab = 1024;

@timer

@oscmsg

function set_vol_fader(vol) (
  vol *= 16383;
  msg1=0xe0;
  msg2=vol&127;
  msg3=vol/128;
  midisend(midi_out);
);

oscmatch("/track/%d/*") ? (
  // fmt0 will have the affected track index


  oscmatch("/track/%d/select") ? (
    oscparm(0,0)>0 ? (
      track_index=fmt0;
      set_vol_fader(track_voltab[fmt0]);
    );
  ) : oscmatch("/track/%d/volume") ? (
    track_voltab[fmt0] = oscparm(0,0);
    fmt0 == track_index ? set_vol_fader(track_voltab[fmt0]);
  );
);


@midimsg

msg1 == 0xe0 ? (
  vol = (msg2 + msg3*128) / 16383;
  track_voltab[track_index] = vol;
  fmt0 = track_index;
  oscsend(osc_out,"/track/%d/volume", vol);
  set_vol_fader(vol);
);

Last edited by sonicowl; 02-11-2017 at 05:06 AM.
sonicowl is online now   Reply With Quote
Old 01-16-2017, 07:04 AM   #5
sonicowl
Human being with feelings
 
sonicowl's Avatar
 
Join Date: Oct 2015
Posts: 72
Default

To test if Reaper receives MIDI CC from BCF2000, I go to Reaper Preferences/MIDI Devices and enable "Control" for "B-CONTROL Port 1" Then I go to Reaper Actions and check MIDI input from fader in Add Shortcuts, I get the following data from fader:
MIDI Chan 1 CC 32
After this I again disable "Control" for BCF2000.


Again to Reaper Actions, and check if I can get fader to work on "Track: Set volume for selected tracks (MIDI CC/OSC only)". I get no response from OSC.


I guess I need to change something in script to connect fader CC32 with something in OSC? No idea what. Any help would be most welcome. Thnx.

Last edited by sonicowl; 01-16-2017 at 07:22 AM.
sonicowl is online now   Reply With Quote
Old 01-16-2017, 05:27 PM   #6
goldenarpharazon
Human being with feelings
 
Join Date: Feb 2016
Posts: 38
Default Suggestions to isolate the problem

Here are some simple steps to try and help get things working, or to enable others to help.


- Use MIDI-OX on windows or a similar midi monitor to check the midi being sent to or from the BCF-2000


- Check the OSC strings being sent by reaper in the OSCII-bot console


- Use printf statements to output values in the code to the OSCII-bot console for debug purposes.


- In particular check that oscmatch() has worked as expected and fmt0 has the expected value in it. It might be better to assign values to a more localised variable than fmt0 using the {} feature of match()


- Align the indentation of the ( and ); and ): so one can visualise that the code sections really do contain & execute the desired statements where expected


- Get the simplest possible code to work (eg just sending some predefined midi to the BCF-2000 in @init that moves the fader OK i.e. no OSC at all)


- Add in code, step by step, increasing the functionality sending midi to OSCII-bot or parsing OSC output from Reaper. Check each increment works OK.


- Based on all this try and isolate the problem and post a succinct summary of the behaviour or error experienced.


- Select the best forum to ask in. More folk in the Reaper community see and contribute to the Reaper compatibility forum than the OSCII-bot forum.

Last edited by goldenarpharazon; 01-17-2017 at 04:15 AM.
goldenarpharazon is offline   Reply With Quote
Old 01-17-2017, 09:17 AM   #7
sonicowl
Human being with feelings
 
sonicowl's Avatar
 
Join Date: Oct 2015
Posts: 72
Default

Thnx for reply.


I'm not good at programming, but can copy paste code, and modify scripts a bit.


In my setup Midi is coming in properly to OSCII-bot from both sides.


If I move fader in Reaper, I can see activity in OSCII-bot console.
If I move fader in BCF2000, I can also see activity in OSCII-bot console.


If I test it with example script "show-io.txt", I also get activity in "show input and output" graphic display. So, both Reaper and BCF2000 are sending data to OSCII-bot.


Now I cannot figure out how to connect fader in Reaper with fader on BCF2000.


I tried like this: I go to Actions in Reaper, select action "Track: Set volume for selected tracks (MIDI CC/OSC only)", ADD shortcut, move fader on BCF2000 - and nothing happens.


Right now I'm trying to figure out printf, then oscmatch(), as you suggested.
sonicowl is online now   Reply With Quote
Old 01-17-2017, 10:33 AM   #8
goldenarpharazon
Human being with feelings
 
Join Date: Feb 2016
Posts: 38
Default

One further suggestion on this specific issue of "connecting the fader".....


Reading the .ReaperOSC file created for this new experimental control surface will help.

.ReaperOSC lists the allowable config pattern strings (one can also look at what OSC string is seen being sent in the OSCII-bot console too when @midimsg is called) so



oscsend(osc_out,"/track/%d/volume", vol);



should probably, for a selected track to work as intended on the Reaper volume, be as follows


oscsend(osc_out,"n/track/volume", vol);


The strings in oscsend() and oscmatch() associated with a parameter or action have a family resemblance to one another but are not the same.
goldenarpharazon is offline   Reply With Quote
Old 01-18-2017, 06:41 AM   #9
sonicowl
Human being with feelings
 
sonicowl's Avatar
 
Join Date: Oct 2015
Posts: 72
Default

OK, I got basic functionality with below code. It is 7 bit only (still need to figure 14bit part). But it works both ways. Fader 1 (ch1/CC0)on BCF moves volume on any selected track in Reaper. And if i move any track volume in Reaper, it moves Fader 1 in BCF. Switching tracks in Reaper also updates fader in on BCF.So it works exactly as I wanted. Only not 14 bits.

====
Code:
// REAPER<-->BCF2000 OSC, for REAPER's Default.ReaperOSC

@input osc_in OSC "*:9000"
@output osc_out OSC "localhost:8000"

@output midi_out MIDI "B-CONTROL"
@input midi_in MIDI "B-CONTROL"

@init

track_index = 1;

track_voltab = 1024;

@timer


@oscmsg

function set_vol_fader(vol) (
  vol *= 16383;
  msg1=176;
  msg2=0;
  msg3=vol/128;
  midisend(midi_out);
);

//  printf(sprintf(#,"%02x %02x %02x",msg1,msg2,msg3));
//  printf("\n");
//  printf(oscstr);
//  printf("\n");

oscmatch("/track/%d/*") ? (
  // fmt0 will have the affected track index


  oscmatch("/track/%d/select") ? (
    oscparm(0,0)>0 ? (
      track_index=fmt0;
      set_vol_fader(track_voltab[fmt0]);
    );
  ) : oscmatch("/track/%d/volume") ? (
    track_voltab[fmt0] = oscparm(0,0);
    fmt0 == track_index ? set_vol_fader(track_voltab[fmt0]);
  );
);


@midimsg

msg1 == 176 ? (
//  vol = (msg2 + msg3*128) / 16383;
  vol = msg3/127;
  track_voltab[track_index] = vol;
  fmt0 = track_index;
//  oscsend(osc_out,"/track/%d/volume", vol);
  oscsend(osc_out,"n/track/%d/volume", vol); //forum
  set_vol_fader(vol);
);

//  printf(sprintf(#,"%02x %02x %02x %f",msg1,msg2,msg3,vol));
//  printf("\n");

Last edited by sonicowl; 02-11-2017 at 05:07 AM.
sonicowl is online now   Reply With Quote
Old 01-18-2017, 11:33 AM   #10
sonicowl
Human being with feelings
 
sonicowl's Avatar
 
Join Date: Oct 2015
Posts: 72
Default

Now I got it working at 14 bit for one fader. (EDIT: Works now.) But it oly works for first 8 tracks. If I select track 9, BCF still stay connected to previously selected track (any track 1-8 that was selected before.

For tracks above 8 (9 and on) connection is broken.

I tried increasing "DEVICE_TRACK_COUNT 8" in Default.ReaperOSC to "DEVICE_TRACK_COUNT 999", but no change.)

Any idea why below script works only on first 8 tracks?

EDIT: I changed ""DEVICE_TRACK_COUNT" to 256, and now it works. With 999 there was a long delay before it updated all faders. Now with 256 it is fine.

=======

Code:
// REAPER<-->BCF2000 OSC, for REAPER's Default.ReaperOSC
// only Fader 1 (Ch 1, CC 0, 14bit) to selected channel in Reaper

@input osc_in OSC "*:9000"
@output osc_out OSC "localhost:8000"

@output midi_out MIDI "B-CONTROL"
@input midi_in MIDI "B-CONTROL"

@init

track_index = 1;

track_voltab = 1024;

@timer


@oscmsg

function set_vol_fader(vol) (
//  printf(oscstr);
//  printf("\n");
  
  vol *= 16383;
  msg1 = $xb0;
  msg2 = $x00;
  msg3 = vol >> 7; // Get MSB from 14 bit value
  midisend(midi_out);
//  printf(sprintf(#,"%02x %02x %02x",msg1,msg2,msg3));
//  printf("\n");
  msg2 = $x20;
  msg3 = vol & $x7F; // Get LSB from 14 bit value
  midisend(midi_out);
//  printf(sprintf(#,"%02x %02x %02x",msg1,msg2,msg3));
//  printf("\n");
  
);

//  printf(sprintf(#,"%02x %02x %02x",msg1,msg2,msg3));
//  printf("\n");

oscmatch("/track/%d/*") ? (
  // fmt0 will have the affected track index

  oscmatch("/track/%d/select") ? (
    oscparm(0,0)>0 ? (
      track_index=fmt0;
      set_vol_fader(track_voltab[fmt0]);
    );
  ) : oscmatch("/track/%d/volume") ? (
    track_voltab[fmt0] = oscparm(0,0);
    fmt0 == track_index ? set_vol_fader(track_voltab[fmt0]);
  );
);


@midimsg

msg1 == $xb0 && msg2 == $x00 ? (
 count += 1;
 count % 2 ? (
	 msb=msg3;
 ) : (
  vol = (msb*128 + msg3) / 16383;
  track_voltab[track_index] = vol;
  fmt0 = track_index;
  oscsend(osc_out,"n/track/%d/volume", vol); //forum
  set_vol_fader(vol);
  );
);

//  printf(sprintf(#,"%02x %02x %02x %f",msg1,msg2,msg3,vol));
//  printf("\n");

Last edited by sonicowl; 02-11-2017 at 05:05 AM.
sonicowl is online now   Reply With Quote
Old 03-15-2017, 01:41 PM   #11
parfumer
Human being with feelings
 
parfumer's Avatar
 
Join Date: Apr 2010
Location: Tallinn
Posts: 183
Default

Thank You so much!
Question: when I move the faders in BCF, they moves on Reaper too. But on the contrary, when I move from Riper, the faders in BCF does not move. When I change preset on BCF(1-2-1), faders return to the previous position, but not as in Reaper.
parfumer is offline   Reply With Quote
Old 03-16-2017, 03:05 AM   #12
sonicowl
Human being with feelings
 
sonicowl's Avatar
 
Join Date: Oct 2015
Posts: 72
Default

Quote:
Originally Posted by parfumer View Post
Thank You so much!
Question: when I move the faders in BCF, they moves on Reaper too. But on the contrary, when I move from Riper, the faders in BCF does not move. When I change preset on BCF(1-2-1), faders return to the previous position, but not as in Reaper.
It worked both ways in my case. I doubt this code is usable directly as it is. Probably you would need to tweak things to match your settings, in regard to fader CC's and resolution.

I don't use this setup in practice, I tried, but it is too complicated for me. Recently I tried Klinke MCU driver, and it works great for BCF2000. If you are not very good in coding scripts, I suggest you check out Klinke MCU (search forum). It offers controller feedback and really deep control of all parameters (even full control of FX inserts, every FX parameter is automatically mapped to faders on BCF2000, and you can create your own mappings for any FX). I'm still learning Klinke, but it seems to offer all I need and more.
sonicowl is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:02 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.