Skip to content

Writing Audio Output To File #65

@ghost

Description

I found this library when searching for a way to capture audio output from speakers that would happen from listening to say a song or video on the pc and send it to another pc via a file. How could I edit the callback example to write to a file because when I attempt to write to a .raw file like so,
outFile = open("rawOut.raw",mode="w")
out_data[:] = in_data
outFile.write(in_data)
I get an error,
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cffi/model.py:532: UserWarning: 'enum PaHostApiTypeId' has no values explicitly defined; guessing that it is equivalent to 'unsigned int'
% self._get_c_name())
From cffi callback <function Stream.init..callback_wrapper at 0x1068d06a8>:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pysoundcard.py", line 685, in callback_wrapper
return callback(idata, odata, _time2dict(time), status)
File "loopback.py", line 8, in callback
outFile.write(in_data)
TypeError: write() argument must be str, not numpy.ndarray
Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions