29-miniorgan
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
README This sample is a simple monophonic mini organ. You have to attach an USB PC keyboard to your Raspberry Pi to use it. The output signal is available on the 3.5mm headphones jack. If you have a MIDI keyboard with USB interface, you can also use it to play. It has to support the USB Audio Class MIDI device specification. This sample does not support the MIDI velocity parameter. Because this sample is enabled for USB plug-and-play, an USB (MIDI) keyboard can be attached or removed at any time while or before the system is running. It will be detected automatically and can be used, if it is attached. On the Raspberry Pi 1-3 and Zero the system option USE_USB_SOF_INTR should be defined in the file include/circle/sysconfig.h to use this sample program. You can also attach a serial MIDI interface to your Raspberry Pi (31250 Baud). The MIDI input data has to be feeded to GPIO15 (Broadcom numbering) at 3.3V level. Because the MIDI standard uses a current loop, you need a converter circuit. Serial MIDI input is enabled, if an other keyboard is not attached. The MIDI output is not used by this sample. The mini organ uses the PWM sound device to generate a square wave of the required frequency for about one octave (note C3 to C4). A more complex sound synthesis using the CPWMSoundBaseDevice class should be possible. This sample can be built to be used with an I2S sound device too. It has been tested with PCM5102A and PCM5122 DACs. You have to enable the #define USE_I2S in the file miniorgan.h before building to use this. The DAC has to be connected to GPIO18 (BCK), 19 (LRCK) and 21 (DATA, Broadcom numbering). For I2S operation with a PCM5122-based sound device you may have to set the I2C slave address of the DAC too. By default the addresses 0x4C and 0x4D will be auto-probed. This sample can be built to be used with a HDMI display with audio support too. You have to enable the #define USE_HDMI in the file miniorgan.h before building to use this. You may notice a delay between pressing a key and the start of the tone. This latency is caused by the hardware and cannot be eliminated. The PC keyboard mapping is as follows: +--------+ |Key Note| +--------+ +-----+-----+ +-----+-----+-----+ |S C#3|D D#3| |G F#3|H G#3|J A#4| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+-----+ |Z C3 |X D3 |C E3 |V F3 |B G3 |N A4 |M B4 |, C4 | +-----+-----+-----+-----+-----+-----+-----+-----+ The inscription of the keyboard may vary, but the physical position of the piano keys is the same on all keyboards. Using this scheme you should be able to find them.