|
|
|
12-13-2020, 05:44 PM
|
#1
|
Human being with feelings
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
|
Delete a channel from a MIDI item
So I need for a script a part to delete all MIDI events from certain channels.
I have some doubts :O ,
1)why MIDI_GetEvt needs variables like ppqpos ? will it use it?
2)I tried use MIDI_GetEvt to know the event channel, but it seems the output is only binary? Any way to convert or this is not the right path?
3) If not MIDI_GetEvt should I use
--To know the channel
MIDI_GetCC
reaper.MIDI_GetNote
--if channel == want_to_delete_ch
reaper.MIDI_DeleteCC
reaper.MIDI_DeleteNote
besides CC and Notes anything more can be adress to channels?
|
|
|
12-14-2020, 06:49 AM
|
#2
|
Human being with feelings
Join Date: Aug 2015
Posts: 2,969
|
Is ppqpos a return value? It's ppqposOut in C, so I guess it is...
I dunno about the "endianness" of msg, but channel should be the second most significant nibble I think? Shouldn't be too hard to parse...
__________________
it's meant to sound like that...
|
|
|
12-14-2020, 11:18 AM
|
#3
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
|
Pitchbend for example.
|
|
|
12-16-2020, 03:57 AM
|
#4
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
DeleteCC and DeleteNote should take care of everything. Pitchbends fall under CC, in this case.
Sysex and text events don't have channel information, so you can skip them.
REAPER's internal notation and CC envelope information is encoded inside text events, with channel info, but DeleteCC and DeleteNote should automatically delete all related notation and envelope events too.
EDIT: If you are working in the MIDI editor, ReaScripts don't play nice with multiple editable items (except if you are using one MIDI editor per project, and editability is linked to item selection). To reach all events in all editable items, the Filter Events dialog can be used to select everything in a channel, which can then be deleted.
Last edited by juliansader; 12-16-2020 at 04:05 AM.
|
|
|
12-16-2020, 01:43 PM
|
#5
|
Human being with feelings
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
|
thaks for the help julian sanders! good to know delete note and CC should do it will get back to work in my script soon !
|
|
|
12-19-2020, 01:35 AM
|
#6
|
Human being with feelings
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
|
@jualiansanders, the text events don't have an channel inside reaper ? ( I don't know if inside the .mid they have, but when importing an .mid it can changes the track names according to the text events, wondering if they have an channel after importing.
For future readers I am using this to solo an MIDI Channel
Code:
function SoloChannel(item, ch)
local take = reaper.GetMediaItemTake( item, 0 )
local retval, notecnt, ccevtcnt, textsyxevtcnt = reaper.MIDI_CountEvts( take )
--NOTES
for i = notecnt, 1, -1 do
local retval, selected, muted, startppqpos, endppqpos, chan, pitch, vel = reaper.MIDI_GetNote(take, i-1)
if ch ~= 0 and chan ~= (ch-1) then
reaper.MIDI_DeleteNote(take, i-1)
end
end
--CC
for i = ccevtcnt, 1, -1 do
local retval, selected, muted, ppqpos, chanmsg, chan, msg2, msg3 = reaper.MIDI_GetCC( take, i-1 )
if ch ~= 0 and chan ~= (ch-1) then
reaper.MIDI_DeleteCC( take, i-1 )
end
end
end
Last edited by daniellumertz; 12-19-2020 at 01:40 AM.
|
|
|
12-25-2020, 01:55 PM
|
#8
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by daniellumertz
@jualiansanders, the text events don't have an channel inside reaper ? ( I don't know if inside the .mid they have, but when importing an .mid it can changes the track names according to the text events, wondering if they have an channel after importing.
|
The ones that you are referring to are probably "Track name" text events. REAPER will automatically name MIDI tracks according to these events, but they do not carry channel info, and apply to the whole track and all channel inside it.
|
|
|
12-26-2020, 01:27 AM
|
#9
|
Human being with feelings
Join Date: Feb 2016
Posts: 52
|
Quote:
Originally Posted by zaibuyidao
|
Hi zaibuyidao
I get this error :
zaibuyidao_Delete Channel Events.lua:7: unexpected symbol near '<'
Thank you !
|
|
|
12-26-2020, 02:52 AM
|
#10
|
Human being with feelings
Join Date: Jan 2020
Location: Amoy
Posts: 179
|
Quote:
Originally Posted by bjclulu
Hi zaibuyidao
I get this error :
zaibuyidao_Delete Channel Events.lua:7: unexpected symbol near '<'
Thank you !
|
The code may not be fully copied?
Please try this, see attachment.
In addition, the script requires SWS to be installed. If not installed, please download here:
https://www.sws-extension.org/
|
|
|
12-26-2020, 03:45 AM
|
#11
|
Human being with feelings
Join Date: Feb 2016
Posts: 52
|
Quote:
Originally Posted by zaibuyidao
The code may not be fully copied?
Please try this, see attachment.
In addition, the script requires SWS to be installed. If not installed, please download here:
https://www.sws-extension.org/
|
Hi zaibuyidao
感謝!! 現在OK沒問題了!
|
|
|
12-01-2021, 04:01 AM
|
#12
|
Human being with feelings
Join Date: Dec 2020
Posts: 226
|
Quote:
Originally Posted by juliansader
The ones that you are referring to are probably "Track name" text events. REAPER will automatically name MIDI tracks according to these events, but they do not carry channel info, and apply to the whole track and all channel inside it.
|
I have imported midi items and they all have text event cc lanes, although nothing is visible in these text event lanes. I use the action "show used cc lanes" and I'd like to remove these text event lanes from the midi item. Is it possible?
|
|
|
12-01-2021, 07:30 AM
|
#13
|
Human being with feelings
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
|
You want a script to automatically delete all text events of selected midi items?
|
|
|
12-01-2021, 07:39 AM
|
#14
|
Human being with feelings
Join Date: Dec 2020
Posts: 226
|
Not particularly. I just can't find a way of deleting the text events (none are visible in the lane to manually select and delete).
Whenever I use the action "show used cc lanes", the text event lane is displayed, even though there is nothing visibly there...
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 11:13 PM.
|