I am completing a fairly complex new tool.But I’m experiencing a rather strange problem with OSC Server.
At first, the tool can play a note or a group of notes through the OSC Server, and at the same time write the notes in the pattern editor (note, instrument, volume and delay, include note-OFFs if use a instrument). But after a while, the notes continue to ring but the tool is no longer able to write the notes.
For some reason, he loses the ability to write notes.This is the code I use to OSC Server:
-----------------------------------------------------------------------------------
---VPD OSC SERVER FOR PIANO SOUND & WRITE
-----------------------------------------------------------------------------------
class "VPD_OscClient"
function VPD_OscClient:__init( osc_host, osc_port, protocol )
self._connection = nil
local client, socket_error = renoise.Socket.create_client( osc_host, osc_port, protocol )
if ( socket_error ) then
renoise.app():show_warning( "Warning: Failed to start the internal OSC client" )
self._connection = nil
else
self._connection = client
end
end
-- Trigger instrument-note
--- note_on (bool), true when note-on and false when note-off
--- instr (int), the Renoise instrument index 1-254
--- track (int), the Renoise track index
--- note (int), the desired pitch, 0-119
--- velocity (int), the desired velocity, 0-127
function VPD_OscClient:trigger_instrument( note_on, instr, track, note, velocity )
if not self._connection then
return false
end
local osc_vars = { }
osc_vars[1] = { tag = "i", value = instr }
osc_vars[2] = { tag = "i", value = track }
osc_vars[3] = { tag = "i", value = note }
local header = nil
if ( note_on ) then
header = "/renoise/trigger/note_on"
osc_vars[4] = { tag = "i", value = velocity }
else
header = "/renoise/trigger/note_off"
end
self._connection:send( renoise.Osc.Message( header,osc_vars ) )
return true
end
vpd_osc_client = VPD_OscClient( "127.0.0.1", 8000, 2 ) --the user needs to activate it! Port: 8000, Protocool: UDP (2), IP (localhost): 127.0.0.1
--valuebox to return note
VPD_VBX_RETURN_NOTE = vb:valuebox{ id = "VPD_VBX_RETURN_NOTE", min = 0, max = 119 } --hidden
--button pressed for VPD OSC Server
function vpd_osc_bt_pres( song, snci, ncl )
song = renoise.song()
snci = song.selected_note_column_index
ncl = song.selected_line.note_columns
--note bar link (before)
vb.views["NOT_SLIDER"].value = vb.views["VPD_VBX_RETURN_NOTE"].value
--clear entire row (before)
if ( vb.views["VPD_REC"].text == "REC" ) then
ncl[snci]:clear()
end
--on note sound & insert note/pan/volume/ (after)
vpd_osc_client:trigger_instrument( true, song.selected_instrument_index, song.selected_track_index, vb.views["VPD_VBX_RETURN_NOTE"].value, vb.views["VOL_SLIDER"].value )
end
--button released for VPD OSC Server
function vpd_osc_bt_rel( song )
song = renoise.song()
--off note sound & insert note-off (before)
vpd_osc_client:trigger_instrument( false, song.selected_instrument_index, song.selected_track_index, vb.views["VPD_VBX_RETURN_NOTE"].value, vb.views["VOL_SLIDER"].value )
--jump note (after)
if ( vb.views["VPD_REC"].text == "REC" ) then
vpd_search_step_2()--vpd_step()
end
end
Have you experienced something similar?I may have something wrong with OSC Server code. Or maybe something is missing?
I find it very strange that at first it works fine and then stops responding when you must write the notes in the pattern editor with edit mode enabled, but the notes still sound through OSC Server.What can be the cause?
In the OSC monitor (in preferences of Renoise) print well always “note_on”, “note_off”…If I reinstall Renoise, the tool will start working correctly, but if I reinstall the tool does not solve it.
It may have to do with the localhost?