Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Trying to run a script that moves the starting time of my markers

New Here ,
Oct 27, 2023 Oct 27, 2023

Hello I want to move the starting time of all my markers backwards half a second.
Chat GPT came up with this:

 

 

// Define the time offset (in seconds) to move the markers
var timeOffset = -0.5; // Half a second backward

// Get the active session
var activeSession = app.activeSession;

// Check if there's an active session
if (activeSession) {
  // Get all markers in the active session
  var markers = activeSession.markers;

  // Iterate through all markers
  for (var i = 0; i < markers.numMarkers; i++) {
    var marker = markers.getMarker(i);

    // Calculate the new position for the marker
    var newStartTime = marker.startTime + timeOffset;

    // Update the marker's position
    marker.startTime = newStartTime;
  }

  // Refresh the view to see the changes
  activeSession.view.refresh();
} else {
  alert("No active session found. Please open an audio file in Adobe Audition.");
}

 

my issue is that i keep getting the message  "No active seesionfound. please open an audio file in Adobe Audition." Any suggestions?

TOPICS
How to
200
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 27, 2023 Oct 27, 2023

Open the list of markers in the session you want to re-time. Then use File>Export>Selected Markers to CSV. Open this in a spreadsheet, do the manipulation there, and import the results back into your session. This will be quicker and way less frustrating than trying to explain to ChatGPT what it got wrong. I've tried that; it's quicker to write the code yourself.

 

In this instance, it's got confused between a file and a session. This is information that you have to spell out very carefully, otherwise it will screw you over every time.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 30, 2023 Oct 30, 2023
LATEST

Thanks for the reply Steve, exporting and resetiing the markers and then reimporting was my last resort, I am a c# developer I can automate that process, I was just hoping to do it with a JSX script inside audition. Its a shame there is no guide on how to code it in JSX. We have about 20 sound files with 60 markers each.
Do you  happen to know the code in JSX to store the markers of the opened file in audition in a variable? Because after that the logic seems correct.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines