[Cs-dev] [OT] Python question
Date | 2010-05-29 12:46 |
From | john ffitch |
Subject | [Cs-dev] [OT] Python question |
I have a python program that was written for windows, but as far as i can tell the only windows component is the use of winsound and one line winsound.PlaySound(filename, winsound.SND_FILENAME|winsound.SND_ASYNC) It was suggested to me that on Linux one uses ossaudiodev but I cannot find an equivalent call -- remember that I do not talk python and it all looks like Egyptian to me. Any fixes, suggestions, pointers to readable documentation or... ? ==John ffitch ------------------------------------------------------------------------------ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2010-05-29 13:10 |
From | Justin Glenn Smith |
Subject | Re: [Cs-dev] [OT] Python question |
john ffitch wrote: > I have a python program that was written for windows, but as far as i > can tell the only windows component is the use of winsound and one line > > winsound.PlaySound(filename, winsound.SND_FILENAME|winsound.SND_ASYNC) > > It was suggested to me that on Linux one uses ossaudiodev but I cannot > find an equivalent call -- remember that I do not talk python and it > all looks like Egyptian to me. Any fixes, suggestions, pointers to > readable documentation or... ? > > ==John ffitch > > ------------------------------------------------------------------------------ > > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel > I found this with the help of google, though oss hardly seems a good api to be using: file='tada.wav' if platform.startswith('win'): from winsound import PlaySound, SND_FILENAME, SND_ASYNC PlaySound(file, SND_FILENAME|SND_ASYNC) elif platform.find('linux')>-1: from wave import open as waveOpen from ossaudiodev import open as ossOpen s = waveOpen('tada.wav','rb') (nc,sw,fr,nf,comptype, compname) = s.getparams( ) dsp = ossOpen('/dev/dsp','w') try: from ossaudiodev import AFMT_S16_NE except ImportError: if byteorder == "little": AFMT_S16_NE = ossaudiodev.AFMT_S16_LE else: AFMT_S16_NE = ossaudiodev.AFMT_S16_BE dsp.setparameters(AFMT_S16_NE, nc, fr) data = s.readframes(nf) s.close() dsp.write(data) dsp.close() there is also a portaudio binding for python at http://people.csail.mit.edu/hubert/pyaudio/ ------------------------------------------------------------------------------ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2010-05-29 14:06 |
From | Olivier Bélanger |
Subject | Re: [Cs-dev] [OT] Python question |
Attachments | None None |
Hi, I'm actually writing a Python module for dsp called pyo. It doesn't yet compile on Windows but on OS X and linux it works well. All info are on googlecode: http://code.google.com/p/pyo/ http://code.google.com/p/pyo/wiki/Installation http://www.iact.umontreal.ca/pyo/manual/ It's in alpha stage (first release at the end of the summer) but functional and very simple to use: from pyo import * s = Server().boot() s.start() a = SfPlayer(path=filename, speed=1, loop=True).out() It can be a good option! There is examples in the sources... Olivier
2010/5/29 john ffitch <jpff@codemist.co.uk> I have a python program that was written for windows, but as far as i |
Date | 2010-05-29 16:05 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] [OT] Python question |
Attachments | None None |
Interesting. On 29 May 2010, at 14:06, Olivier Bélanger wrote: Hi, |
Date | 2010-05-29 17:26 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] [OT] Python question |
if (sys.platform[:5] == 'linux'): os.spawnlp(os.P_NOWAIT, 'aplay', 'aplay', filename) On 29 May 2010, at 12:46, john ffitch wrote: > I have a python program that was written for windows, but as far as i > can tell the only windows component is the use of winsound and one > line > > winsound.PlaySound(filename, winsound.SND_FILENAME|winsound.SND_ASYNC) > > It was suggested to me that on Linux one uses ossaudiodev but I cannot > find an equivalent call -- remember that I do not talk python and it > all looks like Egyptian to me. Any fixes, suggestions, pointers to > readable documentation or... ? > > ==John ffitch > > ------------------------------------------------------------------------------ > > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel ------------------------------------------------------------------------------ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |