Better way to sync script to music?

Common G-Force questions

Moderators: BTT, andy55, b.dwall, keycompton

Post Reply
User avatar
WilburPost
Posts: 24
Joined: Wed Aug 04, 2021 10:20 am
Location: Chicago

Better way to sync script to music?

Post by WilburPost »

I'm using G-Force standalone and Aeon standalone to add dynamic visuals to original music with much success. These are fantastic applications! I'm currently experimenting with Python scripts to add specific G-Force particles at specific times to a song.

Syncing the timing of the particles is tricky. While the @_time decorator in a script works great to specify the timing of events, so far as I can tell the clock starts upon starting the script (in this case the script is named "CTRL O.py" and is manually started by my hitting Ctrl+O); I see no way to hard-code the start of events to the start of a song.

QUESTION: Is there a better way to sync a script to a song?

Ideally, a script, or vis, would start upon first receiving audio input, but I don't see a way to do this. Maybe Python lends itself to this, but I'm no Python programmer. Any suggestions? Thanks!
Windows 10; G-Force Platinum; Aeon Platinum

User avatar
BTT
Administrator
Posts: 2162
Joined: Sun Jun 20, 2010 9:34 pm
Location: United Kingdom

Re: Better way to sync script to music?

Post by BTT »

Hello WilburPost

This is the only information I could find, hope it helps.

How do I coordinate the start of an audio track with a script?

When a new audio track starts in your media player, G-Force will look for a script with a matching name to run (note: if the audio track is an mp3 file and contains ID tag data, then G-Force will use the ID track name instead of the track's filename). For example, suppose you have a script that's timecoded for "Andy Sings Opera.mp3". Rename your script to "Andy Sings Opera.txt", restart G-Force, play the audio track, and G-Force will automatically start the script. The scripting section describes scripts in detail, allowing you to coordinate G-Force with an audio track in exciting ways.
.
Regards BTT

ColorMap Creator for G-Force and Aeon --- SoundSpectrum Forum Administrator.

User avatar
BTT
Administrator
Posts: 2162
Joined: Sun Jun 20, 2010 9:34 pm
Location: United Kingdom

Re: Better way to sync script to music?

Post by BTT »

Hello WilburPost

Further info that may help:-

Scripting G-Force

G-Force has scripting services that allow you to automate or design G-Force performances. G-Force Scripts use a timeline (or "timecode") scheme in order to synchronize G-Force events with events that occur at preset times. Several sample scripts come with G-Force. If you look inside the folder named "Scripts" and view the files found inside it, you can follow along with what you're seeing when you run the script in G-Force. Studying the scripts that come with G-Force will teach you how to create your own scripts. See the customizing section for more.

The 2 ways a script can be started:
A script has the name "CTRL O.py" and CTRL O is pressed.
The command Run( "ScriptName" ) is used (extensions are optional).

Getting Started with Scripting

In order to write your own scripts, you'll need to know what commands are available and how to invoke them. In the Scripts folder, you'll find the file "Script Command Reference.py", which documents and describes common script commands.
Note: the scripting documentation is under construction and is evolving as G-Force develops. It's recommended you study the example script files to get a basic understanding of scripting and command usage.
.
Regards BTT

ColorMap Creator for G-Force and Aeon --- SoundSpectrum Forum Administrator.

User avatar
WilburPost
Posts: 24
Joined: Wed Aug 04, 2021 10:20 am
Location: Chicago

Re: Better way to sync script to music?

Post by WilburPost »

Thank you BTT! Much appreciated! :)
Windows 10; G-Force Platinum; Aeon Platinum

User avatar
WilburPost
Posts: 24
Joined: Wed Aug 04, 2021 10:20 am
Location: Chicago

Re: Better way to sync script to music?

Post by WilburPost »

BTT wrote:
Sun Aug 29, 2021 12:13 pm
When a new audio track starts in your media player, G-Force will look for a script with a matching name to run (note: if the audio track is an mp3 file and contains ID tag data, then G-Force will use the ID track name instead of the track's filename). For example, suppose you have a script that's timecoded for "Andy Sings Opera.mp3". Rename your script to "Andy Sings Opera.txt", restart G-Force, play the audio track, and G-Force will automatically start the script.
Thank you again for providing these references. Unfortunately, I can't get this to work. I've tried it with both G-Force Standalone and G-Force via Windows Media Player (v12.0.19041.1151).

The script files are Python files (with the extension *.py), but the above instructions use the *.txt extension, so I've included scripts with both extensions.

There are script folders in 2 locations:

..\AppData\Roaming\SoundSpectrum\G-Force\Scripts
C:\Program Files (x86)\SoundSpectrum\G-Force\Scripts

However, placing the scripts in both these locations still does not result in G-Force auto-loading the scripts.

The above instructions state that an MP3's "Track ID" will supersede the MP3's filename, however, there is no metadata associated with the MP3 I'm using (unless Track ID is referring to something else).

Maybe I missed a step? Thanks.
Windows 10; G-Force Platinum; Aeon Platinum

Post Reply