diff --git a/README.md b/README.md index 854f914..a862888 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ MiniSynth Pi ============ -> Raspberry Pi is a trademark of Raspberry Pi Trading. +> Raspberry Pi is a trademark of Raspberry Pi Ltd. > If you read this file in an editor you should switch line wrapping on. Overview -------- -MiniSynth Pi is a polyphonic virtual analog audio synthesizer, running bare metal (without separate operating system) on the Raspberry Pi. On the Raspberry Pi 2, 3 and 4 it allows to play up to 24 polyphonic voices at a time, on the Raspberry Pi 1 only 4 voices. +MiniSynth Pi is a polyphonic virtual analog audio synthesizer, running bare metal (without separate operating system) on the Raspberry Pi. On the Raspberry Pi 2, 3, 4 and 5 it allows to play up to 24 polyphonic voices at a time, on the Raspberry Pi 1 only 4 voices. You have to attach an USB MIDI keyboard controller (which supports the USB Audio Class MIDI specification) or an USB PC keyboard to your Raspberry Pi to play on it. Alternatively you can feed serial MIDI data (at 31250 Bps) into GPIO15 (Broadcom numbering). Normally you will need some external circuit to be able to attach a device with serial MIDI interface. @@ -24,7 +24,7 @@ This version of MiniSynth Pi can be configured, so that it can be used with an e Other I2S interfaces with these DACs may be compatible too. The I2C slave address of the DAC is auto-probed (0x4C, 0x4D or 0x1A). -On the Raspberry Pi 4 and 400 also external USB sound cards can be used. +On the Raspberry Pi 4 and 400 also external USB sound cards can be used. USB sound cards are the only supported option on the Raspberry Pi 5. Please note that the included reverb effect module is experimental, because it generates some noise, when no note is played. Just leave the reverb volume (wet/dry ratio) at 0% to eliminate it, if it disturbs. @@ -55,11 +55,11 @@ When the toolchain is installed on your computer you can build MiniSynth Pi usin ./makeall clean ./makeall -The `configure` command writes a *Config.mk* file for Circle and patches Circle, so that it allows to use multiple CPU cores. "3" is the major revision number of your Raspberry Pi (1, 2, 3 or 4). The second (optional) parameter is the prefix of the commands of your toolchain and can be preceded with a path. Do not forget the dash at the end of the prefix! +The `configure` command writes a *Config.mk* file for Circle and patches Circle, so that it allows to use multiple CPU cores. "3" is the major revision number of your Raspberry Pi (1, 2, 3, 4 or 5). The second (optional) parameter is the prefix of the commands of your toolchain and can be preceded with a path. Do not forget the dash at the end of the prefix! -An optional third parameter can be appended to specify the bit size of the ARM architecture to be used as build target. It can be "32" (default) or "64" (for Raspberry Pi 3 and 4 only). +An optional third parameter can be appended to specify the bit size of the ARM architecture to be used as build target. It can be "32" (default) or "64" (for Raspberry Pi 3 and 4 only). For the Raspberry Pi 5 it must be "64" (default). -If the build was successful, you find the executable image file of MiniSynth Pi in the *src/* subdirectory with the name *kernel.img* (Raspberry Pi 1), *kernel7.img* (Raspberry Pi 2), *kernel8-32.img* (Raspberry Pi 3) or *kernel7l.img* (Raspberry Pi 4). +If the build was successful, you find the executable image file of MiniSynth Pi in the *src/* subdirectory with the name *kernel.img* (Raspberry Pi 1), *kernel7.img* (Raspberry Pi 2), *kernel8-32.img* (Raspberry Pi 3), *kernel7l.img* (Raspberry Pi 4) or *kernel_2712.img* (Raspberry Pi 5). Installation ------------ @@ -71,7 +71,7 @@ Furthermore you need the Raspberry Pi firmware. You can get it as follows: cd circle/boot make -You have to copy the three files *bootcode.bin*, *start.elf* and *fixup.dat* from the *circle/boot/* subdirectory to the FAT partition on the SD card. The Raspberry Pi 4 requires different firmware files. Please read the file *circle/boot/README* for details! +You have to copy the three files *bootcode.bin*, *start.elf* and *fixup.dat* from the *circle/boot/* subdirectory to the FAT partition on the SD card. The Raspberry Pi 4 and 5 require different firmware files. Please read the file *circle/boot/README* for details! Finally you have to copy the configuration files *cmdline.txt*, *patchN.txt* (example patches), *velocity-???.txt* (keyboard velocity curve) and *midi-cc.txt* (MIDI CC mapping) from the *config/* subdirectory to the SD card. The appropriate velocity curve file has to be renamed to *velocity.txt* to be used. You can optionally create a subdirectory */patches* and copy the example patches there, if you do not want to have them in the root directory of your SD card. @@ -79,7 +79,7 @@ If you want to use an I2S interface, you have to modify to file *cmdline.txt* on sounddev=sndi2s -If you want to use an USB sound card (on the Raspberry Pi 4 and 400 only), you have to attach it, before the system is started. The file *cmdline.txt* must contain the following options, where `soundopt=` specifies the width of one audio sample in number of bits, and must be `24` for some (especially Pro) devices: +If you want to use an USB sound card (on the Raspberry Pi 4, 400 and 5 only), you have to attach it, before the system is started. The file *cmdline.txt* must contain the following options, where `soundopt=` specifies the width of one audio sample in number of bits, and must be `24` for some (especially Pro) devices: sounddev=sndusb soundopt=16 diff --git a/configure b/configure index 95d4129..61cc278 100755 --- a/configure +++ b/configure @@ -4,14 +4,14 @@ if [[ $# != 1 && $# != 2 && $# != 3 ]] ; then echo "Usage: $0 rasppi [ prefix [ aarch ] ]" echo - echo "rasppi Major revision number of the Raspberry Pi to build for (1, 2, 3 or 4)" + echo "rasppi Major revision number of the Raspberry Pi to build for (1, 2, 3, 4 or 5)" echo "prefix Path and prefix of the toolchain commands (e.g. /path/arm-eabi-)" echo "aarch Bit size of ARM architecture (32 or 64, default 32)" exit fi -if [[ $1 != "1" && $1 != "2" && $1 != "3" && $1 != "4" ]] ; then +if [[ $1 != "1" && $1 != "2" && $1 != "3" && $1 != "4" && $1 != "5" ]] ; then echo "Invalid revision number ($1)" exit @@ -32,6 +32,10 @@ fi aarch=32 if [[ $# == 3 ]] ; then aarch=$3 +else + if [[ $1 == "5" ]] ; then + aarch=64 + fi fi if [[ $aarch != "32" && $aarch != "64" ]] ; then diff --git a/src/kernel.cpp b/src/kernel.cpp index dfdac38..9cbaf03 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -2,7 +2,7 @@ // kernel.cpp // // MiniSynth Pi - A virtual analogue synthesizer for Raspberry Pi -// Copyright (C) 2017-2022 R. Stange +// Copyright (C) 2017-2024 R. Stange // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -111,6 +111,7 @@ boolean CKernel::Initialize (void) if (bOK) { +#if RASPPI <= 4 const char *pSoundDevice = m_Options.GetSoundDevice (); assert (pSoundDevice); if (strcmp (pSoundDevice, "sndi2s") == 0) @@ -128,6 +129,9 @@ boolean CKernel::Initialize (void) { m_pSynthesizer = new CMiniSynthesizerPWM (&m_Config, &m_Interrupt); } +#else + m_pSynthesizer = new CMiniSynthesizerUSB (&m_Config, &m_Interrupt); +#endif assert (m_pSynthesizer); bOK = m_pSynthesizer->Initialize (); diff --git a/src/minisynth.cpp b/src/minisynth.cpp index f7f34f8..7d568db 100644 --- a/src/minisynth.cpp +++ b/src/minisynth.cpp @@ -2,7 +2,7 @@ // minisynth.cpp // // MiniSynth Pi - A virtual analogue synthesizer for Raspberry Pi -// Copyright (C) 2017-2023 R. Stange +// Copyright (C) 2017-2024 R. Stange // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -185,6 +185,8 @@ void CMiniSynthesizer::GlobalUnlock (void) //// PWM ////////////////////////////////////////////////////////////////////// +#if RASPPI <= 4 + CMiniSynthesizerPWM::CMiniSynthesizerPWM (CSynthConfig *pConfig, CInterruptSystem *pInterrupt) : CMiniSynthesizer (pConfig, pInterrupt), @@ -269,8 +271,12 @@ unsigned CMiniSynthesizerPWM::GetChunk (u32 *pBuffer, unsigned nChunkSize) return nResult; } +#endif + //// I2S ////////////////////////////////////////////////////////////////////// +#if RASPPI <= 4 + CMiniSynthesizerI2S::CMiniSynthesizerI2S (CSynthConfig *pConfig, CInterruptSystem *pInterrupt, CI2CMaster *pI2CMaster) @@ -356,6 +362,8 @@ unsigned CMiniSynthesizerI2S::GetChunk (u32 *pBuffer, unsigned nChunkSize) return nResult; } +#endif + //// USB ////////////////////////////////////////////////////////////////////// #if RASPPI >= 4 diff --git a/src/minisynth.h b/src/minisynth.h index c96db7e..54312de 100644 --- a/src/minisynth.h +++ b/src/minisynth.h @@ -2,7 +2,7 @@ // minisynth.h // // MiniSynth Pi - A virtual analogue synthesizer for Raspberry Pi -// Copyright (C) 2017-2023 R. Stange +// Copyright (C) 2017-2024 R. Stange // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -98,6 +98,8 @@ class CMiniSynthesizer //// PWM ////////////////////////////////////////////////////////////////////// +#if RASPPI <= 4 + class CMiniSynthesizerPWM : public CMiniSynthesizer, public CPWMSoundBaseDevice { public: @@ -115,8 +117,12 @@ class CMiniSynthesizerPWM : public CMiniSynthesizer, public CPWMSoundBaseDevice boolean m_bChannelsSwapped; }; +#endif + //// I2S ////////////////////////////////////////////////////////////////////// +#if RASPPI <= 4 + class CMiniSynthesizerI2S : public CMiniSynthesizer, public CI2SSoundBaseDevice { public: @@ -135,6 +141,8 @@ class CMiniSynthesizerI2S : public CMiniSynthesizer, public CI2SSoundBaseDevice boolean m_bChannelsSwapped; }; +#endif + //// USB ////////////////////////////////////////////////////////////////////// #if RASPPI >= 4 diff --git a/src/serialmididevice.cpp b/src/serialmididevice.cpp index e30e36c..eded3cd 100644 --- a/src/serialmididevice.cpp +++ b/src/serialmididevice.cpp @@ -2,7 +2,7 @@ // serialmididevice.cpp // // MiniSynth Pi - A virtual analogue synthesizer for Raspberry Pi -// Copyright (C) 2017-2022 R. Stange +// Copyright (C) 2017-2024 R. Stange // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -25,9 +25,9 @@ CSerialMIDIDevice::CSerialMIDIDevice (CMiniSynthesizer *pSynthesizer, CInterrupt CSynthConfig *pConfig) : CMIDIDevice (pSynthesizer, pConfig), #if RASPPI <= 3 && defined (USE_USB_FIQ) - m_Serial (pInterrupt, FALSE), + m_Serial (pInterrupt, FALSE, 0), #else - m_Serial (pInterrupt, TRUE), + m_Serial (pInterrupt, TRUE, 0), #endif m_nSerialState (0) {