hi, i try to get midi ctl msg into pixilang/android from my faderfox lv3 midi controller.
i succeeded to the point that i get the last data byte printed on the screen, but i also want the status byte and the first data byte. like: Bn 00 00 for further processing.
what do i have to change in the midi_in_test.pixi example to achieve this?
greetings
midi_in_test.pixi example problem [solved]
midi_in_test.pixi example problem [solved]
Last edited by rototom on Mon Apr 18, 2022 5:04 pm, edited 1 time in total.
- NightRadio
- Site Admin
- Posts: 3955
- Joined: Fri Jan 23, 2004 12:28 am
- Location: Ekaterinburg. Russia
- Contact:
Re: midi_in_test.pixi example
Hm... This is exactly what i see in my log.status byte and the first data byte. like: Bn 00 00 for further processing.
Can you show your console output?
Re: midi_in_test.pixi example
the midi_in_test example refuses to run here on android.
so i stripped everything down to find out why.
think it's because of fputs?
anyway i replaced fputs with print(), to see what's going on.
this is the code
set_pixel_size( WINDOW_XSIZE / 480 )
resize( get_screen(), WINDOW_XSIZE, WINDOW_YSIZE )
start_timer(0)
MIDI_IN_DEVICE = "Faderfox Faderfox LV3 src0"
ts = ""
mc = midi_open_client( "Pixi MIDI Client" )
p = midi_open_port( mc, "My IN port", MIDI_IN_DEVICE, MIDI_PORT_READ )
midi_event = new(1,1,INT8 )
$break = 0
while( $break == 0 )
{
evt_size = midi_get_event( mc, p, midi_event )
i = 0
while( i < evt_size )
{
clear()
sprintf( ts, "%04x ", midi_event[ i ] & 255 )
print( ts,0,80 )
i + 1
}
midi_next_event( mc, p )
frame()
while( get_event() ) { if EVT[ EVT_TYPE ] == EVT_QUIT { $break = 1 } }
}
midi_close_port( mc, p )
midi_close_client( mc )
so i stripped everything down to find out why.
think it's because of fputs?
anyway i replaced fputs with print(), to see what's going on.
this is the code
set_pixel_size( WINDOW_XSIZE / 480 )
resize( get_screen(), WINDOW_XSIZE, WINDOW_YSIZE )
start_timer(0)
MIDI_IN_DEVICE = "Faderfox Faderfox LV3 src0"
ts = ""
mc = midi_open_client( "Pixi MIDI Client" )
p = midi_open_port( mc, "My IN port", MIDI_IN_DEVICE, MIDI_PORT_READ )
midi_event = new(1,1,INT8 )
$break = 0
while( $break == 0 )
{
evt_size = midi_get_event( mc, p, midi_event )
i = 0
while( i < evt_size )
{
clear()
sprintf( ts, "%04x ", midi_event[ i ] & 255 )
print( ts,0,80 )
i + 1
}
midi_next_event( mc, p )
frame()
while( get_event() ) { if EVT[ EVT_TYPE ] == EVT_QUIT { $break = 1 } }
}
midi_close_port( mc, p )
midi_close_client( mc )
Re: midi_in_test.pixi example
Ok, got it working now:)
For anyone interested, here's the code.
set_pixel_size( WINDOW_XSIZE / 480 )
resize( get_screen(), WINDOW_XSIZE, WINDOW_YSIZE )
start_timer(0)
MIDI_IN_DEVICE = "Faderfox Faderfox LV3 src0" //
ts = ""
mc = midi_open_client( "Pixi MIDI Client" )
p = midi_open_port( mc, "My IN port", MIDI_IN_DEVICE, MIDI_PORT_READ )
midi_event = new(1,1,INT8 )
$break = 0
while( $break == 0 )
{
evt_size = midi_get_event( mc, p, midi_event )
if evt_size > 0
{
print(ts,0,0)
i = 0 while( i < evt_size)
{
clear()
sprintf( ts, "%02x %02x %02x", midi_event[ 0 ] &255,midi_event[1] &255,midi_event[2]&255)
print( ts,0,80)
i + 1
}
midi_next_event( mc, p )
}
else
{
sleep(50)
}
frame()
while( get_event() ) { if EVT[ EVT_TYPE ] == EVT_QUIT { $break = 1 } }
}
midi_close_port( mc, p )
midi_close_client( mc )
For anyone interested, here's the code.
set_pixel_size( WINDOW_XSIZE / 480 )
resize( get_screen(), WINDOW_XSIZE, WINDOW_YSIZE )
start_timer(0)
MIDI_IN_DEVICE = "Faderfox Faderfox LV3 src0" //
ts = ""
mc = midi_open_client( "Pixi MIDI Client" )
p = midi_open_port( mc, "My IN port", MIDI_IN_DEVICE, MIDI_PORT_READ )
midi_event = new(1,1,INT8 )
$break = 0
while( $break == 0 )
{
evt_size = midi_get_event( mc, p, midi_event )
if evt_size > 0
{
print(ts,0,0)
i = 0 while( i < evt_size)
{
clear()
sprintf( ts, "%02x %02x %02x", midi_event[ 0 ] &255,midi_event[1] &255,midi_event[2]&255)
print( ts,0,80)
i + 1
}
midi_next_event( mc, p )
}
else
{
sleep(50)
}
frame()
while( get_event() ) { if EVT[ EVT_TYPE ] == EVT_QUIT { $break = 1 } }
}
midi_close_port( mc, p )
midi_close_client( mc )
Re: midi_in_test.pixi example
this seems to be the absolute neccessary, to get midi ctl messages from a hardware controller to pixilang android.
Because pixilang android seems not to have a console, the incoming midi bytes are printed to the screen. print()
i couldn't test for note input, because the faderfox lv3 doesn't output any notes
Because pixilang android seems not to have a console, the incoming midi bytes are printed to the screen. print()
i couldn't test for note input, because the faderfox lv3 doesn't output any notes
Code: Select all
set_pixel_size( WINDOW_XSIZE / 480 )
resize( get_screen(), WINDOW_XSIZE, WINDOW_YSIZE )
MIDI_IN_DEVICE = "Faderfox Faderfox LV3 src0"
ts = ""
mc = midi_open_client( "Pixi MIDI Client" )
p = midi_open_port( mc, "My IN port", MIDI_IN_DEVICE, MIDI_PORT_READ )
midi_event = new(1,1,INT8 )
brk = 0
while( brk == 0 )
{
midi_get_event( mc, p, midi_event )
clear()
sprintf( ts, "%02x %02x %02x", midi_event[0]&255, midi_event[1]&255, midi_event[2]&255)
print( ts,0,80)
midi_next_event( mc, p )
frame()
while( get_event() ) { if EVT[ EVT_TYPE ] == EVT_QUIT { brk = 1 } }
}
midi_close_port( mc, p )
midi_close_client( mc )
Re: midi_in_test.pixi example problem [solved]
Great job for figuring out midi input on android.
On the subject of "printing to the console" on android, by default standard out does *not* go to androids ADB logcat.
Instead you would need to use the same mechanism as C/C++ NDK code would as essentially pixilang is compiled as a NDK application on andriod.
Its been a long time since I've done any NDK work, but a quick search finds this from stackoverflow: https://stackoverflow.com/a/21904153/85472
But I'm not sure if it will be possible to call something like:
using Pixllangs FFI for C libs, in which case maybe @NightRadio in a future pixilang release could add the bit of C code linked in the SO answer and also explained here: https://codelab.wordpress.com/2014/11/0 ... roid-apps/
to get "builtin" print working on Android?
On the subject of "printing to the console" on android, by default standard out does *not* go to androids ADB logcat.
Instead you would need to use the same mechanism as C/C++ NDK code would as essentially pixilang is compiled as a NDK application on andriod.
Its been a long time since I've done any NDK work, but a quick search finds this from stackoverflow: https://stackoverflow.com/a/21904153/85472
But I'm not sure if it will be possible to call something like:
Code: Select all
__android_log_print(ANDROID_LOG_INFO, "foo", "Error: %s", foobar);
to get "builtin" print working on Android?
Re: midi_in_test.pixi example problem [solved]
thanks @maksGreat job for figuring out midi input on android.
- NightRadio
- Site Admin
- Posts: 3955
- Joined: Fri Jan 23, 2004 12:28 am
- Location: Ekaterinburg. Russia
- Contact:
Re: midi_in_test.pixi example problem [solved]
In Pixilang you can use logf() for output to the Android consoleOn the subject of "printing to the console" on android, by default standard out does *not* go to androids ADB logcat.
https://warmplace.ru/soft/pixilang/manual.php#logf