jerash Posted January 19, 2007 Report Share Posted January 19, 2007 Hi,I'm starting a new project with midibox. The goal is to filter incoming midi messages. some mesages i want to convert, some other to block.I have a Boss midi pedal controller sending only "program change" messages.I want to play a sample when pressing a pedal, but my sampler need "note on/off" messages.So the midibox is placed between pedalboard and sampler and needs to convert/filter the messages following a precise table.The Core V3 pcb is now built, PIC18f452 burnt with bootloader v1.2, then succesfully updated with MIOS v1.9.I also uploaded the "change_id_v1_9c.zip" troubleshooting app to confirm MIOS is up and running, and application upload also.In midiox, i receive a correct CC message "0427" saying All is good !Now i'm writing code in MPLAB, compilation goes well, but my code is ineficient due to my lack of knowledge in programming. I'd prefer to use assembler because my pc is ready to go with it. I haven't installed the necessary softwares to program in C.So i'm asking for your help here with those questions :1. Where do i need to put my code for filtering ?(in main.asm in "Notify_Received event" section ?)2. do i need to do "addlw 0x07" before reading or writing any byte ?3. is it necessary to use "MIOS_begin_stream" ?4. How to send a complete midi event ?5. Here is the table of conversion i want to applyIN : incoming messages to midibox (from pedalboard) in hexaOUT : message to be transmited (or not) when corresponding message is received IN hex OUT hex ACTION ----------------------------------- PC00 NoteOn24 CONVERT PC01 NoteOn25 CONVERT PC02 NoteOn26 CONVERT PC03 NoteOn27 CONVERT PC04 X ALL NOTE OFF PC05 NoteOn29 CONVERT PC06 NoteOn2A CONVERT PC07 NoteOn2B CONVERT PC08 NoteOn2C CONVERT PC09 X ALL NOTE OFF PC0A X BLOCK PC0B X BLOCK PC0C X BLOCK PC0D XX BLOCK PC0E X BLOCK PC0F X BLOCK PC10 PC11 PASS PC11 PC12 PASS PC12 PC13 PASS PC13 X BLOCK PC14 PC15 PASS PC15 PC16 PASS PC16 PC17 PASS PC17 PC18 PASS PC18 X BLOCK PC19 PC1A PASS PC1A X BLOCK PC1B X BLOCK PC1C X BLOCK ... X BLOCK ... X BLOCK ... ... ... I'm looking forward to your help, so it could help me make a first step into MIOS programming for next applications.thank you, RAPHAEL. Quote Link to comment Share on other sites More sharing options...
QBAS Posted January 19, 2007 Report Share Posted January 19, 2007 hi I probubly I have a bad style of writing app in assembler , but sometimes it work. If you want - you can check this.USER_MPROC_NotifyReceivedEvent movf MIOS_PARAMETER1, W xorlw 0xc0 ; catch program change on channel 1 bz PRG_CH1 return PRG_CH1 ; procedure for assign job for every number movf MIOS_PARAMETER2, W JUMPTABLE_2BYTES 32 rgoto PC_0 rgoto PC_1 rgoto PC_2 ; ...... here you must fill it yourself rgoto PC_1e rgoto PC_1f return PC_0 ;here you can out procedure for PC_0 call MIOS_MIDI_BeginStream movlw 0x90 ;noteon channel 1 call MIOS_MIDI_TxBufferPut movlw 0x24 ;like you wanted 24 call MIOS_MIDI_TxBufferPut movlw 0x7f ; you not said about velocity - so I put maximum call MIOS_MIDI_TxBufferPut call MIOS_MIDI_EndStream return PC_1 ;here you can out procedure for PC_1 return PC_2 ;here you can out procedure for PC_2 return ;...........please write nexts PCn PC_1f return I hope it will help. Quote Link to comment Share on other sites More sharing options...
jerash Posted January 20, 2007 Author Report Share Posted January 20, 2007 Hi,I like your style of writing code ! it makes all things logical to me.Now the code is like a rolling stone, thanks to you i've been able to have the filter running ;DMessages are filtered the good way (note on transformation), or blocked correctly.But "passing" messages does twice ???1/the procedure "PC_PASS" takes all three byte from 1 to 3 and calls MIOS_MIDI_TxBufferPut each time. Any idea why the message comes twice in the midiox input monitor ?2/You create a table called by : "JUMPTABLE_2BYTES 32"can i make this table 128 x 2BYTES long instead of 32 ?this is because program changes greater than 1F are converted into notes like procedure PC_0. I don't see where is the default point of jump/goto...I would like (ALL PC > 1f) branch to PC_BLOKI can't enough say you how much i'm happy this thing is already running tonight. Merci !!!RaFmain.asm Quote Link to comment Share on other sites More sharing options...
QBAS Posted January 20, 2007 Report Share Posted January 20, 2007 hiI`m happy!2/You create a table called by : "JUMPTABLE_2BYTES 32"can i make this table 128 x 2BYTES long instead of 32 ?I don`t know. You can check this, but if you need no more than 32 , and want avoid jump over 32 you can read in macros.h file:JUMPTABLE_2BYTES MACRO max_value addlw -max_value ; ensure that jump index is not greater than (max_value-1) skpnc movlw -max_value addlw max_value call MIOS_HLP_GetIndex_2bytes ENDMthat protection is alerady done. Have you any troubles with value bigger than 32?I don't see where is the default point of jump/goto... sorry I don`t understand, what you mean?I would like (ALL PC > 1f) branch to PC_BLOKUSER_MPROC_NotifyReceivedEvent movf MIOS_PARAMETER1, W xorlw 0xc0 ; catch program change on channel 1 bz PRG_CH1 return PRG_CH1 ; procedure for assign job for every number movlw 0x20 CPFSLT MIOS_PARAMETER2 ;Compare f with W, skip if f < W rgoto PC_BLOCK movf MIOS_PARAMETER2, W JUMPTABLE_2BYTES 32 rgoto PC_0 rgoto PC_1 rgoto PC_2 ; ...... here you must fill it yourself rgoto PC_1e rgoto PC_1f return PC_0 ;here you can out procedure for PC_0 call MIOS_MIDI_BeginStream movlw 0x90 ;noteon channel 1 call MIOS_MIDI_TxBufferPut movlw 0x24 ;like you wanted 24 call MIOS_MIDI_TxBufferPut movlw 0x7f ; you not said about velocity - so I put maximum call MIOS_MIDI_TxBufferPut call MIOS_MIDI_EndStream return PC_1 ;here you can out procedure for PC_1 return PC_2 ;here you can out procedure for PC_2 return ;...........please write nexts PCn PC_1f return PC_BLOCK return 1/the procedure "PC_PASS" takes all three byte from 1 to 3 and calls MIOS_MIDI_TxBufferPut each time.Any idea why the message comes twice in the midiox input monitor ?do you monitor both inputs (from midibox and your pedal-unit)? Quote Link to comment Share on other sites More sharing options...
jerash Posted January 20, 2007 Author Report Share Posted January 20, 2007 Hi2/You create a table called by : "JUMPTABLE_2BYTES 32"can i make this table 128 x 2BYTES long instead of 32 ?I don`t know. You can check this, but if you need no more than 32 , and want avoid jump over 32 you can read in macros.h file:this trick is to be obsolete with the "CPFSLT MIOS_PARAMETER2" procedure. This looks like what i need, in 3 lines of code instead of ....too much !Tested successfuly !I don't see where is the default point of jump/goto... sorry I don`t understand, what you mean? nothing special, bad word using from me.1/the procedure "PC_PASS" takes all three byte from 1 to 3 and calls MIOS_MIDI_TxBufferPut each time.Any idea why the message comes twice in the midiox input monitor ?do you monitor both inputs (from midibox and your pedal-unit)?no, I monitor only the input of pc (output of midibox)I'm doing more tests next tuesday with the pedalboard and sampler, here at home i only have the pc running midiox and Mios Studio. Test messages are generated by midiox keyboard, sent to the filterbox (its little name ;) ), and back to midiox input. I took a special attention not to create a loop by unchecking the box saying "automaticallly attach inpuuts to outputs during selection" in midiox.Rafattached are 3 shots from the filterbox itself Quote Link to comment Share on other sites More sharing options...
QBAS Posted January 20, 2007 Report Share Posted January 20, 2007 maybe you can run two instances of Mios Studio (great software! I also use it)In one you send by midi output PC to filterbox , no using here midi input.And in second instance you can check by monitor midi input what midifilter do with messages. Quote Link to comment Share on other sites More sharing options...
jerash Posted January 20, 2007 Author Report Share Posted January 20, 2007 oh yes ! wonderfull we can launch 2 Mios studio at the same time ! :-Xmessages PASSED are stil received twice, same result with 2 mios studio and midiox. ... rgoto PC_BLOK ;pc0e rgoto PC_BLOK ;pc0f rgoto PC_PASS ;pc10 rgoto PC_PASS ;pc11 rgoto PC_PASS ;pc12 rgoto PC_BLOK ;pc13 rgoto PC_PASS ;pc14 rgoto PC_PASS ;pc15 rgoto PC_PASS ;pc16 rgoto PC_PASS ;pc17 rgoto PC_BLOK ;pc18 rgoto PC_PASS ;pc19 rgoto PC_BLOK rgoto PC_BLOK ... PC_PASS ;procedure for PC_xx : PASS call MIOS_MIDI_BeginStream movf MIOS_PARAMETER1, W ;passe le parametre 1 call MIOS_MIDI_TxBufferPut movf MIOS_PARAMETER2, W ;passe le parametre 2 call MIOS_MIDI_TxBufferPut movf MIOS_PARAMETER3, W ;passe le parametre 3 call MIOS_MIDI_TxBufferPut call MIOS_MIDI_EndStream return looks all good, isn't it ? (idiot idea:) i send with parameter 1 then two then 3, or maybe i should reverse the order ? Quote Link to comment Share on other sites More sharing options...
jerash Posted January 24, 2007 Author Report Share Posted January 24, 2007 hello, yesterday i successfully tested the "filter box" with the pedalboard and sampler, all is working good ! Even with the filterbox sending the PC twice, wich not a real problem in action. So id decided to go on step further, and add a 7 segment LED display to have a visual feedback of selected patch. So before i ask you questions, i will look around code examples and try to create it myslef.thanks for your contribution QBAS, and to TK for this great project !RAF Quote Link to comment Share on other sites More sharing options...
QBAS Posted January 24, 2007 Report Share Posted January 24, 2007 you welcomeif you would like you can attach ziped aplication and I can check this on my midibox. Quote Link to comment Share on other sites More sharing options...
QBAS Posted January 25, 2007 Report Share Posted January 25, 2007 about your code ... rgoto PC_BLOK ;pc0e rgoto PC_BLOK ;pc0f rgoto PC_PASS ;pc10 rgoto PC_PASS ;pc11 rgoto PC_PASS ;pc12 rgoto PC_BLOK ;pc13 rgoto PC_PASS ;pc14 rgoto PC_PASS ;pc15 rgoto PC_PASS ;pc16 rgoto PC_PASS ;pc17 rgoto PC_BLOK ;pc18 rgoto PC_PASS ;pc19 rgoto PC_BLOK rgoto PC_BLOK ... PC_PASS ;procedure for PC_xx : PASS call MIOS_MIDI_BeginStream movf MIOS_PARAMETER1, W ;passe le parametre 1 call MIOS_MIDI_TxBufferPut movf MIOS_PARAMETER2, W ;passe le parametre 2 call MIOS_MIDI_TxBufferPut movf MIOS_PARAMETER3, W ;passe le parametre 3 call MIOS_MIDI_TxBufferPut call MIOS_MIDI_EndStream returncan you chane this that please not send all 3 values in case of Program Change, becouse Program change consist from only two parameters, so probubly it is reason why you have a doubled message.For ezgample Program change #5 on channel 8 call MIOS_MIDI_BeginStream movlw 0xc7 call MIOS_MIDI_TxBufferPut movlw 0x05 call MIOS_MIDI_TxBufferPut call MIOS_MIDI_EndStream Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.