Issue passing bytes as stream to recognize song #61
-
Based on a closed issue, it looks like the ability to do this was added in version 0.0.6, but I am trying to figure out the proper way to get it to work. I have tried using both pyaudio (which returns numerous ALSA lib and jack errors, but I am still able to record and save files) as well as alsaaudio to stream audio from my USB mic to shazamio. The code I am using for pyaudio is as follows: `import asyncio async def main():
loop = asyncio.get_event_loop() In both instances, I receive an error similar to this:
Any help working out this issue would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@captain-cronch, hello, very busy week, I will try to reproduce the problem and see how to solve over the weekend! |
Beta Was this translation helpful? Give feedback.
-
I actually got the same when trying to stream the data in initially. But I did find a way to workaround the issue in case someone runs into this.
Basically the workaround for me was to convert the bytes into a wav file in memory. I wanted this so to not keep creating audio files. Chunked this out from a bigger project I'm working on so excuse the code from looking pristine! Error without the AudioSegment.from_wav:
|
Beta Was this translation helpful? Give feedback.
Without AudioSegment you just need to getvalue on the bytes: