That's because you are comparing asking ChatGPT to write full code to searching for a question on Stack Overflow and adapting their answer (which is comparing apples and oranges).
Try using ChatGPT like you use Stack Overflow instead (i.e. the question is "How would I record an audio stream to disk in Python" rather than "write me an application / function which...").
As an aside, try "How would I record an audio stream to disk in Python"" in both GPT4 and searching for an answer on Stack Overflow and see what has the better answer! (Clue: GPT4, and if you don't like GPT4's answer just ask it to clarify/change it)