SetTrackAudio:Gain not working with mod-script-pipe

Hi! I wrote a python script ages ago to automate some stuff for Audacity. I’ve kept Audacity up to date (3.7.1 on Mac), and for some reason now, mod-script-pipe won’t obey the SetTrackAudio:Gain command, even though the commands to set the Pan and ExportMp3 are working totally fine.

		do_command("SetTrackAudio:Pan=\"99\"")
		do_command("SetTrackAudio:Gain=\"-14\"")

Edit: Oh weird. It didn’t keep my quotes in the code. Fixing this.

???

I’ve tried the command SetTrackAudio:Pan=99 on Linux with Audacity 3.7.1 built from source, using the Pipe Client command-line interface, and the command works for me.

Some things to check:

  1. Is mod-script-pipe enabled in Audacity Preferences (in the “Modules” section). Note that Audacity must be restarted after making changes to modules, and check that the change has succeeded.
  2. One or more tracks must be selected for this command to work.
  3. See if the command works using PipeClient’s command-line interface.

Hey, Steve! Thanks for responding.
Yes, mod-script-pipe is enabled and working. The track is selected – I know, because the previous command to SetTrackAudioPan works just fine. Then the very next line, SetTrackAudioGain, doesn’t.
And as I said, my script worked without any changes, through numerous updates of Audacity. I can’t tell, though, if it’s 3.7.1 specifically, because I only need to use this script once or twice a year, so I don’t know which update broke it.

Additionally, here is the output from those commands:

Send: >>>
SetTrackAudio:Pan=“99”
Rcvd: <<<

BatchCommand finished: OK

Send: >>>
SetTrackAudio:Gain=“-14”
Rcvd: <<<

BatchCommand finished: OK

I’ve never used PipeClient, but I’ll try it next. Thanks.

This may be just because of this forum’s software, but (particularly on macOS), be careful of this kind of thing:

Notice that the quotes are not standard ascii quotes (") but “magic-quotes”, and will not work correctly in computer programs or scripts.

Okay, I finally got around to running pipeclient, and it’s exhibiting the same behavior. In the attached screenshot, you can see that I was able to set the focus on a particular track, I successfully set the Pan to 0, but the Gain remains unchanged at -14 instead of 0 as commanded.

I double-checked the scripting reference, and the syntax looks right, as far as I can tell.

It appears that the developers have changed the command without updating the documentation. The command now needs to be:

SetTrackAudio: Volume=30

The valid range for “Volume” is +/- 36

1 Like

Wow, that was fast - the bug has been reported: SetTrackAudio command "Gain" option not working · Issue #8087 · audacity/audacity · GitHub
(Are you “JamzTyson”? I’ve seen that name crop up a couple of times.)

Oh wow, thanks for figuring that out!!! I hadn’t thought to file a bug report or check in there.