Csound Csound-dev Csound-tekno Search About

[Csnd] Play audio in python

Date2009-06-28 13:45
Fromfrancibal
Subject[Csnd] Play audio in python
Ciao a tutti,
I need always help ... (do you hate me?)

I've see that with csound in python i can create an audio file (like example
by Mr. Gogins using SoundFile, etc.), i can open, change, save, but then if
I want to play this audio file into python, without using externals like
audacity, how I can do it ? It's possible with csnd/CsoundAC modules, or I
need use somethings like winsound module of python ?

Sorry, but i will be always a beginner ...

Thanks and ciao,

fran. 

-- 
View this message in context: http://www.nabble.com/Play-audio-in-python-tp24241213p24241213.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2009-06-28 15:02
FromDavidW
Subject[Csnd] Re: Play audio in python
I use pyaudio.  See
http://sonification.com.au/sonipy/soundLow.html

D.

On 28/06/2009, at 10:45 PM, francibal wrote:

>
> Ciao a tutti,
> I need always help ... (do you hate me?)
>
> I've see that with csound in python i can create an audio file (like  
> example
> by Mr. Gogins using SoundFile, etc.), i can open, change, save, but  
> then if
> I want to play this audio file into python, without using externals  
> like
> audacity, how I can do it ? It's possible with csnd/CsoundAC  
> modules, or I
> need use somethings like winsound module of python ?
>
> Sorry, but i will be always a beginner ...
>
> Thanks and ciao,
>
> fran.
>
> -- 
> View this message in context: http://www.nabble.com/Play-audio-in-python-tp24241213p24241213.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"

________________________________________________
David Worrall.
- Experimental Polymedia:	worrall.avatar.com.au
- Sonification: www.sonifiction.com.au
- Education for Financial Independence: www.mindthemarkets.com.au





Date2009-06-28 17:25
FromMichael Gogins
Subject[Csnd] Re: Re: Play audio in python
There are several ways to play audio directly from Python.

(1) You can indeed do it using the Csound API, using a Csound
instrument that reads in the soundfile and simply sends it to the
audio output, with realtime command-line options. I have done this, it
is easy, and it works fine.

(2) In addition to Pyaudio, there are several Python extensions for
sending audio to the sound card. You can see most of them at the
Python Package Index on the Python home page or at
http://pypi.python.org/pypi?:action=browse&show=all&c=338&c=352. In
addition, there is the Snack toolkit for extending Tk with audio for
Tcl and Python at http://www.speech.kth.se/snack.

(3) You can use Python's ctypes module to access your operating system
calls for audio output -- open an audio port, set it up, and send data
to it. I haven't tried this, but I have used ctypes to query for audio
port capabilities. That worked fine, and I think output would work
fine also.

Hope this helps,
Mike

On 6/28/09, DavidW  wrote:
> I use pyaudio.  See
> http://sonification.com.au/sonipy/soundLow.html
>
> D.
>
> On 28/06/2009, at 10:45 PM, francibal wrote:
>
>>
>> Ciao a tutti,
>> I need always help ... (do you hate me?)
>>
>> I've see that with csound in python i can create an audio file (like
>> example
>> by Mr. Gogins using SoundFile, etc.), i can open, change, save, but
>> then if
>> I want to play this audio file into python, without using externals
>> like
>> audacity, how I can do it ? It's possible with csnd/CsoundAC
>> modules, or I
>> need use somethings like winsound module of python ?
>>
>> Sorry, but i will be always a beginner ...
>>
>> Thanks and ciao,
>>
>> fran.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Play-audio-in-python-tp24241213p24241213.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> "unsubscribe csound"
>
> ________________________________________________
> David Worrall.
> - Experimental Polymedia:	worrall.avatar.com.au
> - Sonification: www.sonifiction.com.au
> - Education for Financial Independence: www.mindthemarkets.com.au
>
>
>
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>


-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com