Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8035

General • Re: Live audio processing with Raspberry Pi Pico

$
0
0
Thank you for the feedback and thinking along.

Correct me if I am wrong, but the fact that I am able to write audio recorded using INMP441 on an SD card via a Pico gives me the impression it is actually supported. I used among others the I2S library https://docs.micropython.org/en/latest/ ... e.I2S.html for this.

I was thinking something down the line of using one thread to read the audio from a mic and using another thread to simultaneously stream this input directly to an audio jack (without writing it first onto a SD card), i.e.:

Code:

from machine import I2Sfrom machine import Pinimport _threaddef button_reader_thread():    while True:        FORMAT = I2S.MONO        SCK_PIN = 19        WS_PIN = 20        SD_PIN = 21        I2S_ID = 0        audio_in = I2S(IS_ID,            sck=Pin(SCK_PIN),            ws=Pin(WS_PIN),            sd=Pin(SD_PIN),            mode=I2S.RX,            bits=16,            format=I2S.STEREO,            rate=22050,            ibuf=20000)            _thread.start_new_thread(button_reader_thread, ())while True:    FORMAT = I2S.MONO    SCK_PIN = 16    WS_PIN = 17    SD_PIN = 18    I2S_ID = 0        audio_out = I2S(IS_ID,        sck=Pin(SCK_PIN),        ws=Pin(WS_PIN),        sd=Pin(SD_PIN),        mode=I2S.RX,        bits=16,        format=FORMAT,        rate=22050,        ibuf=20000)
The above code is of course not giving the actual output of the recordings by the mic, but might give a better idea of what I am trying to achieve. Any further tips or advise are more than welcome!

Thanks!

Statistics: Posted by Taxo — Fri Mar 08, 2024 9:55 am



Viewing all articles
Browse latest Browse all 8035

Trending Articles