Searching/Navigating Between Marker Text in Soundflow?
Is there a way to search through marker text in Soundflow and jump between matches? Looking for something like a 'Find Next' function that would let me search for specific text and navigate between markers containing that text.
- In reply toSam_Ada⬆:Kitch Membery @Kitch2024-11-06 23:01:32.426Z
Hi @Sam_Ada,
Here is a script that will navigate to the next memory location whos name includes the matching text.
function getCurrentMemoryLocationNumber() { const memoryLocations = sf.app.proTools.memoryLocations.invalidate() .allItems.map(memLoc => memLoc); const playheadLocationSamples = Number(sf.app.proTools.getTimelineSelection({ timeScale: "Samples" }).inTime); // Sort Memory Locations by distance to playhead memoryLocations.sort((a, b) => { const aDistanceToPlayhead = Number(a.startTimeInSamples) - playheadLocationSamples; const bDistanceToPlayhead = Number(b.startTimeInSamples) - playheadLocationSamples; return Math.abs(aDistanceToPlayhead) - Math.abs(bDistanceToPlayhead); }); return memoryLocations[0].number } function navigateToNextMemoryLocationWithText({ searchText }) { sf.app.proTools.invalidate(); sf.ui.proTools.appActivateMainWindow(); const memoryLocations = sf.app.proTools.memoryLocations; const matchingMemoryLocations = memoryLocations.allItems.filter(ml => { return ml.name.toLowerCase().includes(searchText.toLowerCase()) }).map(ml => ml.number); // Get the current or closest previous memory location const currentMemoryLocation = getCurrentMemoryLocationNumber(); const nextMatchingMemoryLocation = matchingMemoryLocations.find(mlNumber => mlNumber > currentMemoryLocation) sf.app.proTools.selectMemoryLocation({ number: nextMatchingMemoryLocation }); } navigateToNextMemoryLocationWithText({ searchText: "Text here" });
This could also be improved to add modes for navigating to next/previous first/last etc. But I'll let you dog into that :-)
Rock on!
- In reply toSam_Ada⬆:Kitch Membery @Kitch2024-11-06 23:33:02.362Z
Hi @Sam_Ada,
Here is an improved version with Next/Previous options + some refactoring.
sf.app.proTools.invalidate(); sf.ui.proTools.appActivateMainWindow(); const memoryLocations = sf.app.proTools.memoryLocations.invalidate().allItems.map(memLoc => memLoc); function getCurrentMemoryLocationNumber() { const playheadLocationSamples = Number(sf.app.proTools.getTimelineSelection({ timeScale: "Samples" }).inTime); // Sort Memory Locations by distance to playhead memoryLocations.sort((a, b) => { const aDistanceToPlayhead = Number(a.startTimeInSamples) - playheadLocationSamples; const bDistanceToPlayhead = Number(b.startTimeInSamples) - playheadLocationSamples; return Math.abs(aDistanceToPlayhead) - Math.abs(bDistanceToPlayhead); })[0].number; const memoryLocationNumber = memoryLocations[0].number; return memoryLocationNumber } /** * @param {object} args * @param {string} args.searchText * @param {'Next'|'Previous'} args.mode */ function navigateToNextMemoryLocationWithText({ searchText, mode }) { const matchingMemoryLocations = memoryLocations.filter(ml => { return ml.name.toLowerCase().includes(searchText.toLowerCase()) }).map(ml => ml.number); // Get the current or closest previous memory location const currentMemoryLocation = getCurrentMemoryLocationNumber(); // Find next/previous matching memory location number const targetMemoryLocationNumber = matchingMemoryLocations.find(mlNumber => { if (mode === "Next") { return mlNumber > currentMemoryLocation } else if (mode === "Previous") { return mlNumber < currentMemoryLocation } }); if (!targetMemoryLocationNumber) throw `No ${mode} matching Memory Location was found.` sf.app.proTools.selectMemoryLocation({ number: targetMemoryLocationNumber }); } navigateToNextMemoryLocationWithText({ searchText: "TEXT HERE", mode: "Next", });
:-)
- SSam Ada @Sam_Ada
Awesome stuff Kitch!
But can we adjust it to predict the lotto numbers?
Kitch Membery @Kitch2024-11-07 18:28:00.615Z
Next hangout let's work on this!
- In reply toKitch⬆:MMartin Wrang @Martin_Wrang
Hi Kitch
I just tried this out and it seems very promising! Unfortunately I've found it to be really buggy so far. Sometimes it says there are no more previous/next markers when there clearly is, and other times trying to go to the next marker suddenly takes me back to the first. As far as I can tell the errors follow the markers and are not random as such. After deleting markers and creating new ones, the errors appear in new and different spots, but remain consistent as long as the markers exist. I don't know where to start troubleshooting...This script seems is much more reliable for me, but also takes noticeably longer to move between markers..
Identical Marker Navigation #post-19- SSam Ada @Sam_Ada
Hey Martin. This script finds text that you have selected in one program and finds it in Pro-tools So far for me it is not buggy.
If you are just trying to get to next and previous markers the one in the Pro Tools Package is the one I use.
- In reply toMartin_Wrang⬆:
Kitch Membery @Kitch2024-12-09 18:45:00.449Z
Hi @Martin_Wrang,
This script was written as a more bespoke solution for Sam's use case.
It may be best to start a new thread in the how-to section detailing the workflow that you'd like to achieve and hopefully, the community can help you with a solution.
And as Sam mentioned... If you're just trying to navigate to the next or previous markers, it's best to use the commands that are included in SoundFlow's Official Pro Tools Package for that. They are located in the Pro Tools Package under "Memory Locations"=>"Go to Next Marker" & "Go to Previous Marker".
- MMartin Wrang @Martin_Wrang
Hi Kitch & Sam
I was trying to use the script to navigate markers containing the text “CUT” (and a copy for markers containing “SCENE”). I just replaced “TEXT HERE” in the second to last line as such:
searchText: "CUT",
But maybe that is not how the script is intended to be used. If so I’m for the noise.
Either way, if all is working well for you Sam, maybe I should just start a new post and link to this one?Kitch Membery @Kitch2024-12-09 21:55:49.662Z
Better to use the red "Need Help" button in SoundFlow for this. You can learn how to do this at the following link.
https://soundflow.org/docs/help#script-help
By following the steps, we'll get your SoundFlow logs that will help us troubleshoot further. :-)
- In reply toMartin_Wrang⬆:OOwen Granich-Young @Owen_Granich_Young
Martin Check out Advanced Memory Locations package in the store as well. It might do what you're looking for?
- OIn reply toSam_Ada⬆:Owen Granich-Young @Owen_Granich_Young
Sam Check out Advanced Memory Locations package too.