bogdan.dim...@gmail.com wrote: > I'm using pyaudio library and recieve after I run the code this message > > > Process finished with exit code -1
How did you invoke the script? When you run it from the command line, do you get a traceback? Once you have such a traceback please show it to us (use cut and paste text, not a screenshot), together with information about the operating system etc. > Here is the whole code: > > import pyaudio > import numpy as np > > p = pyaudio.PyAudio() > > volume = 0.5 # range [0.0, 1.0] > fs = 44100 # sampling rate, Hz, must be integer > duration = 10.0 # in seconds, may be float > f = 440.0 # sine frequency, Hz, may be float > > # generate samples, note conversion to float32 array > samples = (np.sin(2*np.pi*np.arange(fs*duration)*f/fs)).astype(np.float32) > > # for paFloat32 sample values must be in range [-1.0, 1.0] > stream = p.open(format=pyaudio.paFloat32, > channels=1, > rate=fs, > output=True) > > # play. May repeat with different volume values (if done interactively) > stream.write(volume*samples) > > stream.stop_stream() > stream.close() Works for me. -- https://mail.python.org/mailman/listinfo/python-list