1

I am working with a RPI Pico w, I have an analog microphone connected correctly and outputting raw audio data, how do I convert it into a file I can listen to?? I am using the micro python language.

SweetWhite
  • 61
  • 7
  • 3
    Basicly, you need mp3 encoder. Honestly, I DON'T think that Pi Pico is powerful enough to encode mp3 – Lixas Apr 13 '23 at 07:04
  • 3
    How is the microphone connected to the Pico? when you say you're outputting raw audio data, what does the code look like? we'd need more information about the hardware and software here. See [how to ask](https://stackoverflow.com/help/how-to-ask) to improve your question. – Andy Piper Apr 13 '23 at 09:26

1 Answers1

1

here is what I did to solve it:

with open("/sd/audio.wav", "wb") as f:
    print("open")
    for i in range(10000):
        sample = adc.read_u16()
        buffer.append(sample)
        if(len(buffer) == 1000):
            f.write(bytearray(buffer))
            buffer = []
            print("done")
        utime.sleep(0.001 )

you just gotta open it and write to it.

thank you!

SweetWhite
  • 61
  • 7