generating audio signals

Discussion in 'Python' started by nicke, Mar 20, 2005.

  1. nicke

    nicke Guest

    I'm running linux and would like to generate specific frequencies and
    play them(in OSS) or alternatively save them as wav files, how should I
    accomplish this? Using python to play and generate is not strictly
    necessary, as long as I can invoke the command from python.
    I know for example xmms can do this, but I want a command-line only solution.

    thanks
     
    nicke, Mar 20, 2005
    #1
    1. Advertising

  2. nicke

    Alia Khouri Guest

    Alia Khouri, Mar 20, 2005
    #2
    1. Advertising

  3. On Sun, 20 Mar 2005 12:25:22 +0200, nicke <> wrote:

    >I'm running linux and would like to generate specific frequencies and
    >play them(in OSS) or alternatively save them as wav files, how should I
    >accomplish this? Using python to play and generate is not strictly
    >necessary, as long as I can invoke the command from python.
    >I know for example xmms can do this, but I want a command-line only solution.
    >

    Perhaps
    http://docs.python.org/lib/module-wave.html
    will help. I used it to create an echo effect toy for my grandson by reading existing .wav sound effect
    files and adding delayed reduced-aplitude feeback to itself and writing another file. Parameters were
    distance in feet to a reflecting wall (assuming 1000 ft/sec sound speed ;-) and relection volume factor.

    Not hard. Maybe make yourself a little utility first that will show you the specs for any .wav file (i.e.,
    sampling frequency, bytes per sample, channels, etc.) I don't recall at the moment whether you have to
    deal with signed or offset amplitude values, but it won't be hard.

    This won't play the sounds though.

    Regards,
    Bengt Richter
     
    Bengt Richter, Mar 21, 2005
    #3
  4. nicke

    Cappy2112 Guest

    >>Maybe make yourself a little utility first that will show you the
    specs for any .wav file (i.e.,
    >>sampling frequency, bytes per sample, channels, etc.)


    You can do this with one function call - wave.Wave_read.getparams()
    import wave
    wave.open("filename","b")
    wave.Wave_read.getparams()
     
    Cappy2112, Mar 21, 2005
    #4
  5. On 21 Mar 2005 11:12:38 -0800, "Cappy2112" <> wrote:

    >>>Maybe make yourself a little utility first that will show you the

    >specs for any .wav file (i.e.,
    >>>sampling frequency, bytes per sample, channels, etc.)

    >
    >You can do this with one function call - wave.Wave_read.getparams()
    >import wave
    >wave.open("filename","b")
    >wave.Wave_read.getparams()
    >

    Yeah, I know ;-) I expected the OP to discover that really quick,
    and enjoy an early tidbit of success, maybe printing the parameters
    in a pretty format to his taste ;-)

    Regards,
    Bengt Richter
     
    Bengt Richter, Mar 22, 2005
    #5
  6. nicke

    nicke Guest

    On Tue, 22 Mar 2005 00:51:57 GMT
    (Bengt Richter) wrote:

    > On 21 Mar 2005 11:12:38 -0800, "Cappy2112" <> wrote:
    >
    > >>>Maybe make yourself a little utility first that will show you the

    > >specs for any .wav file (i.e.,
    > >>>sampling frequency, bytes per sample, channels, etc.)

    > >
    > >You can do this with one function call - wave.Wave_read.getparams()
    > >import wave
    > >wave.open("filename","b")
    > >wave.Wave_read.getparams()
    > >

    > Yeah, I know ;-) I expected the OP to discover that really quick,
    > and enjoy an early tidbit of success, maybe printing the parameters
    > in a pretty format to his taste ;-)
    >
    > Regards,
    > Bengt Richter
    > --
    > http://mail.python.org/mailman/listinfo/python-list


    already found it and used it, but did some more research...
    packed/unpacked the wave files, made programs for generating
    frequencies, playing them, saving them, and plotting the files as
    amplitude as a function of time.
     
    nicke, Mar 22, 2005
    #6
    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. Thomas

    unused bits in signals

    Thomas, Jul 6, 2003, in forum: VHDL
    Replies:
    2
    Views:
    1,098
    Mario Trams
    Jul 6, 2003
  2. Ingmar Seifert

    Delay of control signals

    Ingmar Seifert, Aug 18, 2003, in forum: VHDL
    Replies:
    0
    Views:
    1,215
    Ingmar Seifert
    Aug 18, 2003
  3. Simone Winkler

    generate testbench for array signals

    Simone Winkler, Aug 31, 2003, in forum: VHDL
    Replies:
    1
    Views:
    776
    Pedro Claro
    Sep 2, 2003
  4. aeonsun
    Replies:
    2
    Views:
    443
    Luc The Perverse
    Mar 11, 2007
  5. sick dick
    Replies:
    0
    Views:
    401
    sick dick
    Apr 3, 2006
Loading...

Share This Page