Easy way to play single musical notes in Python

Discussion in 'Python' started by James Harris, Nov 15, 2009.

  1. James Harris

    James Harris Guest

    Is there a simple way to play musical notes in Python? Something like

    voice.play("c4")

    to play C in octave 4 would be ideal. I included a voice parameter as
    I'd like to play proper notes, not just beeps. This is for recognition
    of pitch. For example, the program plays a note and the user tries to
    identify the note played.

    There are many options at

    http://wiki.python.org/moin/PythonInMusic

    but which to choose? They generally seem too complex. I'm looking for
    something really basic. It would help if it was cross platform and
    didn't need Tkinter as the snack library does. I presume pure Python
    is not possible.

    Any suggestions?

    James
    James Harris, Nov 15, 2009
    #1
    1. Advertising

  2. James Harris

    James Harris Guest

    On 15 Nov, 00:12, James Harris <> wrote:

    > Is there a simple way to play musical notes in Python? Something like
    >
    >   voice.play("c4")
    >
    > to play C in octave 4 would be ideal. I included a voice parameter as
    > I'd like to play proper notes, not just beeps. This is for recognition
    > of pitch. For example, the program plays a note and the user tries to
    > identify the note played.
    >
    > There are many options at
    >
    >  http://wiki.python.org/moin/PythonInMusic
    >
    > but which to choose? They generally seem too complex. I'm looking for
    > something really basic. It would help if it was cross platform and
    > didn't need Tkinter as the snack library does. I presume pure Python
    > is not possible.
    >
    > Any suggestions?


    Oh, it would be OK if the system allowed numeric pitches such as

    voice.play(440)

    to play a note at 440 Hertz.

    Anything like the above should be good enough.

    James
    James Harris, Nov 15, 2009
    #2
    1. Advertising

  3. James Harris

    r Guest

    On Nov 14, 6:21 pm, James Harris <>
    wrote:
    > Is there a simple way to play musical notes in Python? Something like
    >   voice.play("c4")



    Uhh, tksnack is pretty easy to use IMO, see this link...
    http://www.daniweb.com/code/snippet216655.html

    No python does not have access to cross platform soundcard
    capabilities built into the language. I think there is a wrapper for
    csound somewhere. But there are many 3rd party modules that do have
    capabilities to some extent. You could make calls to the underlying OS
    machinery and there is the winsound module (not exactly what you want
    though). Just look over this Google splooge...

    http://www.google.com/search?hl=en&rlz=1C1CHMI_enUS340US340&q=Python sound&aq=f&oq=&aqi=g10
    r, Nov 15, 2009
    #3
  4. James Harris

    James Harris Guest

    On 15 Nov, 05:41, r <> wrote:
    > On Nov 14, 6:21 pm, James Harris <>
    > wrote:
    >
    > > Is there a simple way to play musical notes in Python? Something like
    > >   voice.play("c4")

    >
    > Uhh, tksnack is pretty easy to use IMO, see this link... http://www.daniweb.com/code/snippet216655.html
    >
    > No python does not have access to cross platform soundcard
    > capabilities built into the language. I think there is a wrapper for
    > csound somewhere. But there are many 3rd party modules that do have
    > capabilities to some extent. You could make calls to the underlying OS
    > machinery and there is the winsound module (not exactly what you want
    > though). Just look over this Google splooge...
    >
    > http://www.google.com/search?hl=en&rlz=1C1CHMI_enUS340US340&q=Python ...


    As I say I was hoping to avoid tk. Thanks for the feedback though. If
    nothing else is suggested I'll have to try snack.

    James
    James Harris, Nov 17, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bjorn Jensen
    Replies:
    0
    Views:
    1,173
    Bjorn Jensen
    Mar 22, 2005
  2. Melody Droid
    Replies:
    0
    Views:
    316
    Melody Droid
    Jun 22, 2004
  3. Dung Ping

    Unicode for musical signs

    Dung Ping, Dec 27, 2005, in forum: HTML
    Replies:
    2
    Views:
    2,150
    Dung Ping
    Dec 27, 2005
  4. Melody Droid
    Replies:
    0
    Views:
    387
    Melody Droid
    Jun 22, 2004
  5. SteveM
    Replies:
    5
    Views:
    1,558
    Mark Rae [MVP]
    Aug 28, 2007
Loading...

Share This Page