Frequency Modulation with Analog Output #494
-
Hi, However I am having trouble as the FM maximilian function seems to only support I2SStream as an output, whereas I am looking to use an AnalogAudioStream output on gpio 25/26. Is there any way to merge these two examples or set up a function which outputs an FM analog signal after an mp3 file has been decoded? Thanks very much, and any help would be appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
I have never tried, but I would expect that you should be able to use any type of output stream. However I would have my doubts that you can reach 40khz. |
Beta Was this translation helpful? Give feedback.
-
In fact, the maximum bandwidth of a sampled waveform is determined exactly by its sampling rate; the maximum frequency representable in a sampled waveform is termed its Nyquist frequency, and is equal to one half the sampling rate. I think you would need to write the decoded data into some buffer (e.g. a CallbackBufferedStream) and use it modulate the output. |
Beta Was this translation helpful? Give feedback.
-
Hello, I am a partner on the project. I was wondering what buffer you would recommend using and how I can write decoder values to said buffer. Also, I have been having trouble finding the documentation for CallbackBufferedStream, would I just call it on the buffer itself though? Any insight is appreciated, thanks! |
Beta Was this translation helpful? Give feedback.
-
It is a Stream API over a queue: You would use this as output for the EncodedAudioStream and in the play method you would update the values every n samples where n is sampling rate osciallator / sampling rate audio to modulate the signal:
Don't forget to scale the values correctly. In your example you are using a float (in the range of -1 to 1), so you would divide the samples e.g with 327. |
Beta Was this translation helpful? Give feedback.
I have never tried, but I would expect that you should be able to use any type of output stream.
Why do you think AnalogAudioStream is not working ?
However I would have my doubts that you can reach 40khz.
What sampling rate are you using ?