• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Creating a MIDI Sound Module with Raspberry Pi and FluidSynth

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
In this tutorial, I will explain how I created a MIDI sound module using a Raspberry Pi.
Now, before we dive in, let's first define some key terms we will be using:

Components Used

Hardware

  • Raspberry Pi 3B+ (newer models would be better but not required)
  • MIDI Keyboard Controller
  • 3.5 inch Touch Screen (optional)
  • 32GB MicroSD Card
Software

Instructions

Installing the Required Softwares


I will be assuming you have Raspberry OS installed on your microSD card already. If you haven't, I suggest checking the

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

.


On your Raspberry PI, open the terminal and enter the following commands


sudo apt-get install fluidsynth

This will install Fluidsynth.

You can now run fluidsynth on your terminal by entering the next command:


fluidsynth -a alsa -g 5 /usr/share/sounds/sf2/FluidR3_GM.sf2

What this basically does is it will start a server that will be using the General MIDI Soundfont file (FluidR3_GM.sf2) with a 5 audio gain.

Configure the MIDI Device.


Connect the MIDI Device. Open another terminal window or tab then enter the following commands:


aconnect -o

An output will appear that should contain the data we need for connection


$ aconnect -o
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 24: 'Keystation Mini 32' [type=kernel,card=2]
0 'Keystation Mini 32'
client 128: 'FLUID Synth (1233)' [type=user,pid=1233]
0 'Synth input port (1233:0)'

The values may differ on your machine. I'm using an MAudio Keystation Mini 32 Keyboard. As shown in the output, 24 is assigned to the keyboard while . client 128 is assigned to the FluidSynth application.

Connect the MIDI device to FluidSynth by running the following command:


aconnect 24:0 128:0

If there are no errors messages, you should be able to hear a sound when you play the keyboard.

Putting it all Together


Now we are able to connect FluidSynth to the keyboard, we should be making a script that will perform all the commands we did earlier.

On a text editor (like Geany), create a bash script that contains the following


#!bin/bash
fluidsynth -is --audio-driver=alsa --gain 5 /usr/share/sounds/sf2/FluidR3_GM.sf2 &

sleep 5

aconnect 24:0 128:0

Save it as let's say start_synth on an accessible directory. Make it an executable with the chmod command.


chmod +x start_synth.sh

Now whenever we need to start fluidsynth we will have to enter


./start_synth
Adding an LCD Touchscreen (Optional)



Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



To eliminate the need of a monitor and keyboard/mouse I have added a 3.5 touchscreen I got from Alibaba. For generic touch screens, more information can be found on this

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

. I suggest checking this first before purchasing one to check for compatibility.

With this setup, I have placed the start_synth file I've created on the desktop and in order to start FluidSynth I just have to double tap the script then execute to make it play. The driver also allow you to rotate the screen which also comes in handy.

To stop fluidsynth, I've created another script containing the following commands


killall fluidsynth
Conclusion


I have explained how to create a MIDI sound module using a Raspberry Pi. With this setup, you can generate high-quality instrument sounds from MIDI files and control them using your USB MIDI interface such as keyboard. This can be a great project for musicians, music producers, and anyone interested in exploring the world of MIDI music and making Raspberry PI projects as well.

Suggested Further Reading:



Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу