473,410 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

play a midi file from the interpreter?

(How) can you make it so that a function invoked in the python interpreter can
run another program? (Like the webbrowser module does, only not with a web
browser.) If it matters the OS is Windows98 and the specific aim in mind is to
have a function that saves some data as a midi file and then causes the said
midi file to play.
Jul 18 '05 #1
3 2539
Elaine Jackson wrote:
(How) can you make it so that a function invoked in the python interpreter can
run another program? (Like the webbrowser module does, only not with a web
browser.) If it matters the OS is Windows98 and the specific aim in mind is to
have a function that saves some data as a midi file and then causes the said
midi file to play.

Use the popen() call in the os module.

regards Max M
Jul 18 '05 #2
Could you sketch me a useage example? I'm finding the documentation extremely
sparse. I've heard of 'pipes', but I don't actually know what they are.

"Max M" <ma**@mxm.dk> wrote in message news:41************@mxm.dk...
| Elaine Jackson wrote:
| > (How) can you make it so that a function invoked in the python interpreter
can
| > run another program? (Like the webbrowser module does, only not with a web
| > browser.) If it matters the OS is Windows98 and the specific aim in mind is
to
| > have a function that saves some data as a midi file and then causes the said
| > midi file to play.
|
|
| Use the popen() call in the os module.
|
| regards Max M
Jul 18 '05 #3
Elaine Jackson wrote:
Could you sketch me a useage example? I'm finding the documentation extremely
sparse. I've heard of 'pipes', but I don't actually know what they are.


Basically you just pass popen a string that looks like one typed at the
command prompt:

# untested
# (Eg. I don't know the name of your midi file player
# so I call it playmidifile.exe)

import os
midifilename = 'c:/path/to/midifile.mid'
result = os.popen('playmidifile.exe %s' % midifilename)
print result
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: cody | last post by:
Does anybody know how to play MIDI files? I do not want to use P/Invoke or DirectX. Maybe there is a free 3rd party Library but I do not know any supporting MIDI music. I tried the library "Bass"...
11
by: Kuba Araszkiewicz | last post by:
Hello! I have to write a program, which would convert midi files to notes, notes to midi files and which would make one MIDI file from two different. I'm totally lame in C (and any other...
2
by: david | last post by:
1.I am considering doing a midi file generator for my 4th year project in B.SC. 2.I would do it using c language, but i'm not sure abou t the level of difficulyt involved 3.Basically, the...
0
by: cartooncat | last post by:
I wrote following code: using System.Runtime.InteropServices; public static extern int mciSendString(string lpstrCommand, string lpstrReturnString,int uReturnLength, int dwCallback); ...
1
by: Lam | last post by:
how can I play sound file in a .aspx page written in C#? I try to use the code like the following. But whenI call the play function play("sound.wav", this.SND_ASYNC) my computer give out "be"...
1
by: tim | last post by:
Someone using Python Midi Package from http://www.mxm.dk/products/public/ lately? I want to do the following : write some note events in a midi file then after doing that, put some controllers...
20
by: Stephen Kellett | last post by:
Hi Folks, How can I play midi and/or audio files using JavaScript? I'm hoping there are some calls/APIs I can use that I am unaware of. My JavaScript book from O'Reilly seems rather lacking in...
13
by: anil.rita | last post by:
When the user chooses an AV file to play, based upon the type of file, I want to use the default installed media player to play it. I am wondering if this is a good way - any alternatives,...
26
by: Jake Barnes | last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching for "how to play a sound with Javascript". I'm somewhat suprised that the majority of entries are from the 1990s, and there are...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.