|
|
|
02-20-2015, 10:58 AM
|
#1
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Notes Reader v2.2.3 (2024-02-16)
Last edited by heda; 02-16-2024 at 02:27 PM.
|
|
|
02-20-2015, 12:23 PM
|
#2
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
That's pure genious... !!!
Do you think SRT importer/experter based on empty items would be better than region ?
|
|
|
02-20-2015, 12:57 PM
|
#3
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by X-Raym
That's pure genious... !!!
Do you think SRT importer/experter based on empty items would be better than region ?
|
thanks:
Yes... next is to do a subtitle exporter that is able to define the project start 0:00 and be able to export overlapped subtitles in different lines. We can use overlapped empty items in one track using free item positioning for the track, or lanes.
|
|
|
02-20-2015, 01:09 PM
|
#4
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Take a look at source code of SWS, there is all you need to know here.
The file for subtitles action is sws/SnM_Notes.cpp at master · Jeff0S/sws line 1112
Yeah, I know pretty well. I spend some times on it... :P
(don't forget your download link :P)
|
|
|
02-20-2015, 01:53 PM
|
#5
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
I know I will share the script soon.. but I'm dealing with some issues. I wanted to make a v4 compatible version and when I move the window it triggers the dialog box to specify the track id. I may change this. And in v5 version I can't understand why it doesn't save the docked state into the project.
And docked=gfx_dock(-1); always returns 0 even if the script is docked... I don't know why. I've looked at the lua example provided by devs, item_fft.lua and translated it into EEL, I want it to remember its docked position and state.
I don't have time to code until later. I wIll have another look at it later.
|
|
|
02-20-2015, 02:27 PM
|
#6
|
Human being with feelings
Join Date: Jul 2009
Posts: 1,071
|
Haha, that with multiple monitors, great !
|
|
|
02-20-2015, 03:12 PM
|
#7
|
Human being with feelings
Join Date: Jun 2009
Location: South, UK
Posts: 14,214
|
another great script!
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
|
|
|
02-20-2015, 05:59 PM
|
#8
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Thank you
I'm stuck for now with the v5 docking. I Asked spk77 for help. But I did a small trick to make v4 better. So I am going to clean the code a bit and upload it to stash.
Right now it only supports one line of text per item. Do you think it would be good to have multi line support? or at least two lines? Let me know.
|
|
|
02-20-2015, 07:18 PM
|
#9
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
just added the v0.1 download link in first post.
|
|
|
02-21-2015, 08:27 AM
|
#10
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by heda
Thank you
I'm stuck for now with the v5 docking. I Asked spk77 for help. But I did a small trick to make v4 better. So I am going to clean the code a bit and upload it to stash.
|
This seems to work -> the "dockstate" is stored/restored correctly. I just paste the whole script here:
(modified parts are in red color)
Code:
/**
* ReaScript Name: Notes Reader
* Description: (REAPER4 version) Reads item's notes and displays them as subtitles in a window
* Instructions:
Create a Track with items (empty items preferred), with notes text.
Run script. It will read notes from track 1 by default. To change which track contains the items, click on the script window.
A Dialog box appears asking for the ID of the track.
Play and see how the item notes appear on the window. Resize the window to fit your needs.
Customizable colors:
If you insert these lines(without the quotes) after your note text, you can customize colors
"fg=red,green,blue"
"bg=red,green,blue"
fg for text color, bg for background color. For the colors, use values between 0-255
* Author: HeDa
* Author URl: http://forum.cockos.com/member.php?u=47822
* Version: 0.1 beta
* Repository:
* Repository URl:
* File URl: https://stash.reaper.fm/23346/HeDa_%20Note%20Subtitles%20r4.eel
* License: GPL v3
* Forum Thread:
* Forum Thread URl: http://forum.cockos.com/showthread.php?t=155928
* REAPER: 4.76
* Extensions:
*/
/**
* Change log:
* v0.1 (2015-02-21)
+ Multiple readers. click on reader to specify track id to read from.
+ Customizable colors per item
+ Recording background color support. detects when it is recording.
*/
///////////// OPTIONS //////////
font_name = "Arial";
// Initial width of window
Initial_width = 1274;
// Initial height of window
Initial_height = 200;
// Font colors - use values between 0-255
font_color_r = 0;
font_color_g = 0;
font_color_b = 0;
// Background color - use values between 0-255
bg_r = 230;
bg_g = 230;
bg_b = 220;
// Text color when recording - use values between 0-255
font_rec_r = 255;
font_rec_g = 255;
font_rec_b = 255;
// Background color when recording - use values between 0-255
rec_r = 150;
rec_g = 0;
rec_b = 0;
// initial track id
readertrackid=1;
//////////////////////////////// End of Options
// Don't modify below here
//////////////////////////////////////////////////////////////////////////////////////////////
function GetTrackID_Dialog()
(
GetUserInputs("Enter Track ID", 1, "ID:", #retvals_csv);
#dialogstr = #retvals_csv;
match("%i", #retvals_csv, input) ? (
readertrackid = input;
);
);
function init(title, width, height) //, dockstate)
(
// get dockstate
HasExtState("NotesReader", "dock") ? ( // check if section/key is stored
GetExtState(#ds, "NotesReader", "dock"); // get stored "dockstate" string value
match("%d", #ds, dockstate); // convert str->int
) : dockstate = 0; // no stored dockstate -> set dockstate = 0
// open window
gfx_init(title, width, height, dockstate);
// set initial background and text color
gfx_a = 1;
gfx_r_orig = font_color_r/255;
gfx_g_orig = font_color_g/255;
gfx_b_orig = font_color_b/255;
bg_color = bg_r + 256*bg_g + 65536*bg_b;
bg_color_orig = bg_color;
);
function getfirstline(string) local(search)
(
i=0;
search=true;
#line="";
while(char=str_getchar(#str,0,'c')!=10) // \n = 10 | = 124
(
strcpy_substr(#str,string,i,1);
char!=10 ? (
strcat(#line,#str);
);
i+=1;
);
#line;
);
function run() local(mouse_state)
(
//reset bg_color
bg_color=bg_color_orig;
// reset text color
gfx_r=gfx_r_orig;
gfx_g=gfx_g_orig;
gfx_b=gfx_b_orig;
// Get play state
GetPlayState() == 0 || GetPlayState() == 2 ? (
// REAPER stopped or paused
#note=" ";
bg_color = bg_r + 256*bg_g + 65536*bg_b;
) : (
// REAPER Playing or recording
// get the track that has the lyrics
track=Gettrack(0,readertrackid-1); // get track
// get item under playing position in that track
i = 0;
#stra="";
NumberItems = CountMediaItems(0);
loop(NumberItems, (item = GetMediaItem(0,i)) ? (
(trackofitem = GetMediaItemTrack(item)) ? (
track==trackofitem ? (
regionColor = GetDisplayedMediaItemColor(item);
itemStart = GetMediaItemInfo_Value(item, "D_POSITION");
itemDuration = GetMediaItemInfo_Value(item, "D_LENGTH");
itemEnd = itemStart + itemDuration;
playposition = GetPlayPosition2(); // get current play position
(playposition > itemStart) ? (
(playposition < itemEnd) ? (
GetSetItemState(item, #str="");
match("*<NOTES??%{#notelines}s???IMGRESOURCEFLAGS*", #str) ? ( // extract note lines
// subtitle text only first line for now
match("*|*",#notelines) ? ( // if a multi line character is found
#note=getfirstline(#notelines); // set the note to the first line
):(
#note=#notelines; // set the note to all the note lines, match quicker than getfirstline
);
// colors
match("*fg=%d,%d,%d*",#notelines,f_r,f_g,f_b) ? ( // if fg color is found
gfx_a = 1; gfx_r = f_r/255; gfx_g = f_g/255; gfx_b = f_b/255;
);
match("*bg=%d,%d,%d*",#notelines,b_r,b_g,b_b) ? ( // if bg color is found
bg_color = b_r + 256*b_g + 65536*b_b;
);
);
):( // no item found at position
#note = " ";
bg_color = bg_r + 256*bg_g + 65536*bg_b;
);
);
);
);
);
i += 1;
);
GetPlayState() == 5 ? ( //recording ? change to recording colors
bg_color = rec_r + 256*rec_g + 65536*rec_b;
gfx_a = 1; gfx_r = font_rec_r/255; gfx_g = font_rec_g/255; gfx_b = font_rec_b/255;
);
);
// UI
// mouse click to open dialog to specify track id.
mouse_cap == 1 && mouse_y>20 && mouse_y<gfx_h-20 && mouse_x>20 && mouse_x<gfx_w-20 ? (
GetTrackID_Dialog();
);
gfx_clear = bg_color; // clears the background with bg_color
gfx_setfont(1, font_name, 100); // sets font number 1
gfx_measurestr(#note,w,h); // measure text
fontsizefit=(gfx_w/(w+50))*100; // new font size needed to fit.
fontsizefith=(gfx_h/(h+50))*100; // new font size needed to fit in vertical.
gfx_setfont(1, font_name, min(fontsizefit,fontsizefith)); // set to the smaller font
gfx_x = 15;
gfx_y = 15;
gfx_printf(#note); // print the note text
gfx_update();
gfx_getchar() >= 0 ? (
dockstate = gfx_dock(-1); // store dockstate while gfx window is open
defer("run();"); // run again until closed.
) : (
// gfx window is closed...
#dockstate = sprintf(#, "%d", dockstate); // "dockstate" int -> str
SetExtState("NotesReader", "dock", #dockstate, 1); // store "dockstate" string
);
);
// end of functions
// start
init("HeDa - Notes Reader", Initial_width, Initial_height); //, dockstate);
run();
So it needed these modifications: - dockstate has to be saved to a variable while the window is open (at the end of run -function)
- int -> str conversion before storing the "dockstate"
- str -> int conversion when the stored value is restored
Last edited by spk77; 02-21-2015 at 08:39 AM.
|
|
|
02-21-2015, 09:43 AM
|
#11
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
thanks skp77! Now it makes sense I'll use this for all scripts that have UI for REAPER5
it still doesn't remember in which dock is docked to.
maybe this can help.
I'm trying with EEL: Dock_UpdateDockID("ident_str", int whichDock)
but not having luck.
I think we need to store the dock id too. gfx_dock second byte?
as it is in documentation. EEL: gfx_dock(v)
Call with v=-1 to query docked state, otherwise v>=0 to set docked state. State is &1 if docked, second byte is docker index (or last docker index if undocked).
|
|
|
02-21-2015, 10:19 AM
|
#12
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Hmmm...It's working here:
"dockstate" contains the docker ID:
f.ex. 257 = docked at top of main window
(At least that's what it says on my computer )
|
|
|
02-21-2015, 10:31 AM
|
#13
|
Human being with feelings
Join Date: Jan 2012
Location: Germany
Posts: 1,130
|
Great script! Thanks for this one!
Until now you can only display the notes from the first track's items.
What if I have multiple tracks with empty items (e.g. for your items -> markers/regions script)?
|
|
|
02-21-2015, 10:34 AM
|
#14
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by spk77
Hmmm...It's working here:
"dockstate" contains the docker ID:
f.ex. 257 = docked at top of main window
(At least that's what it says on my computer )
|
ahhh I know what happens.
I was just terminating the instance by running the script again and pressing Yes. Not by closing it from the little x button in the docked tab. Because I didn't see that button since the dock was small to display it.
I moved the storing of dockstate to the exit() function instead of when gfx_getchar()<0 Now it works in both cases
|
|
|
02-21-2015, 10:37 AM
|
#15
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by timothys_monster
Great script! Thanks for this one!
Until now you can only display the notes from the first track's items.
What if I have multiple tracks with empty items (e.g. for your items -> markers/regions script)?
|
It's in the instructions
click anywhere in the notes reader window. It will ask you for the number id of the track.
You can have multiple readers at the same time, each one reading from different track, as in the second or third animation gif.
|
|
|
02-21-2015, 10:45 AM
|
#16
|
Human being with feelings
Join Date: Jan 2012
Location: Germany
Posts: 1,130
|
Quote:
Originally Posted by heda
It's in the instructions
click anywhere in the notes reader window. It will ask you for the number id of the track.
You can have multiple readers at the same time, each one reading from different track, as in the second or third animation gif.
|
Even better than I expected - thanks!
|
|
|
02-21-2015, 11:07 AM
|
#17
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
updated first post with v0.2 for REAPER 5 with docked window support thanks to spk77 for the help
|
|
|
02-23-2015, 05:47 AM
|
#18
|
Human being with feelings
Join Date: Jan 2012
Location: Germany
Posts: 1,130
|
Is it possible to remember the selected track?
If I close the script window it won't remeber what track I have selected.
|
|
|
02-23-2015, 07:07 AM
|
#19
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by timothys_monster
Is it possible to remember the selected track?
If I close the script window it won't remeber what track I have selected.
|
There is a setting inside the file to change the default id of the track.
but yoB are right that remembering it would be better. Good idea.
I can do that for REAPER 5 version that can store data from scripts in the project. Do you use only one instance of the reader? Or do you have multiple tracks to read at the same time? At least I can do to remember one.
|
|
|
02-23-2015, 07:27 AM
|
#20
|
Human being with feelings
Join Date: Jan 2012
Location: Germany
Posts: 1,130
|
Quote:
Originally Posted by heda
There is a setting inside the file to change the default id of the track.
but yoB are right that remembering it would be better. Good idea.
I can do that for REAPER 5 version that can store data from scripts in the project. Do you use only one instance of the reader? Or do you have multiple tracks to read at the same time? At least I can do to remember one.
|
Thanks, for now I only use one track (lyrics).
But if more tracks would be possible with Reaper 5 I wait for the release instead of waiting for a hack for reaper 4
|
|
|
02-23-2015, 07:31 AM
|
#21
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by timothys_monster
Thanks, for now I only use one track (lyrics).
But if more tracks would be possible with Reaper 5 I wait for the release instead of waiting for a hack for reaper 4
|
right now the only difference between REAPER 5 and REAPER 4 versions is that REAPER 5 can be docked (right click in titlebar and dock) and it will remember the position and the docker. So you can have it always opening in a second monitor in it's own docker for example. If you only use one track and your lyrics track id is always the same, you can set that track to be the default.
|
|
|
02-24-2015, 09:22 AM
|
#22
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by timothys_monster
Thanks, for now I only use one track (lyrics).
But if more tracks would be possible with Reaper 5 I wait for the release instead of waiting for a hack for reaper 4
|
updated first post with v0.3
* v0.3 (2015-02-24)
+ remembers track id in REAPER 4 globally.
+ remembers track id in REAPER 5 globally and per project. By default it is per project.
|
|
|
02-24-2015, 09:29 AM
|
#23
|
Human being with feelings
Join Date: Jan 2012
Location: Germany
Posts: 1,130
|
Quote:
Originally Posted by heda
updated first post with v0.3
* v0.3 (2015-02-24)
+ remembers track id in REAPER 4 globally.
+ remembers track id in REAPER 5 globally and per project. By default it is per project.
|
Nice!! Thank you!!
|
|
|
02-25-2015, 07:51 AM
|
#24
|
Human being with feelings
Join Date: Jan 2012
Location: Germany
Posts: 1,130
|
Sorry for spamming you with FRs
But what about that?
I have a *.txt with the song's lyrics and want to create a lyrics track from that.
Is it possible for the API to read this txt and then to create an item for every line? So when there's a line break the script will create a new empty item with the line's text being the note of the item?
Or are there similar ways to do it e.g. for creating subtitles?
|
|
|
02-25-2015, 08:00 AM
|
#25
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
heh, don't worry about requesting many FRs. Keep them coming
A txt doesn't indicate the length of each item. You would have to adjust the item's position. I guess a fixed length of 2 seconds per txt line would be enough and then it's quick to adjust item's length with ripple editing in the track.
as I also use this for lyrics, it only reads the first line of the notes, reserving other lines for color settings. But I am thinking to make it multiline compatible.
in next version I have made an option right clicking the script to enable/disable the recording background color change notification. So this way we can cheat singers or players to think we are only testing and not recording and make the best takes haha
|
|
|
02-25-2015, 08:34 AM
|
#26
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
or maybe determining the empty item's length by counting the txt line characters would be more approximated.
You can also import SRT files with SWS notes. But then you have to have the srt file, not a txt. And it creates regions and we would need the script that you requested in the other thread to convert regions to empty items
|
|
|
02-25-2015, 11:15 AM
|
#27
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by timothys_monster
Sorry for spamming you with FRs
But what about that?
I have a *.txt with the song's lyrics and want to create a lyrics track from that.
|
done http://forum.cockos.com/showthread.php?t=156239
|
|
|
03-01-2015, 11:46 AM
|
#28
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
strange, it's not working. maybe it's not picking up the right track?
|
|
|
03-01-2015, 11:48 AM
|
#29
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
it seems to be picking up the notes only every so often...
|
|
|
03-01-2015, 11:58 AM
|
#30
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by Jason Brian Merrill
strange, it's not working. maybe it's not picking up the right track?
|
have you defined the track from which to pick the notes? click anywhere in the reader and specify the track id number.
|
|
|
03-01-2015, 12:02 PM
|
#31
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
Quote:
Originally Posted by heda
have you defined the track from which to pick the notes? click anywhere in the reader and specify the track id number.
|
what is the track ID number? just the track number? like first track is just "1" ?
I did this... it's picking up the notes only sometime.
|
|
|
03-01-2015, 12:06 PM
|
#32
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by Jason Brian Merrill
what is the track ID number? just the track number? like first track is just "1" ?
I did this... it's picking up the notes only sometime.
|
yes. that's the track id.
mmm I wonder how can this be happening.. it is working fine for me. It only display the notes when playing or recording. Is that it?
|
|
|
03-01-2015, 12:08 PM
|
#33
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
https://db.tt/aTnjirbz
I imported an SRT. could that be related?
|
|
|
03-01-2015, 12:18 PM
|
#34
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by Jason Brian Merrill
|
ok this is definitely a bug.. Thanks! I'll fix it. hopefully
That's why the version is still 0.3 and not 1.0
|
|
|
03-01-2015, 12:35 PM
|
#35
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
no problem!!! your work is so appreciated
|
|
|
03-01-2015, 12:46 PM
|
#36
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
I updated first post with v0.5
* v0.5 (2015-03-01)
+ multiline text supported
# bug fix some notes were not displayed
Hopefully it fixes the issue Jason
v0.4 also added the right lick to enable / disable recording notification.
|
|
|
03-01-2015, 12:54 PM
|
#37
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
fixed it, thank you!
|
|
|
03-02-2015, 08:09 PM
|
#38
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
v0.6 teaser.
More SRT compatibility
|
|
|
03-02-2015, 09:36 PM
|
#39
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
very nice, sir!
|
|
|
03-04-2015, 01:52 PM
|
#40
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
added version 0.6. Please test
* v0.6 (2015-03-04)
+ new multiline engine
+ centered display option (good for subtitles) CTRL+Click to change left/center
+ italics, bold, underline, font color support, and background color support.
# now also works in stopped mode
# CPU optimizations
|
|
|
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 12:39 AM.
|