mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Work on Scripts.
Add script for spectrograms. Add Script for 'after' with effects examples. Add space and dc bias to afters script. Add docimages_all.py script to call all scripts. Shared part of scripts extracted into docimages_core.py
This commit is contained in:
parent
aae9349f2e
commit
8ab9345268
144
scripts/piped-work/docimages_after.py
Normal file
144
scripts/piped-work/docimages_after.py
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
# docimages_after.py
|
||||||
|
# Sends commands to get images for the manual.
|
||||||
|
# Images for before and after for most commands
|
||||||
|
|
||||||
|
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
||||||
|
# before running this script.
|
||||||
|
|
||||||
|
#load and run the common core.
|
||||||
|
exec( open("docimages_core.py" ).read() )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Commands = ["Cut", "Split", "SplitCut",
|
||||||
|
"Silence", "Trim",
|
||||||
|
"SplitNew", "Duplicate",
|
||||||
|
"ZoomIn", "ZoomOut", "ZoomNormal", "ZoomSel", "FitInWindow", "FitV"
|
||||||
|
]
|
||||||
|
|
||||||
|
Effects = [
|
||||||
|
"Reverse","FadeIn", "FadeOut", "Invert",
|
||||||
|
"Amplify","BassAndTreble","Compressor","Distortion","Echo",
|
||||||
|
"Equalization","Normalize","Phaser",
|
||||||
|
"Repeat","Reverb","Wahwah",
|
||||||
|
"HighPassFilter","LowPassFilter",
|
||||||
|
"NotchFilter","AdjustableFade","Delay","Limiter"
|
||||||
|
]
|
||||||
|
|
||||||
|
Slow = ["ChangePitch","ChangeSpeed", "ChangeTempo","Paulstretch",
|
||||||
|
"TimeScale"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
Generators = ["Chirp","DtmfTones","Noise","Tone","Pluck"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# "Delete", "Copy", - look same as cut
|
||||||
|
# "SplitDelete" - same as splitcut
|
||||||
|
|
||||||
|
ToDo = ["Paste", "Join", "DisJoin",
|
||||||
|
|
||||||
|
"ClipFix",
|
||||||
|
"AutoDuck",
|
||||||
|
"ClickRemoval",
|
||||||
|
"FindClipping",
|
||||||
|
"TruncateSilence",
|
||||||
|
"SilenceFinder",
|
||||||
|
"BeatFinder",
|
||||||
|
"NyquistPrompt",
|
||||||
|
"RhythmTrack",
|
||||||
|
"SoundFinder",
|
||||||
|
"SpectralEditMultiTool",
|
||||||
|
"SpectralEditParametricEq",
|
||||||
|
"SpectralEditShelves",
|
||||||
|
"VocalReductionAndIsolation",
|
||||||
|
"CrossfadeClips",
|
||||||
|
"CrossfadeTracks",
|
||||||
|
"RegularIntervalLabels",
|
||||||
|
|
||||||
|
"Vocoder", #stereo
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
def starterTrack():
|
||||||
|
loadMonoTracks(1)
|
||||||
|
do( 'Select: First=0 Last=0 Start=10 End=130')
|
||||||
|
do( 'ZoomSel' )
|
||||||
|
do( 'Select: Start=55 End=70')
|
||||||
|
|
||||||
|
def withDcBias( amount ):
|
||||||
|
loadMonoTracks(1)
|
||||||
|
do( 'NewMonoTrack' )
|
||||||
|
do( 'Select: First=1 Last=1 Start=0 End=0.5' )
|
||||||
|
do( 'Tone: Frequency=1.0 Amplitude='+str(amount) +
|
||||||
|
' Waveform=Square Interpolation=Linear' )
|
||||||
|
do( 'Repeat: Count=300' )
|
||||||
|
do( 'Join' );
|
||||||
|
do( 'Select: First=0 Last=1 Start=0 End=150' )
|
||||||
|
do( 'MixAndRender' );
|
||||||
|
do( 'Select: First=0 Last=0 Start=0 End=0' )
|
||||||
|
do( 'SetTrack: Name="Track with DC Bias"')
|
||||||
|
|
||||||
|
def spaceyTrack() :
|
||||||
|
loadMonoTracks(1)
|
||||||
|
do( 'Select: First=0 Last=0 Start=20 End=40')
|
||||||
|
do( 'Silence' )
|
||||||
|
do( 'Select: First=0 Last=0 Start=60 End=100')
|
||||||
|
do( 'Silence' )
|
||||||
|
do( 'Select: First=0 Last=0 Start=10 End=140')
|
||||||
|
|
||||||
|
|
||||||
|
def imageAfters( commands, doWhat):
|
||||||
|
starterTrack()
|
||||||
|
capture( 'BeforeEffect.png', 'All_Tracks_Plus' )
|
||||||
|
for name in commands :
|
||||||
|
starterTrack()
|
||||||
|
do( 'SetTrack: Name="'+name+'"')
|
||||||
|
do( name )
|
||||||
|
capture( 'After' + name + '1.png' , doWhat )
|
||||||
|
do( 'Select: Start=0 End=0')
|
||||||
|
capture( 'After' + name + '2.png' , doWhat )
|
||||||
|
|
||||||
|
|
||||||
|
def generators():
|
||||||
|
for name in Generators :
|
||||||
|
makeWayForTracks()
|
||||||
|
do( 'NewMonoTrack' )
|
||||||
|
do( 'SetTrack: Name="'+name+'"')
|
||||||
|
do( 'Select: Start=0 End=10' )
|
||||||
|
do( name )
|
||||||
|
do( 'ZoomSel' )
|
||||||
|
do( 'Select: Start=0 End=0' )
|
||||||
|
capture( 'After' + name + '.png' , 'All_Tracks_Plus' )
|
||||||
|
|
||||||
|
|
||||||
|
def spaceDemo():
|
||||||
|
spaceyTrack()
|
||||||
|
capture( 'BeforeTruncateSilence.png' , 'All_Tracks' )
|
||||||
|
do( 'Select: First=0 Last=0 Start=0 End=0')
|
||||||
|
capture( 'SpaceyTrack.png' , 'All_Tracks' )
|
||||||
|
do( 'TruncateSilence' )
|
||||||
|
capture( 'AfterTruncateSilence1.png' , 'All_Tracks' )
|
||||||
|
do( 'Select: First=0 Last=0 Start=0 End=0')
|
||||||
|
capture( 'AfterTruncateSilence2.png' , 'All_Tracks' )
|
||||||
|
spaceyTrack()
|
||||||
|
do( 'Disjoin' )
|
||||||
|
capture( 'AfterDisjoin1.png' , 'All_Tracks' )
|
||||||
|
do( 'Select: First=0 Last=0 Start=0 End=0')
|
||||||
|
capture( 'AfterDisjoin2.png' , 'All_Tracks' )
|
||||||
|
|
||||||
|
|
||||||
|
def biasDemo():
|
||||||
|
withDcBias( 0.1 )
|
||||||
|
capture( 'DcBias.png' , 'All_Tracks' )
|
||||||
|
|
||||||
|
imageSet("After")
|
||||||
|
imageAfters( Commands, 'All_Tracks_Plus' ) # With ruler
|
||||||
|
imageAfters( Effects, 'All_Tracks' ) # Without ruler
|
||||||
|
imageAfters( Slow, 'All_Tracks' ) # Without ruler
|
||||||
|
generators()
|
||||||
|
spaceDemo()
|
||||||
|
biasDemo()
|
||||||
|
|
||||||
|
|
12
scripts/piped-work/docimages_all.py
Normal file
12
scripts/piped-work/docimages_all.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# docimages_all.py
|
||||||
|
# Sends commands to get images for the manual.
|
||||||
|
# Execs all the docimage scripts.
|
||||||
|
|
||||||
|
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
||||||
|
# before running this script.
|
||||||
|
|
||||||
|
|
||||||
|
exec( open("docimages_tracks.py" ).read() )
|
||||||
|
exec( open("docimages_labels.py" ).read() )
|
||||||
|
exec( open("docimages_spectro.py" ).read() )
|
||||||
|
exec( open("docimages_after.py" ).read() )
|
159
scripts/piped-work/docimages_core.py
Normal file
159
scripts/piped-work/docimages_core.py
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
# docimages_core.py
|
||||||
|
# Sends commands to get images for the manual.
|
||||||
|
# This is the shared part reused in a bunch of scripts.
|
||||||
|
|
||||||
|
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
||||||
|
# before running this script.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def startPipes() :
|
||||||
|
global tofile
|
||||||
|
global fromfile
|
||||||
|
global EOL
|
||||||
|
if( sys.platform == 'win32' ):
|
||||||
|
print( "pipe-test.py, running on windows" )
|
||||||
|
toname = '\\\\.\\pipe\\ToSrvPipe'
|
||||||
|
fromname = '\\\\.\\pipe\\FromSrvPipe'
|
||||||
|
EOL = '\r\n\0'
|
||||||
|
else:
|
||||||
|
print( "pipe-test.py, running on linux or mac" )
|
||||||
|
toname = '/tmp/audacity_script_pipe.to.' + str(os.getuid())
|
||||||
|
fromname = '/tmp/audacity_script_pipe.from.' + str(os.getuid())
|
||||||
|
EOL = '\n'
|
||||||
|
|
||||||
|
print( "Write to \"" + toname +"\"" )
|
||||||
|
if not os.path.exists( toname ) :
|
||||||
|
print( " ..does not exist. Ensure Audacity is running with mod-script-pipe." )
|
||||||
|
sys.exit();
|
||||||
|
|
||||||
|
print( "Read from \"" + fromname +"\"")
|
||||||
|
if not os.path.exists( fromname ) :
|
||||||
|
print( " ..does not exist. Ensure Audacity is running with mod-script-pipe." )
|
||||||
|
sys.exit();
|
||||||
|
|
||||||
|
print( "-- Both pipes exist. Good." )
|
||||||
|
|
||||||
|
tofile = open( toname, 'wt+' )
|
||||||
|
print( "-- File to write to has been opened" )
|
||||||
|
fromfile = open( fromname, 'rt')
|
||||||
|
print( "-- File to read from has now been opened too\r\n" )
|
||||||
|
|
||||||
|
|
||||||
|
def sendCommand( command ) :
|
||||||
|
global tofile
|
||||||
|
global EOL
|
||||||
|
print( "Send: >>> \n"+command )
|
||||||
|
tofile.write( command + EOL )
|
||||||
|
tofile.flush()
|
||||||
|
|
||||||
|
def getResponse() :
|
||||||
|
global fromfile
|
||||||
|
result = ''
|
||||||
|
line = ''
|
||||||
|
while line != '\n' :
|
||||||
|
result += line
|
||||||
|
line = fromfile.readline()
|
||||||
|
#print(" I read line:["+line+"]")
|
||||||
|
return result
|
||||||
|
|
||||||
|
def doCommand( command ) :
|
||||||
|
sendCommand( command )
|
||||||
|
response = getResponse()
|
||||||
|
print( "Rcvd: <<< \n" + response )
|
||||||
|
return response
|
||||||
|
|
||||||
|
def do( command ) :
|
||||||
|
doCommand( command )
|
||||||
|
|
||||||
|
def quickTest() :
|
||||||
|
do( 'Help: Command=Help' )
|
||||||
|
|
||||||
|
def setup() :
|
||||||
|
global path
|
||||||
|
global sample
|
||||||
|
global sample2
|
||||||
|
path = 'C:\\Users\\James Crook\\'
|
||||||
|
sample ='C:\\Users\\James Crook\\Music\\The Poodle Podcast.wav'
|
||||||
|
sample2 ='C:\\Users\\James Crook\\Music\\PoodlePodStereo.wav'
|
||||||
|
startPipes()
|
||||||
|
do( 'SetProject: X=10 Y=10 Width=850 Height=800' )
|
||||||
|
|
||||||
|
def imageSet(name):
|
||||||
|
print("****************** " + name + " ***************************")
|
||||||
|
|
||||||
|
def makeWayForTracks( ) :
|
||||||
|
do( 'Select: First=0 Last=20' )
|
||||||
|
do( 'RemoveTracks' )
|
||||||
|
|
||||||
|
def capture( name, what ) :
|
||||||
|
global path
|
||||||
|
do( 'Screenshot: Path="'+path+name+'" CaptureWhat=' + what )
|
||||||
|
|
||||||
|
def loadMonoTrack():
|
||||||
|
global sample
|
||||||
|
makeWayForTracks( )
|
||||||
|
do( 'Import2: Filename="'+sample+'"' )
|
||||||
|
do( 'Select: First=0 Last=0 Start=0 End=150')
|
||||||
|
do( 'Trim')
|
||||||
|
do( 'ZoomSel' )
|
||||||
|
|
||||||
|
def loadStereoTrack():
|
||||||
|
global sample2
|
||||||
|
makeWayForTracks( )
|
||||||
|
do( 'Import2: Filename="'+sample2+'"' )
|
||||||
|
do( 'Select: First=0 Last=0 Start=0 End=150')
|
||||||
|
do( 'Trim')
|
||||||
|
do( 'ZoomSel' )
|
||||||
|
|
||||||
|
def loadMonoTracks( num ) :
|
||||||
|
makeWayForTracks( )
|
||||||
|
loadMonoTrack()
|
||||||
|
do( 'SetTrack: Track=0 Name="Foxy Lady"')
|
||||||
|
for i in range( 0, num-1 ):
|
||||||
|
do( 'Duplicate' )
|
||||||
|
do( 'FitInWindow' )
|
||||||
|
do( 'Select: Start=55 End=70')
|
||||||
|
|
||||||
|
def loadStereoTracks( num ) :
|
||||||
|
makeWayForTracks( )
|
||||||
|
loadStereoTrack()
|
||||||
|
do( 'SetTrack: Track=0 Name="Foxy Lady"')
|
||||||
|
for i in range( 0, num-1 ):
|
||||||
|
do( 'Duplicate' )
|
||||||
|
do( 'FitInWindow' )
|
||||||
|
do( 'Select: Start=55 End=70 First=0 Last=' + str(num*2-1) )
|
||||||
|
|
||||||
|
def makeMonoTracks( num ) :
|
||||||
|
makeWayForTracks( )
|
||||||
|
for i in range( 0, num ):
|
||||||
|
do( 'NewMonoTrack' )
|
||||||
|
do( 'SetTrack: Track=0 Name="Foxy Lady"')
|
||||||
|
do( 'Select: Start=0 End=150 First=0 Last=' + str(num-1) )
|
||||||
|
do( 'Chirp: StartAmp=0.5' )
|
||||||
|
do( 'Wahwah' )
|
||||||
|
do( 'FitInWindow' )
|
||||||
|
do( 'Select: Start=55 End=70')
|
||||||
|
|
||||||
|
def makeStereoTracks( num ) :
|
||||||
|
makeWayForTracks( )
|
||||||
|
for i in range( 0, num ):
|
||||||
|
do( 'NewStereoTrack' )
|
||||||
|
do( 'SetTrack: Track=0 Name="Voodoo Children IN STEREO"')
|
||||||
|
do( 'Select: Start=0 End=150 First=0 Last=' + str(num*2-1) )
|
||||||
|
do( 'Chirp: StartAmp=0.5' )
|
||||||
|
do( 'Wahwah' )
|
||||||
|
do( 'FitInWindow' )
|
||||||
|
do( 'Select: Start=55 End=70')
|
||||||
|
|
||||||
|
try:
|
||||||
|
coreLoaded
|
||||||
|
except NameError:
|
||||||
|
setup()
|
||||||
|
coreLoaded=True
|
||||||
|
print( "Set up done")
|
||||||
|
else :
|
||||||
|
print( "Already set up")
|
||||||
|
|
||||||
|
|
@ -5,113 +5,10 @@
|
|||||||
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
||||||
# before running this script.
|
# before running this script.
|
||||||
|
|
||||||
import os
|
#load and run the common core.
|
||||||
import sys
|
exec( open("docimages_core.py" ).read() )
|
||||||
|
|
||||||
|
|
||||||
if( sys.platform == 'win32' ):
|
|
||||||
print( "pipe-test.py, running on windows" )
|
|
||||||
toname = '\\\\.\\pipe\\ToSrvPipe'
|
|
||||||
fromname = '\\\\.\\pipe\\FromSrvPipe'
|
|
||||||
EOL = '\r\n\0'
|
|
||||||
else:
|
|
||||||
print( "pipe-test.py, running on linux or mac" )
|
|
||||||
toname = '/tmp/audacity_script_pipe.to.' + str(os.getuid())
|
|
||||||
fromname = '/tmp/audacity_script_pipe.from.' + str(os.getuid())
|
|
||||||
EOL = '\n'
|
|
||||||
|
|
||||||
print( "Write to \"" + toname +"\"" )
|
|
||||||
if not os.path.exists( toname ) :
|
|
||||||
print( " ..does not exist. Ensure Audacity is running with mod-script-pipe." )
|
|
||||||
sys.exit();
|
|
||||||
|
|
||||||
print( "Read from \"" + fromname +"\"")
|
|
||||||
if not os.path.exists( fromname ) :
|
|
||||||
print( " ..does not exist. Ensure Audacity is running with mod-script-pipe." )
|
|
||||||
sys.exit();
|
|
||||||
|
|
||||||
print( "-- Both pipes exist. Good." )
|
|
||||||
|
|
||||||
tofile = open( toname, 'wt+' )
|
|
||||||
print( "-- File to write to has been opened" )
|
|
||||||
fromfile = open( fromname, 'rt')
|
|
||||||
print( "-- File to read from has now been opened too\r\n" )
|
|
||||||
|
|
||||||
|
|
||||||
def sendCommand( command ) :
|
|
||||||
print( "Send: >>> \n"+command )
|
|
||||||
tofile.write( command + EOL )
|
|
||||||
tofile.flush()
|
|
||||||
|
|
||||||
def getResponse() :
|
|
||||||
result = ''
|
|
||||||
line = ''
|
|
||||||
while line != '\n' :
|
|
||||||
result += line
|
|
||||||
line = fromfile.readline()
|
|
||||||
#print(" I read line:["+line+"]")
|
|
||||||
return result
|
|
||||||
|
|
||||||
def doCommand( command ) :
|
|
||||||
sendCommand( command )
|
|
||||||
response = getResponse()
|
|
||||||
print( "Rcvd: <<< \n" + response )
|
|
||||||
return response
|
|
||||||
|
|
||||||
def do( command ) :
|
|
||||||
doCommand( command )
|
|
||||||
|
|
||||||
def quickTest() :
|
|
||||||
do( 'Help: Command=Help' )
|
|
||||||
|
|
||||||
def setup() :
|
|
||||||
global path
|
|
||||||
global sample
|
|
||||||
path = '\"C:/Users/James Crook/\"'
|
|
||||||
sample ='\"C:\\Users\\Public\\Music\\Sample Music\\Concerto.mp3\"'
|
|
||||||
do( 'SetProject: X=10 Y=10 Width=850 Height=800' )
|
|
||||||
|
|
||||||
def makeWayForTracks( ) :
|
|
||||||
do( 'Select: First=0 Last=20' )
|
|
||||||
do( 'RemoveTracks' )
|
|
||||||
|
|
||||||
|
|
||||||
def capture( name, what ) :
|
|
||||||
global path
|
|
||||||
do( 'Screenshot: Path='+path+name+' CaptureWhat=' + what )
|
|
||||||
|
|
||||||
def makeMonoTracks( num ) :
|
|
||||||
makeWayForTracks( )
|
|
||||||
for i in range( 0, num ):
|
|
||||||
do( 'NewMonoTrack' )
|
|
||||||
do( 'SetTrack: Track=0 Name="Foxy Lady"')
|
|
||||||
do( 'Select: Start=0 End=30 First=0 Last=' + str(num-1) )
|
|
||||||
do( 'Chirp: StartAmp=0.5' )
|
|
||||||
do( 'Wahwah' )
|
|
||||||
do( 'FitInWindow' )
|
|
||||||
do( 'Select: Start=11 End=14')
|
|
||||||
|
|
||||||
def loadStereoTrack():
|
|
||||||
global sample
|
|
||||||
makeWayForTracks( )
|
|
||||||
do( 'Import2: Filename='+sample )
|
|
||||||
do( 'Select: Start=0 End=150')
|
|
||||||
do( 'ZoomSel' )
|
|
||||||
do( 'SetTrack: Track=0 Name="The Poodle Podcast"')
|
|
||||||
|
|
||||||
def makeStereoTracks( num ) :
|
|
||||||
makeWayForTracks( )
|
|
||||||
if( num == 1 ):
|
|
||||||
loadStereoTrack()
|
|
||||||
return
|
|
||||||
for i in range( 0, num ):
|
|
||||||
do( 'NewStereoTrack' )
|
|
||||||
do( 'SetTrack: Track=0 Name="Voodoo Children IN STEREO"')
|
|
||||||
do( 'Select: Start=0 End=30 First=0 Last=' + str(num*2-1) )
|
|
||||||
do( 'Chirp: StartAmp=0.5' )
|
|
||||||
do( 'Wahwah' )
|
|
||||||
do( 'FitInWindow' )
|
|
||||||
do( 'Select: Start=55 End=70')
|
|
||||||
|
|
||||||
def addLabels():
|
def addLabels():
|
||||||
do( 'Select: Start=0 End=1' )
|
do( 'Select: Start=0 End=1' )
|
||||||
@ -151,78 +48,66 @@ def addLabels2():
|
|||||||
do( 'Select: First=3 Last=3' )
|
do( 'Select: First=3 Last=3' )
|
||||||
|
|
||||||
|
|
||||||
# A stero track with four labels.
|
def label_image1and2() :
|
||||||
def image1() :
|
|
||||||
makeStereoTracks(1)
|
makeStereoTracks(1)
|
||||||
addLabels()
|
addLabels()
|
||||||
|
# A stero track with four labels.
|
||||||
do( "Select: Start=0 End=0" )
|
do( "Select: Start=0 End=0" )
|
||||||
capture( 'AutoLabels001.png', 'First_Two_Tracks' )
|
capture( 'AutoLabels001.png', 'First_Two_Tracks' )
|
||||||
|
# Removing a label with delete (fraud - we used split delete)
|
||||||
# Removing a label with delete (fraud - we used split delete)
|
|
||||||
def image2() :
|
|
||||||
makeStereoTracks(1)
|
|
||||||
addLabels()
|
|
||||||
do( "Select: Start=44.5 End=60.5 First=2 Last=2" )
|
do( "Select: Start=44.5 End=60.5 First=2 Last=2" )
|
||||||
do( "SplitDelete" )
|
do( "SplitDelete" )
|
||||||
do( "Select: Start=0 End=0 First=0 Last=2" )
|
do( "Select: Start=0 End=0 First=0 Last=2" )
|
||||||
capture( 'AutoLabels002.png','First_Two_Tracks' )
|
capture( 'AutoLabels002.png','First_Two_Tracks' )
|
||||||
|
|
||||||
# Removing a label with split-delete step 1
|
def label_image3and4() :
|
||||||
def image3() :
|
|
||||||
makeStereoTracks(1)
|
makeStereoTracks(1)
|
||||||
addLabels()
|
addLabels()
|
||||||
|
# Removing a label with split-delete step 1
|
||||||
do( "Select: Start=44.5 End=60.5 First=2 Last=2" )
|
do( "Select: Start=44.5 End=60.5 First=2 Last=2" )
|
||||||
capture( 'AutoLabels003.png','First_Two_Tracks' )
|
capture( 'AutoLabels003.png','First_Two_Tracks' )
|
||||||
|
# Removing a label with split-delete step 1
|
||||||
# Removing a label with split-delete step 1
|
|
||||||
def image4() :
|
|
||||||
makeStereoTracks(1)
|
|
||||||
addLabels()
|
|
||||||
do( "Select: Start=44.5 End=60.5 First=2 Last=2" )
|
do( "Select: Start=44.5 End=60.5 First=2 Last=2" )
|
||||||
do( "SplitDelete" )
|
do( "SplitDelete" )
|
||||||
capture( 'AutoLabels004.png','First_Two_Tracks' )
|
capture( 'AutoLabels004.png','First_Two_Tracks' )
|
||||||
|
|
||||||
def image5() :
|
def label_image5and6and7() :
|
||||||
makeStereoTracks(1)
|
makeStereoTracks(1)
|
||||||
addLabels2()
|
addLabels2()
|
||||||
|
# Nothing selected
|
||||||
do( "Select: Start=0 End=0" )
|
do( "Select: Start=0 End=0" )
|
||||||
capture( 'AutoLabels005.png','First_Three_Tracks' )
|
capture( 'AutoLabels005.png','First_Three_Tracks' )
|
||||||
|
# A range selected in label track.
|
||||||
def image6() :
|
|
||||||
makeStereoTracks(1)
|
|
||||||
addLabels2()
|
|
||||||
do( "Select: Start=28.5 End=58.5" )
|
do( "Select: Start=28.5 End=58.5" )
|
||||||
capture( 'AutoLabels006.png','First_Three_Tracks' )
|
capture( 'AutoLabels006.png','First_Three_Tracks' )
|
||||||
|
# Deleting in label track only.
|
||||||
def image7() :
|
|
||||||
makeStereoTracks(1)
|
|
||||||
addLabels2()
|
|
||||||
do( "Select: Start=28.5 End=58.5" )
|
|
||||||
do( "Delete" )
|
do( "Delete" )
|
||||||
do( "Select: Start=0 End=0" )
|
do( "Select: Start=0 End=0" )
|
||||||
capture( 'AutoLabels007.png','First_Three_Tracks' )
|
capture( 'AutoLabels007.png','First_Three_Tracks' )
|
||||||
|
|
||||||
def image8to10() :
|
def label_image8and9and10() :
|
||||||
makeStereoTracks(1)
|
makeStereoTracks(1)
|
||||||
addLabels2()
|
addLabels2()
|
||||||
|
# Select nothing in all three tracks.
|
||||||
do( "Select: First=2 Last=2 Start=100 End=125" )
|
do( "Select: First=2 Last=2 Start=100 End=125" )
|
||||||
do( "AddLabel" )
|
do( "AddLabel" )
|
||||||
do( 'SetLabel: Label=9 Text="Clap" selected=0 Start=110 End=118 ')
|
do( 'SetLabel: Label=9 Text="Clap" selected=0 Start=110 End=118 ')
|
||||||
do( 'Select: First=0 Last=3 Start=0 End=0')
|
do( 'Select: First=0 Last=3 Start=0 End=0')
|
||||||
capture( 'AutoLabels008.png','First_Three_Tracks' )
|
capture( 'AutoLabels008.png','First_Three_Tracks' )
|
||||||
|
# Select label and all three tracks
|
||||||
do( 'SetLabel: Label=9 Text="Clap" selected=1 Start=110 End=118 ')
|
do( 'SetLabel: Label=9 Text="Clap" selected=1 Start=110 End=118 ')
|
||||||
do( 'Select: First=0 Last=3 Start=110 End=118')
|
do( 'Select: First=0 Last=3 Start=110 End=118')
|
||||||
capture( 'AutoLabels009.png','First_Three_Tracks' )
|
capture( 'AutoLabels009.png','First_Three_Tracks' )
|
||||||
|
# Delete label and from all three tracks.
|
||||||
do( 'Delete' )
|
do( 'Delete' )
|
||||||
capture( 'AutoLabels010.png','First_Three_Tracks' )
|
capture( 'AutoLabels010.png','First_Three_Tracks' )
|
||||||
|
|
||||||
#quickTest()
|
imageSet("Labels")
|
||||||
setup()
|
label_image1and2()
|
||||||
#image1()
|
label_image3and4()
|
||||||
#image2()
|
label_image5and6and7()
|
||||||
#image3()
|
label_image8and9and10()
|
||||||
#image4()
|
|
||||||
#image5()
|
|
||||||
#image6()
|
|
||||||
#image7()
|
|
||||||
image8to10()
|
|
||||||
|
58
scripts/piped-work/docimages_spectro.py
Normal file
58
scripts/piped-work/docimages_spectro.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# docimages_spectro.py
|
||||||
|
# Sends commands to get images for the manual.
|
||||||
|
# Images for https://alphamanual.audacityteam.org/man/Spectrogram_View
|
||||||
|
|
||||||
|
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
||||||
|
# before running this script.
|
||||||
|
|
||||||
|
#load and run the common core.
|
||||||
|
exec( open("docimages_core.py" ).read() )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 11 2KHz tones, of decreasing amplitude.
|
||||||
|
# With label track to annotate it.
|
||||||
|
def makeStepper():
|
||||||
|
makeWayForTracks()
|
||||||
|
do( 'NewMonoTrack' )
|
||||||
|
do( 'Select: Start=0 End=22')
|
||||||
|
do( 'Silence' ) #Just so we can watch.
|
||||||
|
do( 'FitInWindow')
|
||||||
|
for i in range( 0, 11 ):
|
||||||
|
do( 'Select: Start='+str(i*2)+' End='+str(i*2+2) )
|
||||||
|
do( 'Chirp: StartFreq=2000 EndFreq=2000 StartAmp=' + str( (400**(0.1 * (10-i)))/400 )+' EndAmp=' + str( (400**(0.1 * (10-i) ))/400 ))
|
||||||
|
do( 'Select: Start=0 End=22')
|
||||||
|
do( 'Join' )
|
||||||
|
do( 'FitInWindow')
|
||||||
|
do( 'AddLabelTrack' )
|
||||||
|
for i in range( 0, 11 ):
|
||||||
|
do( 'Select: Start='+str(i*2)+' End='+str(i*2+2) )
|
||||||
|
do( 'AddLabel' )
|
||||||
|
do( 'SetLabel: Label=' + str(i)+' Selected=0 Text='+str( -(i*10) ))
|
||||||
|
do( 'Select: Start=0 End=0')
|
||||||
|
|
||||||
|
|
||||||
|
def spectro_image1and2() :
|
||||||
|
loadStereoTracks(1)
|
||||||
|
# A stereo track
|
||||||
|
capture( 'Spectral001.png', 'First_Track' )
|
||||||
|
# As spectrogram.
|
||||||
|
do( 'SetTrack: Track=0 Display=Spectrogram')
|
||||||
|
do( 'SetTrack: Track=1 Display=Spectrogram')
|
||||||
|
do( 'Select: Start=55 End=70 First=0 Last=1')
|
||||||
|
capture( 'Spectral002.png', 'First_Track' )
|
||||||
|
|
||||||
|
def spectro_image3and4():
|
||||||
|
makeStepper();
|
||||||
|
# Stepper tone, viewed in dB.
|
||||||
|
do( 'SetTrack: Scale=dB')
|
||||||
|
capture( 'Spectral003.png', 'First_Two_Tracks' )
|
||||||
|
# As spectrogram.
|
||||||
|
do( 'SetTrack: Display=Spectrogram')
|
||||||
|
capture( 'Spectral004.png', 'First_Two_Tracks' )
|
||||||
|
|
||||||
|
#quickTest()
|
||||||
|
|
||||||
|
spectro_image1and2()
|
||||||
|
spectro_image3and4()
|
||||||
|
|
@ -5,131 +5,30 @@
|
|||||||
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
||||||
# before running this script.
|
# before running this script.
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
#load and run the common core.
|
||||||
|
exec( open("docimages_core.py" ).read() )
|
||||||
|
|
||||||
|
|
||||||
if( sys.platform == 'win32' ):
|
def track_image1and8() :
|
||||||
print( "pipe-test.py, running on windows" )
|
|
||||||
toname = '\\\\.\\pipe\\ToSrvPipe'
|
|
||||||
fromname = '\\\\.\\pipe\\FromSrvPipe'
|
|
||||||
EOL = '\r\n\0'
|
|
||||||
else:
|
|
||||||
print( "pipe-test.py, running on linux or mac" )
|
|
||||||
toname = '/tmp/audacity_script_pipe.to.' + str(os.getuid())
|
|
||||||
fromname = '/tmp/audacity_script_pipe.from.' + str(os.getuid())
|
|
||||||
EOL = '\n'
|
|
||||||
|
|
||||||
print( "Write to \"" + toname +"\"" )
|
|
||||||
if not os.path.exists( toname ) :
|
|
||||||
print( " ..does not exist. Ensure Audacity is running with mod-script-pipe." )
|
|
||||||
sys.exit();
|
|
||||||
|
|
||||||
print( "Read from \"" + fromname +"\"")
|
|
||||||
if not os.path.exists( fromname ) :
|
|
||||||
print( " ..does not exist. Ensure Audacity is running with mod-script-pipe." )
|
|
||||||
sys.exit();
|
|
||||||
|
|
||||||
print( "-- Both pipes exist. Good." )
|
|
||||||
|
|
||||||
tofile = open( toname, 'wt+' )
|
|
||||||
print( "-- File to write to has been opened" )
|
|
||||||
fromfile = open( fromname, 'rt')
|
|
||||||
print( "-- File to read from has now been opened too\r\n" )
|
|
||||||
|
|
||||||
|
|
||||||
def sendCommand( command ) :
|
|
||||||
print( "Send: >>> \n"+command )
|
|
||||||
tofile.write( command + EOL )
|
|
||||||
tofile.flush()
|
|
||||||
|
|
||||||
def getResponse() :
|
|
||||||
result = ''
|
|
||||||
line = ''
|
|
||||||
while line != '\n' :
|
|
||||||
result += line
|
|
||||||
line = fromfile.readline()
|
|
||||||
#print(" I read line:["+line+"]")
|
|
||||||
return result
|
|
||||||
|
|
||||||
def doCommand( command ) :
|
|
||||||
sendCommand( command )
|
|
||||||
response = getResponse()
|
|
||||||
print( "Rcvd: <<< \n" + response )
|
|
||||||
return response
|
|
||||||
|
|
||||||
def do( command ) :
|
|
||||||
doCommand( command )
|
|
||||||
|
|
||||||
def quickTest() :
|
|
||||||
do( 'Help: Command=Help' )
|
|
||||||
|
|
||||||
def setup() :
|
|
||||||
global path
|
|
||||||
global sample
|
|
||||||
path = 'C:\\Users\\James Crook\\'
|
|
||||||
sample ='C:\\Users\\James Crook\\Music\\The Poodle Podcast.wav'
|
|
||||||
do( 'SetProject: X=10 Y=10 Width=850 Height=800' )
|
|
||||||
|
|
||||||
def makeWayForTracks( ) :
|
|
||||||
do( 'SelectTracks: First=0 Last=20' )
|
|
||||||
do( 'RemoveTracks' )
|
|
||||||
|
|
||||||
def capture( name, what ) :
|
|
||||||
global path
|
|
||||||
do( 'Screenshot: Path="'+path+name+'" CaptureWhat=' + what )
|
|
||||||
|
|
||||||
def loadMonoTrack():
|
|
||||||
global sample
|
|
||||||
makeWayForTracks( )
|
|
||||||
do( 'Import2: Filename="'+sample+'"' )
|
|
||||||
do( 'Select: First=0 Last=0 Start=0 End=150')
|
|
||||||
do( 'Trim')
|
|
||||||
do( 'ZoomSel' )
|
|
||||||
|
|
||||||
def loadMonoTracks( num ) :
|
|
||||||
makeWayForTracks( )
|
|
||||||
loadMonoTrack()
|
|
||||||
do( 'SetTrack: Track=0 Name="Foxy Lady"')
|
|
||||||
for i in range( 0, num-1 ):
|
|
||||||
do( 'Duplicate' )
|
|
||||||
do( 'FitInWindow' )
|
|
||||||
do( 'Select: Start=55 End=70')
|
|
||||||
|
|
||||||
def makeMonoTracks( num ) :
|
|
||||||
makeWayForTracks( )
|
|
||||||
for i in range( 0, num ):
|
|
||||||
do( 'NewMonoTrack' )
|
|
||||||
do( 'SetTrack: Track=0 Name="Foxy Lady"')
|
|
||||||
do( 'Select: Start=0 End=150 First=0 Last=' + str(num-1) )
|
|
||||||
do( 'Chirp: StartAmp=0.5' )
|
|
||||||
do( 'Wahwah' )
|
|
||||||
do( 'FitInWindow' )
|
|
||||||
do( 'Select: Start=55 End=70')
|
|
||||||
|
|
||||||
def makeStereoTracks( num ) :
|
|
||||||
makeWayForTracks( )
|
|
||||||
for i in range( 0, num ):
|
|
||||||
do( 'NewStereoTrack' )
|
|
||||||
do( 'SetTrack: Track=0 Name="Voodoo Children IN STEREO"')
|
|
||||||
do( 'Select: Start=0 End=150 First=0 Last=' + str(num*2-1) )
|
|
||||||
do( 'Chirp: StartAmp=0.5' )
|
|
||||||
do( 'Wahwah' )
|
|
||||||
do( 'FitInWindow' )
|
|
||||||
do( 'Select: Start=55 End=70')
|
|
||||||
|
|
||||||
# A mono track complete with ruler
|
|
||||||
def image1() :
|
|
||||||
loadMonoTracks(1)
|
loadMonoTracks(1)
|
||||||
|
# A mono track complete with ruler
|
||||||
capture( 'AutoTracks001.png', 'First_Track_Plus' )
|
capture( 'AutoTracks001.png', 'First_Track_Plus' )
|
||||||
|
# Mono with arrow at start.
|
||||||
|
do( 'SetClip: Clip=0 Start=-4.0')
|
||||||
|
capture( 'AutoTracks008.png', 'First_Track' )
|
||||||
|
|
||||||
# A stereo track, with its name on the track
|
def track_image2and6() :
|
||||||
def image2() :
|
|
||||||
makeStereoTracks(1)
|
makeStereoTracks(1)
|
||||||
|
# A stereo track, with its name on the track
|
||||||
capture( 'AutoTracks002.png', 'First_Track' )
|
capture( 'AutoTracks002.png', 'First_Track' )
|
||||||
|
# A stereo track, with different sized channels
|
||||||
|
do( 'SetTrack: Track=0 Height=80')
|
||||||
|
do( 'SetTrack: Track=1 Height=180')
|
||||||
|
capture( 'AutoTracks006.png', 'First_Track' )
|
||||||
|
|
||||||
# Four colours of track
|
# Four colours of track
|
||||||
def image3() :
|
def track_image3() :
|
||||||
loadMonoTracks( 4 )
|
loadMonoTracks( 4 )
|
||||||
do( 'SetTrack: Track=0 Name="Instrument 1" Height=122 Color=Color0')
|
do( 'SetTrack: Track=0 Name="Instrument 1" Height=122 Color=Color0')
|
||||||
do( 'SetTrack: Track=1 Name="Instrument 2" Height=122 Color=Color1')
|
do( 'SetTrack: Track=1 Name="Instrument 2" Height=122 Color=Color1')
|
||||||
@ -137,16 +36,17 @@ def image3() :
|
|||||||
do( 'SetTrack: Track=3 Name="Instrument 4" Height=122 Color=Color3')
|
do( 'SetTrack: Track=3 Name="Instrument 4" Height=122 Color=Color3')
|
||||||
capture( 'AutoTracks003.png', 'First_Four_Tracks' )
|
capture( 'AutoTracks003.png', 'First_Four_Tracks' )
|
||||||
|
|
||||||
# Two Tracks, ready to make stereo
|
def track_image7and4and5():
|
||||||
def image4():
|
|
||||||
loadMonoTracks(2)
|
loadMonoTracks(2)
|
||||||
|
# Two mono tracks of different sizes
|
||||||
|
do( 'SetTrack: Track=0 Height=180')
|
||||||
|
do( 'SetTrack: Track=1 Height=80')
|
||||||
|
capture( 'AutoTracks007.png', 'First_Two_Tracks' )
|
||||||
|
# Two Tracks, ready to make stereo
|
||||||
do( 'SetTrack: Track=0 Name="Left Track" Height=80')
|
do( 'SetTrack: Track=0 Name="Left Track" Height=80')
|
||||||
do( 'SetTrack: Track=1 Name="Right Track" Height=80')
|
do( 'SetTrack: Track=1 Name="Right Track" Height=80')
|
||||||
capture( 'AutoTracks004.png', 'First_Two_Tracks' )
|
capture( 'AutoTracks004.png', 'First_Two_Tracks' )
|
||||||
|
# Combined Stereo Track
|
||||||
# Mono tracks made stereo
|
|
||||||
def image5():
|
|
||||||
loadMonoTracks(2)
|
|
||||||
do( 'SetTrack: Track=0 Pan=-1 Height=80')
|
do( 'SetTrack: Track=0 Pan=-1 Height=80')
|
||||||
do( 'SetTrack: Track=1 Pan=1 Height=80')
|
do( 'SetTrack: Track=1 Pan=1 Height=80')
|
||||||
do( 'MixAndRender' )
|
do( 'MixAndRender' )
|
||||||
@ -155,51 +55,24 @@ def image5():
|
|||||||
do( 'Select: First=0 Last=1' )
|
do( 'Select: First=0 Last=1' )
|
||||||
capture( 'AutoTracks005.png', 'First_Track' )
|
capture( 'AutoTracks005.png', 'First_Track' )
|
||||||
|
|
||||||
# A stereo track, with different sized channels
|
|
||||||
def image6() :
|
|
||||||
makeStereoTracks(1)
|
|
||||||
do( 'SetTrack: Track=0 Height=80')
|
|
||||||
do( 'SetTrack: Track=1 Height=180')
|
|
||||||
capture( 'AutoTracks006.png', 'First_Track' )
|
|
||||||
|
|
||||||
# Two mono tracks of different sizes
|
def track_image9and10() :
|
||||||
def image7() :
|
|
||||||
loadMonoTracks(2)
|
|
||||||
do( 'SetTrack: Track=0 Height=180')
|
|
||||||
do( 'SetTrack: Track=1 Height=80')
|
|
||||||
capture( 'AutoTracks007.png', 'First_Two_Tracks' )
|
|
||||||
|
|
||||||
# Mono with arrow at start.
|
|
||||||
def image8() :
|
|
||||||
loadMonoTracks(1)
|
|
||||||
do( 'SetClip: Clip=0 Start=-4.0')
|
|
||||||
capture( 'AutoTracks008.png', 'First_Track' )
|
|
||||||
|
|
||||||
# Zoomed in to show points stem-plot
|
|
||||||
def image9() :
|
|
||||||
#make rather than load. We want an artificial track.
|
#make rather than load. We want an artificial track.
|
||||||
makeMonoTracks(1)
|
makeMonoTracks(1)
|
||||||
|
# Zoomed in to show points stem-plot
|
||||||
do( 'Select: Start=0 End=0.003' )
|
do( 'Select: Start=0 End=0.003' )
|
||||||
do( 'ZoomSel' );
|
do( 'ZoomSel' );
|
||||||
do( 'Amplify: Ratio=3.0' )
|
do( 'Amplify: Ratio=3.0' )
|
||||||
do( 'SetPreference: Name=/GUI/SampleView Value=1 Reload=1')
|
do( 'SetPreference: Name=/GUI/SampleView Value=1 Reload=1')
|
||||||
capture( 'AutoTracks009.png', 'First_Track' )
|
capture( 'AutoTracks009.png', 'First_Track' )
|
||||||
|
# Zoomed in to show points stem-plot and then no stem plot
|
||||||
# Zoomed in to show points stem-plot and then no stem plot
|
|
||||||
def image9and10() :
|
|
||||||
image9()
|
|
||||||
do( 'SetPreference: Name=/GUI/SampleView Value=0 Reload=1')
|
do( 'SetPreference: Name=/GUI/SampleView Value=0 Reload=1')
|
||||||
capture( 'AutoTracks010.png', 'First_Track' )
|
capture( 'AutoTracks010.png', 'First_Track' )
|
||||||
|
|
||||||
#quickTest()
|
imageSet("Tracks")
|
||||||
setup()
|
track_image1and8()
|
||||||
image1()
|
track_image2and6()
|
||||||
image2()
|
track_image3()
|
||||||
image3()
|
track_image7and4and5()
|
||||||
image4()
|
track_image9and10()
|
||||||
image5()
|
|
||||||
image6()
|
|
||||||
image7()
|
|
||||||
image8()
|
|
||||||
image9and10()
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user