Kent Johnson wrote:

Can you say something about why you want to do this? If you are trying to turn Audacity into a programmable sound processor, you might do better with something that is designed as a library for programmatic use. Googling 'python sound library' gives some promising hints. The Snack Sound Toolkit in particular. http://www.speech.kth.se/snack/

OTOH if what you want is some kind of macro system for Audacity then this won't help.

Kent


Orri Ganel wrote:

I did some googling, and found this in the archives of this mailing list:

import os
os.system('c:\\abaqus\\5.8-14\\abaqus.exe post')

, where post was a command, *not* a file. Now, I tried something similar, since essentially what I wish to be able to do is have Audacity think I typed the 'R' key:

os.system(r'c:\progra~1\audacity/audacity.exe R')

All this managed to accomplish was Audacity opening (good) and a message from Audacity (not good):



("Could not open file: R" since i had to make it small to fit in the email message comfortably)

Any ideas on a) why this didn't work and b) what to do to make something similar work are greatly appreciated.

Thanks in advance,
Orri

--
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.


------------------------------------------------------------------------

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Actually, what I want to do is set Audacity up so that it automatically begins recording when a song plays in Windows Media Player (to begin with) and stops when the song is finished playing. I've already figured out how to force it to record and stop when I want to (though in a kind of ugly hackish way)(*), and now I'm working on learning the controls of WMP so I can test things like time left in the song, etc. I dl'ed the WMP 10 SDK but haven't really had a chance to take a thorough look at it yet, so hopefully it'll have what I need.


Cheers,
Orri

(*)
class autoRecord:
"""Uses Audacity(TM) to automatically start recording when a song
starts playing in the media player of your choice (including Launch(TM),
Realplayer(TM), Quicktime(TM), Musicmatch(TM) and Windows Media Player(TM)).
Support for more will be added as input is received.


Requirements:
- Audacity(TM) for Windows (Mac and/or Linux versions pending)
- Python 2.4 or higher
- Launch(TM),
Realplayer(TM),
Quicktime(TM),
Musicmatch(TM), or
Windows Media Player(TM)
- Windows XP Home Edition (Mac/Linux/Windows 95/98/ME/NT pending)
""" ## eventually (i hope), autoRecord will do all of the above . . .
def __init__(self):
import time
def record(self):
import os, win32api, thread, time
thread.start_new_thread(os.system,(r'c:\progra~1\audacity/audacity.exe',))
time.sleep(1)
thread.start_new_thread(win32api.keybd_event, (82,1)) ## simulates keypress 'r' (which is audacity's shortcut for recording)
thread.start_new_thread(self.stopRecord,())
def stopRecord(self):
import time, win32api
while wmp.currentMedia.duration: ## doesn't work yet, since I'm still looking into WMP controls
pass
time.sleep(2) ## makes sure all of the sound is captured by waiting a bit longer
win32api.keybd_event(83,1) ## simulates keypress 's' (which is audacity's shortcut for stopping)


aR = autoRecord()
aR.record()

--
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to