473,698 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Edit Audio Using Python?

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 :)

Jun 20 '07 #1
4 6546
Ah! I found this on the official website:
http://www.python.org/doc/1.5.2p2/li...e-audioop.html

That should keep me occupied. If you think of anything interesting
however, I would be happy to know. :)

Jun 20 '07 #2
On Jun 20, 12:21 pm, Ultrus <ownthe...@gmai l.comwrote:
Ah! I found this on the official website:http://www.python.org/doc/1.5.2p2/li...e-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 "skimpygimp y" 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.tone File()" 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 '07 #3
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 "skimpygimp y" 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

Jun 21 '07 #4
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("myWa ve.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
Jun 29 '07 #5

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

Similar topics

5
3319
by: MiLF | last post by:
Is it possible to write a Audio CD Player by using python only?
2
2496
by: Bruce Bon | last post by:
The class below is intended to play a Sun audio file (.au) in the background while the main thread, which is servicing a GUI, continues without impact. It doesn't work. For a sound file that takes 3-5 seconds to play, the main thread hangs for that long. I have run this many times, with changes in printouts and insertion of strategic sleeps to try to make sure that the player thread gives up control, but apparently the call to...
1
3025
by: Noah | last post by:
I need to record raw 8-bit mono audio from a generic sound card on MS-Windows. I need to do something like this: sound_device = open audio device buffer = sound_device.read ('1 second, 8 bit, mono, 8 KHz') process buffer If possible I would also like to experiment with sampling the raw audio in my own loop. For example, something like this: open audio device while 1:
24
1980
by: Dave Benjamin | last post by:
Guido gave a good, long interview, available at IT Conversations, as was recently announced by Dr. Dobb's Python-URL! The audio clips are available here: http://www.itconversations.com/shows/detail545.html http://www.itconversations.com/shows/detail559.html I'd like to comment on a few parts of that interview. One thing Guido mentions in his comparison of ABC (Python's predecessor) and
1
4297
by: Ron Provost | last post by:
Hello, I'm developing a piece of software to assist illiteraate adults to learn to read. I'm trying to figure out how, if possible, to make audio playback asynchrnous but still controllable. I'm using python 2.4 with pymedia on XP. I started out with the example in the tutorials section of the pymedia website. The pymedia docs imply to me that playback using Output's play() method should already be asynchronous and controllable. I...
0
1131
by: apa7hy.spam | last post by:
this message was originally posted by someone else and closed without a proper answer. i'm reposting it in hopes that someone will provide a solution. Begin Quote: "I'm attempting to play an mp3 file on OSX, but am running into some difficulty. When using py-mad and py-ao, I only get static with the following code (which is derived off another mailing that I found from
2
1598
by: andrea valle | last post by:
Dear all, I have created a large Python-based GUI project and I'd like to use it as a GUI interface for real time audio sequencing (using the SuperCollider -SC- synthesis server). Python (the client) and SC (the server) can communicate via OSC protocol (there are available implementations). SC will generate events responding to Python messages. In order to have sequencing I have to send at precise timing messages
2
2757
by: Pan Xingzhi | last post by:
Guys: Hi there. Recently I'll have to write a quite interesting program in Python on a Linux box. What I need is a function which allows the user to 'switch' the audio output from <an audio file>/<microphone>/<line in>. I'm not quite familiar with Linux programming. I've checked some python media frameworks but still need some light. Does anybody have experience on this? Thanks in advance!
5
3198
by: skip | last post by:
(I asked this on pythonmac-sig a couple days ago but got no response, so I'm casting a broader net.) Can I easily control audio record/playback from Python on my Mac? I know zip about audio recording or about Apple APIs via Python. Pointers to simple examples would be much appreciated. Thanks, Skip
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.