mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 08:33: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:
committed by
Paul Licameli
parent
aae9349f2e
commit
8ab9345268
@@ -5,113 +5,10 @@
|
||||
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
||||
# before running this script.
|
||||
|
||||
import os
|
||||
import sys
|
||||
#load and run the common core.
|
||||
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():
|
||||
do( 'Select: Start=0 End=1' )
|
||||
@@ -151,78 +48,66 @@ def addLabels2():
|
||||
do( 'Select: First=3 Last=3' )
|
||||
|
||||
|
||||
# A stero track with four labels.
|
||||
def image1() :
|
||||
def label_image1and2() :
|
||||
makeStereoTracks(1)
|
||||
addLabels()
|
||||
# A stero track with four labels.
|
||||
do( "Select: Start=0 End=0" )
|
||||
capture( 'AutoLabels001.png', 'First_Two_Tracks' )
|
||||
|
||||
# Removing a label with delete (fraud - we used split delete)
|
||||
def image2() :
|
||||
makeStereoTracks(1)
|
||||
addLabels()
|
||||
# Removing a label with delete (fraud - we used split delete)
|
||||
do( "Select: Start=44.5 End=60.5 First=2 Last=2" )
|
||||
do( "SplitDelete" )
|
||||
do( "Select: Start=0 End=0 First=0 Last=2" )
|
||||
capture( 'AutoLabels002.png','First_Two_Tracks' )
|
||||
|
||||
# Removing a label with split-delete step 1
|
||||
def image3() :
|
||||
def label_image3and4() :
|
||||
makeStereoTracks(1)
|
||||
addLabels()
|
||||
# Removing a label with split-delete step 1
|
||||
do( "Select: Start=44.5 End=60.5 First=2 Last=2" )
|
||||
capture( 'AutoLabels003.png','First_Two_Tracks' )
|
||||
|
||||
# Removing a label with split-delete step 1
|
||||
def image4() :
|
||||
makeStereoTracks(1)
|
||||
addLabels()
|
||||
# Removing a label with split-delete step 1
|
||||
do( "Select: Start=44.5 End=60.5 First=2 Last=2" )
|
||||
do( "SplitDelete" )
|
||||
capture( 'AutoLabels004.png','First_Two_Tracks' )
|
||||
|
||||
def image5() :
|
||||
def label_image5and6and7() :
|
||||
makeStereoTracks(1)
|
||||
addLabels2()
|
||||
# Nothing selected
|
||||
do( "Select: Start=0 End=0" )
|
||||
capture( 'AutoLabels005.png','First_Three_Tracks' )
|
||||
|
||||
def image6() :
|
||||
makeStereoTracks(1)
|
||||
addLabels2()
|
||||
# A range selected in label track.
|
||||
do( "Select: Start=28.5 End=58.5" )
|
||||
capture( 'AutoLabels006.png','First_Three_Tracks' )
|
||||
|
||||
def image7() :
|
||||
makeStereoTracks(1)
|
||||
addLabels2()
|
||||
do( "Select: Start=28.5 End=58.5" )
|
||||
# Deleting in label track only.
|
||||
do( "Delete" )
|
||||
do( "Select: Start=0 End=0" )
|
||||
capture( 'AutoLabels007.png','First_Three_Tracks' )
|
||||
|
||||
def image8to10() :
|
||||
def label_image8and9and10() :
|
||||
makeStereoTracks(1)
|
||||
addLabels2()
|
||||
# Select nothing in all three tracks.
|
||||
do( "Select: First=2 Last=2 Start=100 End=125" )
|
||||
do( "AddLabel" )
|
||||
do( 'SetLabel: Label=9 Text="Clap" selected=0 Start=110 End=118 ')
|
||||
do( 'Select: First=0 Last=3 Start=0 End=0')
|
||||
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( 'Select: First=0 Last=3 Start=110 End=118')
|
||||
capture( 'AutoLabels009.png','First_Three_Tracks' )
|
||||
# Delete label and from all three tracks.
|
||||
do( 'Delete' )
|
||||
capture( 'AutoLabels010.png','First_Three_Tracks' )
|
||||
|
||||
#quickTest()
|
||||
setup()
|
||||
#image1()
|
||||
#image2()
|
||||
#image3()
|
||||
#image4()
|
||||
#image5()
|
||||
#image6()
|
||||
#image7()
|
||||
image8to10()
|
||||
|
||||
imageSet("Labels")
|
||||
label_image1and2()
|
||||
label_image3and4()
|
||||
label_image5and6and7()
|
||||
label_image8and9and10()
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user