No internet connection
  1. Home
  2. How to

Sequential Markers BUT BETTER (and a bit more complicated to code)

By Bhig Trapper @Bhig_Trapper
    2025-02-17 11:59:42.670Z2025-02-17 21:30:40.849Z

    Hello again!

    Thank you very much for the help last time with creating sequential markers.
    I now face a need for deeper programming, and im stuck!
    __
    GOAL: place sequential markers with the following rules:
    _
    STEP 0 (no soundflow) - I manually select the region that will have a marker placed in the middle of.

    STEP 1 (now on soundflow) - Delete the gap.
    STEP 2 - Add 2 seconds of silence
    STEP 3 - Press left arrow to be at the end of the previous phrase.
    STEP 4 - Apply rules!
    A. IF the waveform of the previous phrase ends AFTER the respective .5 second, go to the NEXT second, add ONE SECOND of silence.
    Read the timecode or selection timecode (pictured bellow). I believe there is a function in SOUNDFLOW can read the UI, or at least select the numbers, copy it, and use the information within the clipboard?

    Perhaps a "click ui element" could work. When the TIMECODE UI is clicked, it selects a single number to change. Holding SHIFT and clicking LEFT or RIGH arrow keys enables the user to move up and down the timecode.

    Bellow is the screenshot showing the priovous phrase's waveform ending after the 0.5 second decimal.

    As you can see with the photo above, the waveform ends just AFTER 15:54.05 To skip to the next second, I'm thinking of using the "SNAP" button in audacity. Turn on snapping, brings selection to the next .00 second, press RIGHT ARROW to add a second, turn off snapping. Because we already added 2 seconds of silence at the start of this opperation, we can now place a sequential marker. Next, we need there needs to be a whole second of silence before the next phrase, after the current marker. So on that marker, we can add 1 second of silence. Next, **and I dont think this is possible** but it would be nice if the opperation was able to delete the gap that came after the second of silence and before the start of the waveform on the next frame. Bellow is the perfect end of the opperation. Looking great and clean.

    B. If the phrase's waveform end BEFORE the 0.5 seccond decimal, go to next seccond, place a marker. For this process, steps are similar.
    Enable SNAP button, this brings us to the PREVIOUS 0.0 decimal point, click right arrow, place marker.

    Again, if the macro could also somehow delete the gap left after the 1 second silence POST marker and before the start of the next phrase's waveform.

    Help on this would be greatly appreciated. Im trying to fully integrate my company's editing workflow within SOUNDFLOW. This is the last key in the puzzle from my audacity deck. Please help me close the gap so i can get a real big group of licenses going!

    Much much MUCH love,

    The biggest trapper around.
    P.S. MY SCRIPT AS IT STANDS, bellow

    sf.ui.app("org.audacityteam.audacity").mainWindow.children.whoseRole.is("AXUnknown").whoseTitle.is("Snap").first.elementClick();
    
    sf.ui.app('org.audacityteam.audacity').menuClick({
        menuPath: ["Generate","Silence..."],
    });
    
    sf.keyboard.press({
        keys: "2,  0, 0, 0",
    });
    
    sf.keyboard.press({
        keys: "return",
    });
    
    sf.keyboard.press({
        keys: "right",
    });
    
    sf.ui.app("org.audacityteam.audacity").mainWindow.children.whoseRole.is("AXUnknown").whoseTitle.is("Snap").first.elementClick();
    
    if (event.keyboardState.hasAlt) {
    
        globalState.audacityLabelNumber = undefined;
    
        log("The label number has been reset.");
    
    } else {
    
        // Initialize a persistent variable to track the label number
        globalState.audacityLabelNumber = globalState.audacityLabelNumber || 1;
    
        const labelText = String(globalState.audacityLabelNumber);
    
        sf.clipboard.clear();
    
        sf.clipboard.setText({ text: labelText });
    
        sf.clipboard.waitForText();
    
        const audacity = sf.ui.app("org.audacityteam.audacity");
    
        audacity.menuClick({
            menuPath: ["Edit", "Labels", "Paste Text to New Label"]
        });
    
        // Accept label text
        sf.keyboard.press({ keys: "return", });
    
        // Increment the label number for the next run
        globalState.audacityLabelNumber++;
    }
    
    • 0 replies