# Tone Generator via Scripting drifts frequency to last GUI-used value despite explicit parameters

**URL:** <https://forum.audacityteam.org/t/tone-generator-via-scripting-drifts-frequency-to-last-gui-used-value-despite-explicit-parameters/147278>\
**Category:** Macros and Scripting\
**Created:** [August 13, 2025, 1:36am UTC](https://forum.audacityteam.org/t/tone-generator-via-scripting-drifts-frequency-to-last-gui-used-value-despite-explicit-parameters/147278 "2025-08-13T01:36:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flori8029](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/f/e47c2d/32.png) [@flori8029](https://forum.audacityteam.org/u/flori8029)\
**Post date:** [August 13, 2025, 1:36am UTC](https://forum.audacityteam.org/t/tone-generator-via-scripting-drifts-frequency-to-last-gui-used-value-despite-explicit-parameters/147278/1 "2025-08-13T01:36:40Z")

</div>

Dear Community,

I’m trying to generate a constant frequency sine wave using Audacity’s scripting interface (mod-script-pipe), by using the Tone command in my python script:

```auto
do_command('NewMonoTrack:')
do_command('Select: Start=0 End=1 Track=0')
do_command('Tone: Frequency=440 Amplitude=0.9 Waveform="Sine"')

```

The resulting tone starts at 440 Hz but then drifts/sweeps to whatever frequency I last used in the GUI Tone Generator. Restarting Audacity does not solve the issue (then, the frequency decreases to 0 Hz). When I use the GUI Tone Generator, everything works as expected.  
This seems to indicate that the scripting interface’s Tone command is still referencing some internal stored state from the GUI tone generator, overriding the scripted parameters partially or gradually over time.

Is there a known way to completely reset or override the Tone Generator’s internal parameter state via scripting?  
Thank you for any pointers or workarounds!

Yours sincerely,  
flori8029

---

<div class="post-metadata">

**Author:** ![steve](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@steve](https://forum.audacityteam.org/u/steve)\
**Post date:** [August 13, 2025, 10:29am UTC](https://forum.audacityteam.org/t/tone-generator-via-scripting-drifts-frequency-to-last-gui-used-value-despite-explicit-parameters/147278/2 "2025-08-13T10:29:22Z")

</div>

It looks like a bug to me. If you wish to report it to the developers, do so here: [GitHub · Where software is built](https://github.com/audacity/audacity/issues)

A possible workaround might be to use “Chirp” instead of “Tone”. If the start and end parameters of Chirp are the same, then the generated sound is a constant Tone.
