hi,
do you know the command to get acces to the sound-card, not the PC-Speaker.
I would like to play a specific note.
regards,
franz
hi,
do you know the command to get acces to the sound-card, not the PC-Speaker.
I would like to play a specific note.
regards,
franz
wx.Sound()
- Josiah
Franz <franzlinux@gmx.de> wrote:
hi,
do you know the command to get acces to the sound-card, not the PC-Speaker.
I would like to play a specific note.
Josiah Carlson schrieb:
do you know the command to get acces to the sound-card, not the PC-Speaker.
I would like to play a specific note.wx.Sound()
- Josiah
Thank you so far.
My goal is to simply play a specific note. I've got this code working:
import wx
class Output_Panel_frame1(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1, style=0)
self.SetBackgroundColour("WHITE")
sound = wx.Sound('data/anykey.wav')
sound.Play(wx.SOUND_SYNC)
class MyApp(wx.App):
def OnInit(self):
x0 = 0
y0 = 0
x1 = 550
y1 = 300
frame1 = wx.Frame(None, -1, "Test", pos=(x0, y0), size=(x1, y1))
O_P_f1 = Output_Panel_frame1(frame1)
frame1.Show(True)
return True
app = MyApp(0)
app.MainLoop()
I would like to know if it is easier to give a command to the sound-card to play specific notes.
In this example I would need to collect notes and always load them into my program.
I can remember of some old Pascal-commands to get the PC-Speaker working. It was:
Sound (1000) --> played a tone
time (1000) --> for thousand milli-seconds
regards and a happy new year,
franz
Franz <franzlinux@gmx.de> wrote:
Josiah Carlson schrieb:
do you know the command to get acces to the sound-card, not the PC-Speaker.
I would like to play a specific note.
You might try http://www.mxm.dk/products/public/pythonmidi, maybe that helps.
In this example I would need to collect notes and always load them into
my program.I can remember of some old Pascal-commands to get the PC-Speaker
working. It was:Sound (1000) → played a tone
time (1000) → for thousand milli-seconds
Windows only:
import winsound
winsound.Beep(1000,1000)
Harald Stürzebecher
P.S.: It took approx. 5 min. to google for “wxpython play note” and
find http://www.daniweb.com/techtalkforums/thread34434.html. The page
lead directly to the link and the code snippet.
I agree with Harald that midi (musical instrument device interface) is
the way to go. It is the only uniform interface for sound cards that
is not hardware or operating system dependant. If you want a quick and
dirty way to play sound that will work only for the sound card in your
PC, most likely the sound card came with a command line utility that
will allow you to send frequency (note) and duration arguments to it.
Within the wxPython program you can have a Python statement to call
this external command line utility,
In addition to WinSound, Mark Hammond’s PythonWin extensions have a
win32api which includes:
Beep(freq, dur**)
Generates simple tones on the speaker.
freq : int
Specifies the frequency, in hertz, of the sound. This parameter
must be in the range 37 through 32,767 (0x25 through 0x7FFF).
dur : int
Specifies the duration, in milliseconds, of the sound.~ One value
has a special meaning: If dwDuration is - 1, the function operates
asynchronously and produces sound until called again.
Harald Stürzebecher wrote:
2006/1/1, Franz franzlinux@gmx.de:
Josiah
Carlson schrieb:Franz franzlinux@gmx.de
wrote:do you know the command to get acces to the sound-card, not the
PC-Speaker.I would like to play a specific note.
You might try http://www.mxm.dk/products/public/pythonmidi,
maybe that helps.
In
this example I would need to collect notes and always load them intomy program.
I can remember of some old Pascal-commands to get the PC-Speaker
working. It was:
Sound (1000) → played a tone
time (1000) → for thousand milli-seconds
Windows only:
import winsound
winsound.Beep(1000,1000)
Harald Stürzebecher
P.S.: It took approx. 5 min. to google for “wxpython play note” and
find http://www.daniweb.com/techtalkforums/thread34434.html.
The page
lead directly to the link and the code snippet.
thank you both, I'll work my way through it.
Ira Kaplan schrieb:
I agree with Harald that midi (musical instrument device interface) is the way to go. It is the only uniform interface for sound cards that is not hardware or operating system dependant. If you want a quick and dirty way to play sound that will work only for the sound card in your PC, most likely the sound card came with a command line utility that will allow you to send frequency (note) and duration arguments to it. Within the wxPython program you can have a Python statement to call this external command line utility,
In addition to WinSound, Mark Hammond's PythonWin extensions have a win32api which includes:
win32api <win32api.html>.Beep
*Beep(/freq//, dur/*)
Generates simple tones on the speaker.
Parameters
/freq/ : int
Specifies the frequency, in hertz, of the sound. This parameter must
be in the range 37 through 32,767 (0x25 through 0x7FFF)./dur/ : int
Specifies the duration, in milliseconds, of the sound.~ One value
has a special meaning: If dwDuration is - 1, the function operates
asynchronously and produces sound until called again.Harald Stürzebecher wrote:
2006/1/1, Franz <franzlinux@gmx.de <mailto:franzlinux@gmx.de>>:
Josiah Carlson schrieb:
> Franz <franzlinux@gmx.de <mailto:franzlinux@gmx.de>> wrote:
>>do you know the command to get acces to the sound-card, not the
PC-Speaker.
>>I would like to play a specific note.You might try http://www.mxm.dk/products/public/pythonmidi, maybe that helps.
In this example I would need to collect notes and always load them
into
my program.
I can remember of some old Pascal-commands to get the PC-Speaker
working. It was:Sound (1000) --> played a tone
time (1000) --> for thousand milli-secondsWindows only:
>>> import winsound
>>> winsound.Beep(1000,1000)Harald Stürzebecher
P.S.: It took approx. 5 min. to google for "wxpython play note" and find Sound in wxPython [SOLVED] | DaniWeb. The page lead directly to the link and the code snippet.