Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1251

Python • How Do I Use this Export Function?

$
0
0
I am making an audio recorder, and I need to have an export feature. I have the Audacity mod-script-pipe and I want when I run the code it exports the audio in Audacity to the date and time for the name. So far all I have is when I run the code it just pulls up the export screen, it doesn't actually export. Any ideas on how to do this?

Code:

Code:

import osimport sysif 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.  This is a good thing.")TOFILE = open(TONAME, 'w')print("-- File to which to write has been opened")FROMFILE = open(FROMNAME, 'rt')print("-- File from which to read has now been opened also\r\n")def send_command(command):    """Send a single command."""       print("Send: >>> \n"+command)    TOFILE.write(command + EOL)    TOFILE.flush()send_command("Export")

Statistics: Posted by Henrik Gill — Sun Mar 10, 2024 11:34 pm



Viewing all articles
Browse latest Browse all 1251

Trending Articles