Jump to content

Ref to my New Project thread in Design Concepts


Tanstaafl

Recommended Posts

I have had a thread over in the Design Concepts area regarding the following:

I have an old Paia keyboard I wanted to interface to midibox. (switch contacts only). I wanted this to drive a dual midibox project I have already built (MoogModular MidiBox).  And I wanted to be able to use the keyboard for other midi instruments (softsynths, midi enabled DIY modular analog gear).

the above was accomplished yesterday!!!

Next, I want to hook an AOUT board to this setup and be able to control analog gear directly. (non midified modular analog gear).

My question/dilema is...  how do I include the code for MidiBoxCV into my Midibox64 system?  Do i recompile MIOS with MidiBoxCV included?... OR...

since I am only using 2 cores now... do I add MidiBoxCV to a third core and use MidiLink? (presumably this would be the easiest, but I would like to utilize the spare functions from my exsisting cores)

Comments? Clarifications?

Thanx in advance and have a Happy New Year !!!

gb

Link to comment
Share on other sites

Hi,

when you take a look into the app_defines.inc files, you will notice that both applications (MIDIbox64 and MIDIbox CV) allocate so much memory that they cannot be combined to a single application. So, it won't be so easy to merge the projects without some programming knowledge.

On the other hand: if you don't need all the features of MIDIbox64, but only the possibility to send static (predefined and not changeable) MIDI events with 64 pots and up to 128 buttons, you could add this to the MIDIbox CV application without much effort. It would only require a small number of code lines (initialize the MIOS drivers and send the events from the AIN/DIN hooks)

Best Regards, Thorsten.

Link to comment
Share on other sites

Thanx for the reply TK!

Not sure i want to reinvent the wheel with this project.... so i think i will go for the 3 core option....   :)

BTW.... great job with the AOUT board! it tracks my PAIA Midi2CV8 perfectly....

now on another note. How about some code that makes MidiCV volt/hz?  I have a bunch of exponential gear I would like to control along with linear stuff.  

I have looked through the code.. but am not an ASM person, trying to locate the conversion values.  should / can this be done programatically? or can the exponential response be obtained by changing Rx/Ry/Rp values?

thanx in advance and have a GREAT DAY!!!

gb

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Howdy!!

  Back again with more about this project.

  After looking at using an expo/lin converter (and the associated costs !!), I have decided to do this with hardware on hand.

  I have a functional D/A converter based on the PAIA V/Hz design in their midiCV8 and Fatman.  It uses 4 bits for top octave note voltages, and 2 bits (soon to be at least 3 bit for 5 octave range) for octave range.  I have built a circuit based on pic 16f877 that takes a midi in and turns note data from the keyboard into these 6 bits of data to drive the d/a converter.  this all works... albeit  too slowly for my liking.

  Could I not simply use a MIOS/dout combination to do the same thing?  seems logical to me... but i have not found where i would edit  a file to be able to perform the translation from midi/mios/dout module.  i am presuming this is possible?

as always, any help or suggestions are greatly appreciated. :)

gb

Link to comment
Share on other sites

It's a piece of cake with cmios :-)


/////////////////////////////////////////////////////////////////////////////
//  This function is called by MIOS when a complete MIDI event has been received
/////////////////////////////////////////////////////////////////////////////
void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2)
{
  // convert note off messages to note on with velocity 0
  if( (evnt0 & 0xf0) == 0x80 )
      evnt0 = 0x90 | (evnt0 & 0x0f);

  // react on notes at channel 1
  if( evnt0 == 0x90 )
  {
      // forward the 7-bit value to the first DOUT shift register
      MIOS_DOUT_SRSet(0, evnt1);
  }
}
[/code]

Best Regards, Thorsten.

Link to comment
Share on other sites

thought i would get started on the programming of this and realized...

MIOS does not know what value I need to feed into the D/A converter.

my D/A does not provide a sequential map.  it's not 1:1 from note event value to D/A input value.

i need to use 4 bits for  top octave note pickoff and 2 bits for octave select pickoff.

do I need an .ini file to load into MIOS once it's running to tell it how to map midi note event values to a 'byte' coming out of the dout circuit?  if so.. guess I need to see which commands would be for a dout used the way i am doing here.

any examples appreciated !!!

gb

Link to comment
Share on other sites

y'know... after looking at the website again... it looks like the J5_dout thing might be exactly what I'm looking for.

just need to set the midi input event triggers to J5 data out to my D/A  in the MIOS_TABLES.inc file..... now if i could just get some input on how that happens.  i see the input stuff, but not where it gets mapped to output stuff.

thanx in advance...

gb

Link to comment
Share on other sites

later that same day.... :)

ok, i have j5_dout application running... swapped J5_Dout_pinset  to j5_dout_set (to get parallel data, and this works...)

however.... my D/A converter does not correspond 1:1 with key numbers.  i need to be able to tell the program that

MT_ENTRY 0x90, 0x24  should output  0000 0000 (the data I need to drive my D/A for C0 on analog gear)

and that

MT_ENTRY 0x90, 0x30 (one octave up) should output 0000 0001 (the number i need to drive the D/A for C1)

i need the upper 4 bits  to control the note of the top octave, thus I only need the number 12 to get all 12 tones....

0000 0000 - C0

0001 0000 - C#0

0010 0000 - D0

0011 0000 - D#0

....

1011 0000 - B0

then back to

0000 0001 for C1

the lower 4 bits control the octave

0000 0000  C0 

0000 0001  C1

0000 0010  C2

0000 0011  C3

hope i am explaining how this works clearly....and that there is a way to get MIOS to do this for me....

gb

Link to comment
Share on other sites

Simple and fastest solution without much programming effort: Just map the note values to new values by using a table with 128 entries:


TABLE_ADDR MY_TABLE
movf MIOS_PARAMETER1, W ; (contains the note value)
TABLE_ADD_W ; add to table pointer
tblrd*+ ; read byte from table
movf TABLAT, W ; result in TABLAT

;; now you can do what you want with the new value



;; should be located at the end of the assembler program
MY_TABLE
db 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
;; ... 128 bytes (=16 lines) in total
db 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f
[/code]

Best Regards, Thorsten.

Link to comment
Share on other sites

  • 4 weeks later...

ok, I am back to midiboxing after a month of realworld work....

i am attempting to integrate the code below....which TK gave me last month:

Code:

TABLE_ADDR MY_TABLE

movf MIOS_PARAMETER1, W ; (contains the note value)

TABLE_ADD_W ; add to table pointer

tblrd*+ ; read byte from table

movf TABLAT, W ; result in TABLAT

;; now you can do what you want with the new value

;; should be located at the end of the assembler program

MY_TABLE

db 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07

;; ... 128 bytes (=16 lines) in total

db 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f

my problem is... i have no idea where to stick this code and table....

i was thinking since i'm using j5_dout... that the  code bit would go in j5_dout.inc  and get executed when there is

the call to J5_DOUT_Set..... but not being sure where it would go in order to intercept the value in W...(midi note event, i think)

and then look at the table to translate to the correct output on j5 to drive my expo-D/A converter.

if anybody can answer the following, i would greatly appreciate it:

1. where does the code go? (which file, and where in the file)

2. where does the table data go? (which file, and where in the file)

3. Don't I need to change something in J5_dout.inc to tell it to call this lookup table conversion?

i have placed the code in various files and locations within the files.  likewise with the data lookup table.. which

i have modified for my particular data needs, and then rebuilt all.  the new main.syx file does not crash mios.  just depending

on where i put the code/data the output is not correct.. sometimes it continues to work in the normal J5_DOUT config..

sometimes the leds don't light.

any ideas?

thanks in advance !

gb

Link to comment
Share on other sites

Hi gb,

1) in main.asm

2) in main.asm (outside a subroutine)

3) forwarding the value in WREG to J5_DOUT_Set is ok

Did you call "J5_DOUT_Init" in the USER_Init hook? This is important to initialize the digital outputs

Best Regards, Thorsten.

Link to comment
Share on other sites

OK, i've tried various locations in main.asm for the J5_DOUT project  none seem to function.  Since I don't quite have a handle on assembler yet... that's understandable.

below is the location I put the code for the table lookup...

USER_MPROC_NotifyFoundEvent

;; forward to J5_DOUT_PinSet function

;; it expects: number of pin (0-7) in WREG

;; value in MIOS_PARAMETER1

;; store pin number

movwf TMP1

;; set the pin value depending on velocity:

;;    - 0x00: set pin to 0V

;;    - other values: set pin to 5V

movf MIOS_PARAMETER3, W

skpz

movlw 0x01

movwf TMP2

;; if the event was a note off event, zero value independent from velocity

movf MIOS_PARAMETER1, W

andlw 0xf0

xorlw 0x80

skpnz

clrf TMP2

;; finally copy TMP2 to MIOS_PARAMETER1, get pin number and call the J5_DOUT_PinSet function

movff TMP2, MIOS_PARAMETER1

movf TMP1, W

;;

TABLE_ADDR EXPO_TABLE

movf MIOS_PARAMETER1, W ; (contains the note value)

TABLE_ADD_W ; add to table pointer

tblrd*+ ; read byte from table

movf TABLAT, W ; result in TABLAT

;;

call J5_DOUT_Set    <<< note I am using the byte output function of J5

;; set status

movf TMP1, W ; get AND mask depending on pin number

call MIOS_HLP_GetBitANDMask

andwf J5_STATUS, F ; AND it with J5_STATUS (means: clear bit entry)

movf TMP1, W ; get OR mask depending on pin number

call MIOS_HLP_GetBitORMask

btfsc MIOS_PARAMETER1, 0 ; set this bit if MIOS_PARAMETER1[0] not cleared

iorwf J5_STATUS, F

;; request a display update

bsf DISPLAY_UPDATE_REQ, 0

;; and exit

return

and here is where I put the table data:

at the end of main.asm.

;; --------------------------------------------------------------------------

;;  This function is called by MIOS when a pot has been moved

;;  Input:

;;    o Pot number in WREG and MIOS_PARAMETER1

;;    o LSB value in MIOS_PARAMETER2

;;    o MSB value in MIOS_PARAMETER3

;; --------------------------------------------------------------------------

USER_AIN_NotifyChange

return

;; should be located at the end of the assembler program

EXPO_TABLE

db 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07

db 0x08, 0x09, 0x0a, 0x0b

db 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17

db 0x18, 0x19, 0x1a, 0x1b

db 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27

db 0x28, 0x29, 0x2a, 0x2b

db 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37

db 0x38, 0x39, 0x3a, 0x3b

;;

db 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07

db 0x08, 0x09, 0x0a, 0x0b

db 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17

db 0x18, 0x19, 0x1a, 0x1b

db 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27

db 0x28, 0x29, 0x2a, 0x2b

db 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37

db 0x38, 0x39, 0x3a, 0x3b

;; ... 128 bytes (=16 lines) in total

db 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07

db 0x08, 0x09, 0x0a, 0x0b

db 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17

db 0x18, 0x19, 0x1a, 0x1b

db 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27

db 0x28, 0x29, 0x2a, 0x2b

db 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37

db 0x38, 0x39, 0x3a, 0x3b

END

I am still a bit unclear as to where the call to lookup the table and change the dout data to the table data should be.

with this setup.... I only get  pin 1 on J5 to light... the lcd shows normal activity.(activity that happens with the regular J5_DOUT code.)  I have placed the code in a couple of other places... and the J5 output is normal for J5_DOUT... J5 outputs 0 to 49 binary (for my 49 key midi keyboard).  Which I believe is normal for J5_DOUT app.  So i am not reading the table and inserting the values where they need to be.

Link to comment
Share on other sites

From a different approach...

  The AOUT module.... is there a way to make it perform D/A conversion in Exponential mode?

  by changing R_x,  R_y,  R_p....?  or  in code?

Since I only have 4 Expo VCO's... I am wondering if I am spending too much time on this.. and should just build Linear VCO's from now on... I have about 10 of these (v/oct) and they work great with the exsisting AOUT/MidiBoxCV application.  ... just trying to use up my old gear and make it functional with MBHP.

thanks for any and all help (especially to TK.. I know it's not your job to teach me assembler  :)  )

gb

Link to comment
Share on other sites

You've probably has got it mixed-up:

V/Oct. stuff is called exponential - V/Hz linear.. blaa blaa: here's the link: http://www.synthmuseum.com/magazine/linexpo.html

-----

So, you have linear, V/Hz oscillators? If I understand what you're trying to do here: note lookup table + octave switching using J5 you're on correct track ;) (I first thought of doing the whole thing just by using lookup table for all notes.)

So, don't give up! (Your efforts are needed - I'm too lazy and lacking any V/Hz synths..)

Bye, Moebius

Link to comment
Share on other sites

Now I really feel stupid! :(

I have been going about this entire thing the wrong way. ???

All I needed to do on the midibox end was combine MidiBoxCV with J5_Dout  this gives me both AOUT and data on J5 to mess with.

then I burned a prom that reads the J5 data and converts it into the data my D2A converter needs.... WOOHOO!!! ;D

now I can control both V/Hz and V/Oct gear from the same keyboard!!! ;D

code modification and circuit design upon request. 8)

Thank You Midi Gods of midibox.org for all the input!!!!!!!

gb

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...