The PYNQ-Z1 board contains an integrated MIC, and line out connected to a 3.5mm jack. Both these interfaces are connected to the FPGA fabric of the Zynq chip. The Microphone has a PDM interface, and the line out is a PWM driven mono output.
It is possible to play back audio from the board in a notebook, and to capture audio from other interfaces like HDMI, or a USB audio capture device. This notebook will only consider the MIC and line out interfaces on the board.
The Microphone is integrated onto the board, as indicated in the image below. The MIC hole should not be covered when capturing audio.
The Audio IP in the base overlay consists of a PDM block to interface the MIC, and an Audio Direct IP block to drive the line out (PWM). There are three multiplexors. This allows the line out to be driven from the PS, or the MIC can be streamed directly to the output. The line out can also be disabled.
In :from pynq.drivers import Audio audio = Audio()
In :# Record a sample audio.record(4) # Save recorded sample audio.save("Recording_1.pdm")
In :# Play recorded sample audio.play()
You can also playback from a pre-recorded pdm file
In :# Load a sample audio.load("/home/xilinx/pynq/drivers/tests/pynq_welcome.pdm") # Play loaded sample audio.play()