I am having this issue on a macOS 13.2.1 with M1 chip:
❯ python play_file.py MR1106_BlueLitMoon_Full/01_Kick.wav
||PaMacCore (AUHAL)|| AUHAL component not found.PortAudioError: Error opening OutputStream: Unanticipated host error [PaErrorCode -9999]: '' [<host API not found> error 0]
play_file.py:
importargparseimportthreadingimportsounddeviceassdimportsoundfileassfdefint_or_str(text):
"""Helper function for argument parsing."""try:
returnint(text)
exceptValueError:
returntextparser=argparse.ArgumentParser(add_help=False)
parser.add_argument(
'-l', '--list-devices', action='store_true',
help='show list of audio devices and exit')
args, remaining=parser.parse_known_args()
ifargs.list_devices:
print(sd.query_devices())
parser.exit(0)
parser=argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter,
parents=[parser])
parser.add_argument(
'filename', metavar='FILENAME',
help='audio file to be played back')
parser.add_argument(
'-d', '--device', type=int_or_str,
help='output device (numeric ID or substring)')
args=parser.parse_args(remaining)
event=threading.Event()
try:
data, fs=sf.read(args.filename, always_2d=True)
current_frame=0defcallback(outdata, frames, time, status):
globalcurrent_frameifstatus:
print(status)
chunksize=min(len(data) -current_frame, frames)
outdata[:chunksize] =data[current_frame:current_frame+chunksize]
ifchunksize<frames:
outdata[chunksize:] =0raisesd.CallbackStop()
current_frame+=chunksizestream=sd.OutputStream(
samplerate=fs, device=args.device, channels=data.shape[1],
callback=callback, finished_callback=event.set)
withstream:
event.wait() # Wait until playback is finishedexceptKeyboardInterrupt:
parser.exit('\nInterrupted by user')
exceptExceptionase:
parser.exit(type(e).__name__+': '+str(e))also I have:
>>> sd._libname
'/opt/homebrew/Caskroom/miniforge/base/envs/audio/bin/../lib/libportaudio.dylib
so issue
I am having this issue on a macOS 13.2.1 with M1 chip:
play_file.py:
also I have:
so issue