You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple question and would like to come to an understanding to see if my plan will work. I am looking to use a Raspberry Pi Pico to get ADC data from this electret microphone device. I plan to capture this ADC data with a known sampling rate and send it to a computer, so that I can use this package to convert the data into an audio file.
So the computer script would look something like this:
import soundfile as sf
# Use some communication method with the Pico to get a list of ADC values
data = [] # list of ADC values from 0 to 65535
sf.write("audio.wav", data, samplerate=44100)
I am wondering if this will work or if there is something more. I read in the docs that a one dimensional data list can create a mono file, but I am not sure what that means. Could someone provide some feedback on this topic? Will it work as is?
The text was updated successfully, but these errors were encountered:
It will work, but you will have to set the data format manually, probably format='RAW' and subtype='PCM_16', and you need to supply the data as an int16 numpy array, and shift the values to go from -32768...32767 instead of 0...65536 (numpy.asarray(numpy.array(data) - 2**16), dtype='int16') should do the trick).
@bastibe I appreciate the response, and I'll be sure to give this a try in the coming weeks!
@RonaldAJ I'm using the Raspberry Pi Pico just as a means of getting data. Soundfile will be used on a windows 10 computer or a Linux based Rapberry Pi.
I have a simple question and would like to come to an understanding to see if my plan will work. I am looking to use a Raspberry Pi Pico to get ADC data from this electret microphone device. I plan to capture this ADC data with a known sampling rate and send it to a computer, so that I can use this package to convert the data into an audio file.
So the computer script would look something like this:
I am wondering if this will work or if there is something more. I read in the docs that a one dimensional data list can create a mono file, but I am not sure what that means. Could someone provide some feedback on this topic? Will it work as is?
The text was updated successfully, but these errors were encountered: