Skip to content

Latest commit

 

History

History
 
 

34-sounddevices

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README 

This sample plays a modulated 440 Hz tone via one of the following sound
devices:

* PWM sound device via the 3.5mm headphone jack
* I2S sound device using external hardware (tested with PCM5102A and PCM5122 DACs)
* HDMI sound device via sound-capable HDMI monitor (without VCHIQ, HDMI0 only)
* VCHIQ sound device via sound-capable HDMI monitor or headphone jack (optional)
* USB sound device using external hardware (supporting USB audio class spec.,
  for Raspberry Pi 4 only)

By default the sample is built without the VCHIQ option, because this requires
additional libraries, which have to be built manually. If you want this VCHIQ
sound support, first enable the line "USE_VCHIQ_SOUND = 1" in the Makefile of
the sample. Then enter the following commands from project root:

	./makeall --nosample
	cd addon/linux
	make
	cd ../vc4
	./makeall
	cd ../../sample/34-sounddevices
	make

The ready built kernel image should be in the current directory then.

To select the sound device to be used, create a file cmdline.txt on your SD card
and write one of the following lines into it:

	sounddev=sndpwm			or

	sounddev=sndi2s			or

	sounddev=sndhdmi		or

	sounddev=sndvchiq soundopt=0	or

	sounddev=sndusb

By default the sound output is done via the headphone jack (without VCHIQ
option) or via a sound-capable HDMI monitor (with VCHIQ option). Please have a
look into the file doc/cmdline.txt for more details.

For I2S operation with a PCM5122-based sound device you may have to set the
I2C slave address of the DAC in config.h. By default the addresses 0x4C and
0x4D will be auto-probed. WM8960-based I2S sound cards are also supported with
the default I2C slave address 0x1A.

USB operation (on Raspberry Pi 4 only) requires an USB audio class streaming
device. The USB sound card must be connected before the sample program is
started and must not be removed, while the program is running.