Giter VIP home page Giter VIP logo

yutils's People

Contributors

torque avatar youka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

yutils's Issues

Some need fix?

line margin if is set(excepet zero),is force to cover the margin set in style.

convert_color_alpha ARGB-Ass-value not found

Hi,

in old Yutils core (used from FXSpindle) the function Yutils.ass.convert_coloralpha contains an incorrect regular expression:

elseif ass_r_a:find("^&H%x%x%x%x%x%x%x%x$") then    -- ASS color+alpha (style)

here an & at the end is missing

elseif ass_r_a:find("^&H%x%x%x%x%x%x%x%x&$") then   -- ASS color+alpha (style)

Also at result value this is missing. It may be missed in ealier versions, in current version (aegisub at Ubuntu) its required and used as it seems Or is this an error from aegisub byself?.

Ill tell you this to take care about while redeveloping the library (:
Good luck

My (not so clean) implementation (but for this i have all maybe required values from one function, optimizing and refactoring follows later as usual for me):

        coloralpha = function(ass_a_r, g, b, a)
            -- result: a, r, g, b, ass_complete, ass_color, ass_alpha
            local result = { a = nil, r = nil, g = nil, b = nil, ass = nil, ass_c = nil, ass_a = nil }

            g = g and g or false -- set g explicit to false if it not given
            if g then -- g is given, with this b should be given too
                a = a and a or false -- set a explicit to false if it not given
                if a then -- a r g b in numbers is given
                    r = ass_a_r
                else -- r g b in numbers is given
                    r = ass_a_r
                    a = 255
                end
            else -- just ass_a_r is given
                if type(ass_a_r) == "string" then -- ass value is given
                    if ass_a_r:find("^&H%x%x&$") then -- ass alpha is given
                        a = 255 - tonumber(ass_a_r:sub(3,4), 16)
                        r, g, b = 0, 0, 0
                    elseif ass_a_r:find("^&H%x%x%x%x%x%x&$") then -- ass r g b is given
                        a = 255
                        r = tonumber(ass_a_r:sub(7,8), 16)
                        g = tonumber(ass_a_r:sub(5,6), 16)
                        b = tonumber(ass_a_r:sub(3,4), 16)
                    elseif ass_a_r:find("^&H%x%x%x%x%x%x%x%x&$") then -- ass r g b a is given
                        a = 255 - tonumber(ass_a_r:sub(3,4), 16)
                        r = tonumber(ass_a_r:sub(9,10), 16) 
                        g = tonumber(ass_a_r:sub(7,8), 16) 
                        b = tonumber(ass_a_r:sub(5,6), 16)
                    else
                        error(string.format("invalid string %q", ass_a_r))
                    end
                else -- alpha in number is given
                    a = ass_a_r
                    r, g, b = 0, 0, 0
                end
            end

            result.a, result.r, result.g, result.b = a, r, g, b
            result.ass = string.format("&H%02X%02X%02X%02X&", 255 - a, b, g, r)
            result.ass_r = string.format("&H%02X%02X%02X&", b, g, r)
            result.ass_a = string.format("&H%02X&", 255 - a)

            return unpack(result)
        end,

Load current wave?

Hello,

Thank you for sharing Yutils. Through forums, I found your wav.lua script which might provide the exact basis for what I'm trying to achieve: an Aegisub automation script that loops through every 100ms of the current audio project in order to create empty subtitles in a fresh new project by guessing the start/stop positions of each human speech section. (I can then just merge/split where it was inaccurate.) This means performing some kind of FFT on both channels in a loop, defining some thresholds for frequencies and min/max duration and... not much else, yet it could save me a full 33% of the time I invest creating subtitles from scratch. If I succeed, I intend to contribute the script to the Aegisub community ASAP of course, because I'm likely not the only one creating new subtitles with it.

Is there any way integrated within Aegisub that we could access the currently loaded audio instead of loading an external WAV file? If not, then the "cleanest" way might be to access the name of the current video file (I usually deal with MP4) and run shell commands to extract audio from it using ffmpeg, then use Yutils.decode.create_wav_reader()?

I figure coming to you first might save me a lot of headaches looking in the wrong directions, especially as this will be my first attempt at speaking Lua. ๐Ÿ˜ƒ

Thank you for your time!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.