Edit Audio Using Python?

Discussion in 'Python' started by Ultrus, Jun 20, 2007.

  1. Ultrus

    Ultrus Guest

    Hello Python Gurus,
    I picked up a book the other day on Python programming. Python rocks!
    I'm learning Python as I want to call upon it to handle some intensive
    tasks from PHP/web server.

    The top goal right now is automating audio editing using Python. Is it
    possible? I was able to do this directly through php, but it was
    reaaaallllyyyyy slowwwwwwww. PHP is not designed for that sort of
    thing.

    So far I googled the Snack Sound Toolkit at http://www.speech.kth.se/snack/
    .. It seems to have potential, but is very limited, and has not been a
    very active project lately from what I can tell. I'm not sure I can
    use it without learning C or C++ to make it do what I want (fading
    ends, appending - there but not working?, mixing). It may work once I
    learn more about it.

    Do you know of any other modules, scripts, or whatnot that allows for
    fast .wav audio editing from a Python script (not through a visual
    interface)? Would it be better to start from scratch?

    Thank you much for the advise :)
    Ultrus, Jun 20, 2007
    #1
    1. Advertising

  2. Ultrus

    Ultrus Guest

    Ultrus, Jun 20, 2007
    #2
    1. Advertising

  3. Ultrus

    Guest

    On Jun 20, 12:21 pm, Ultrus <> wrote:
    > Ah! I found this on the official website:http://www.python.org/doc/1.5.2p2/lib/module-audioop.html
    >
    > That should keep me occupied. If you think of anything interesting
    > however, I would be happy to know. :)


    I think you'll find that you have to put a lot of pieces together
    to manipulate audio -- it's all there, but it's not straightforward.

    I did it in my "skimpygimpy" audio components, which may help
    (especially
    if you ignore the stranger parts where I went off the deep end).

    Start by looking at the "waveTools.toneFile()" method, which, I think,
    writes out a wave file containing "concert A".

    http://skimpygimpy.sourceforge.net -- follow link to downloads...

    -- Aaron Watters

    ===
    an apple every 8 hours
    will keep 3 doctors away. -- kliban
    , Jun 20, 2007
    #3
  4. Ultrus

    Ultrus Guest

    Aaron,
    Thanks for sharing this!

    > I think you'll find that you have to put a lot of pieces together
    > to manipulate audio -- it's all there, but it's not straightforward.


    The challenge of building something unique makes it more worth while.

    > I did it in my "skimpygimpy" audio components, which may help
    > (especially
    > if you ignore the stranger parts where I went off the deep end).


    Sweet program. I wish I had access to it on websites where I can never
    seem to read the captcha letters.

    The waveTools are VERY helpful! My biggest wall was getting samples
    from audio files. Your scripts go beyond that. I'll play with the
    scripts once I know a bit more on Python, and send you an update if I
    expand upon it.

    Thank you
    Ultrus, Jun 21, 2007
    #4
  5. Ultrus

    Ultrus Guest

    Thanks to Aaron, I was able to read and write audio data using
    Python's wave module. Trying to better understand the data I'm looking
    at, what does each element of the frame represent, and how do I
    convert a sample ranging from -32,768 to 32,768 back to a frame set
    like below?

    When using a 16 bit mono wav file, reading a frame of audio produces 2
    numbers like this:

    import wave
    file = wave.open("myWave.wav")
    frame = file.readframes(1) #read first frame
    file.close
    #ord(frame[0]) = 0 to 256, ord(frame[1]) = 0 to 256,
    #possible max of 65,536, or sample with range of -32,768 to 32,768
    Ultrus, Jun 29, 2007
    #5
    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. San Diego Guy
    Replies:
    0
    Views:
    531
    San Diego Guy
    Aug 7, 2003
  2. Schultz
    Replies:
    3
    Views:
    544
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Feb 14, 2005
  3. =?Utf-8?B?a2Vu?=
    Replies:
    1
    Views:
    10,309
    Wiktor Zychla [C# MVP]
    Jan 23, 2006
  4. aeonsun
    Replies:
    2
    Views:
    416
    Luc The Perverse
    Mar 11, 2007
  5. sick dick
    Replies:
    0
    Views:
    382
    sick dick
    Apr 3, 2006
Loading...

Share This Page