Samples
1. Fluidsynth
- Fluidsynth is a real-time software synthesizer, which uses so-called SoundFont files to produce sound. 'SoundFont' is a file format (and a specification), originally created by Creative Labs and E-mu Systems, and it is used to store and play audio samples. Since version 2.0, it became an open format, and the specification was released to the public.
- You can start fluidsynth from the command line if you give it a soundfont file as an argument (e.g. "fluidsynth piano.sf2"). When you do this, you will get a new prompt, in which you can enter fluidsynth commands. To see the available commands, type "help help", and choose one of the available help topics. Then type "help " to see the commands. There are commands to load/unload soundfonts, commands to send midi messages, commands to route midi messages etc.
- If you just want to play a midi file with fluidsynth, you can invoke it like this: "fluidsynth -ni ". The "-n" option disables the midi input port (we don't need it), and the "-i" option disables the interactive input of fluidsynth (the fluidsynth command promp). Other important options are "-a" and "-m", to choose the audio and midi driver to use (e.g. "-a jack", "-a alsa" (is default), "-m alsa_seq"). If you connect to jack, you can use the "-j" option to attempt to connect the jack outputs to the physical ports.
- You can find a big collection of soundfonts on 'www.hammersound.net'. They are often compressed with the 'sfArk' compression program. You can find a decompression program for linux on 'www.melodymachine.com' (This will only decompress sfArk V2 files). Sometimes files can be compressed with the 'sfPack' program as well. There is no linux version of this program, but you can still use the windows version with 'wine' (download the sfPack zip file from http://www.personalcopy.com/sfpack.htm, put it in a new directory, run "unzip sfPack", and "wine SFPACK.EXE"). An open source compression format is also being developed and it is called CRAM (see http://swami.resonance.org).
- There is a nice GUI program for fluidsynth: Qsynth (Q for the Qt toolkit). You will see a button called "Setup" to configure the current fluidsynth 'engine'. This will open a new window with tabs to configure the audio and midi driver, and the soundfonts you want to load. If you have two soundfonts loaded, the banks of the soundfont you loaded last will take precedence over the banks of the soundfont you loaded first. You will still be able to choose banks from the first, if they don't exist in the last. If you click the "Channels" button, you will get a list of all the midi channels for your soundfont, and the bank and program numbers that are assigned to those channels. To change the sound (program) on a midi channel, you can double click on that channel in the list. This will open up a small window in which you will see all the banks and programs (with their names). Now you can select (click it once) the program you want, and click 'OK'. It is possible to have multiple fluidsynth engines running. If you want to add more engines, you can do so by clicking the green "+" sign at the bottom left.
2. Swami (Sampled Waveforms And Musical Instruments)
- Swami can be used to make new soundfonts, or to edit existing ones. It uses fluidsynth for sample playback. The author of this program is working on a new and better version of this program (planned for the end of 2008), but we'll stick to the old one for now.
- You can configure fluidsynth from the menu with 'Edit-> Preferences-> FluidSynth'. To configure the settings of fluidsynth's reverb and chorus effects, choose 'Plugins-> Fluidsynth Control'.
- To make a new soundfont, you have to choose 'File-> New' from the main menu. On the left hand side of the window you will see a folder tree, with the basic structure of the soundfont. To load new samples into the soundfont, you can right-click on the 'Samples' folder, and choose 'Load Samples'. Now you can navigate to the directory where your samples are located, and select the samples you want to import. The order in which you select them, will also determine their order within the samples directory. You can use Ctrl-click to select them one by one in any order, or shift-click to select a continuous block. Then click 'Add selected files' (or just click OK) to add them to your soundfont. Next, we can make a new instrument which will use these samples. To do this, right-click on the 'Instruments' folder, and choose 'New Instrument'. To rename the freshly made instrument, you can right-click on the instrument, and choose 'Properties'. Now we can add the samples to the instrument. You have to select the samples first (in the 'Samples' folder). Again, the order in which you select them will determine their order within the instrument. To add the samples, just right-click on the instrument, and choose 'Paste'. Now you will see a range for every sample, below the piano keyboard on the right hand side. You can change the beginning and end points of these ranges by click-dragging them, or you can set the range to one note on the keyboard with middle-click. This range determines on what notes of the keyboard you will hear your samples. The samples will be pitched up or down, depending on the note you play. If you have selected a range, you will notice a small triangle above the keyboard. This triangle determines where the 'root note' for that sample is located. The 'root note' is where you will hear the unpitched version of the sample. For keys higher up, the sample will be pitched up, and for lower keys it will be pitched down. It is usually best to put the root note somewhere in the center of your range, to reduce the amount of pitching up or down (this will make the sample sound more natural). Now that we have made our instrument, we can make a new preset which uses our instrument. To do this, right-click on the 'Presets' folder, and choose 'New Preset'. Then select the instrument(s) from the 'Instruments' folder, right-click the freshly made preset (in the 'Presets/Melodic' folder [1]), and choose 'Paste'. You will see that the preset names have two numbers in them. The first number is the bank number, the second the preset (or program) number. To change the bank and preset number, you can right-click the preset, and choose 'Properties'. When you have selected a preset, you will see a range for every instrument in that preset under the keyboard. By default, the instrument will span the whole keyboard, but you can change this by dragging the beginning and end markers.
- Underneath the main menu, there are a number of buttons which I would like to discuss now. If you hover over the buttons, you will see their names:
- "Toggle drivers on/off": You can use this button if you have changed the audio or midi drivers settings for fluidsynth in 'Preferences', and you want to reload the drivers. If the drivers are off, you won't hear any sound.
- "View generator values": this is the first of four buttons that switch the view in the bottom part of the window. With this button, you will get an overview of all the generator values. You can have different generator settings for every instrument in a preset, and for every sample in an instrument. In addition, you can make a global zone in a preset (select the preset, right-click it, and choose 'Global Zone'). When you change the generators for the global zone, it will effect all the instruments in that preset.
- "Set generator values": now you will see sliders with which you can change the parameters of the generators. There are four tabs for the generators: "Pitch/Effects" (tuning, filter, reverb, chorus, panning), "Vol Envelope" (volume/amplitude envelope), "Mod Envelope" (modulation envelope), and LFO's (modulation LFO, vibrato LFO). I will not discuss these parameters in detail. But because they are part of the soundfont specification, it should be fairly easy to find more information on the internet.
- "Set sample loop parameters": when you select this button, the selected sample will become visible in the lower part of the window. Just above the sample view, you will see the word "loop:", and to the right of it a drop down list, from which you can select one of the three looping modes: "Single Shot" (no looping), "Continuous", and "Until Release" (loop stops when you release the key). To the right of the drop down list, there are two input fields, that show the start and end point of the loop. The first value is positive (relative to the start of the sample), the second negative (relative to the end). Further to the right, you will see the word "Sample:" with two more input fields. These determine the beginning and the end of the sample (of the part that is played). There are two green lines in the sample view, for the loop boundaries, and two red lines for the sample boundaries. You probably won't see them at first, because they are set to the extreme ends by default. These lines have a little triangle at the top, which you can drag with the mouse. If you want to zoom in or out on the sample, you can do so by shift-clicking in the sample view, and draging the mouse to the left or right of the zooming line (the first direction you choose will zoom in, the other out). The further the mouse is located from the zooming line, the faster you will zoom in or out. If you use right-click for zooming, the direction will be reversed (if you choose left or right first, you'll zoom out, if you drag to the other side, you will zoom in again).
- Then there are two buttons called "Piano mode" and "Velocity mode". If you switch to velocity mode, you will see velocity ranges, instead of the piano keyboard. You can use these ranges to layer samples within an instrument, or instruments within a preset, and let them be played at different velocities. E.g. you can record three samples of one note, with a different attacks, assign them to the same note on the keyboard, and give them different velocity ranges. When you play softly (e.g. velocity 0-30), sample one would be played, if you play normally (e.g. velocity 31-75) sample two, and if you play loud (e.g. velocity 76-127) sample three. By default these ranges span across the whole velocity range (from 0-127).
3. Linuxsampler
- The Linuxsampler project currently supports the Gigasampler format (".gig" extension). But the idea is that Linuxsampler will eventually support all common sampler formats. You could view the Linuxsampler program as a sampler backend engine, and a number of different frontends have been written to control Linuxsampler (Qsampler, Jsampler). These frontends are independent applications, and they can communicate with Linuxsampler via a network interface and with the linuxsampler control protocol (LSCP).
- Because the LSCP is a text protocol, it is possible to control Linuxsampler with text files. This makes it possible to run Linuxsampler without a GUI frontend. In fact, if you save a session from one of the available frontends, this session will be saved as a ".lscp" file. You could edit this file by hand, and send it to Linuxsampler with a command like this: 'cat session.lscp | netcat localhost 8888'. Of course, you have to startup Linuxsampler first.
- Linuxsampler is currently not installed by default on Ubuntu Studio. In fact it is not even in the normal repositories. I will give you a short description of how I did this: first install a number of dependencies 'sudo apt-get install build-essentials libasound2-dev libsqlite3-dev'. Then compile and install Linuxsampler (see chapter on compiling from source). If you used stow, and installed the package as a normal user (in the stow directory), you have to do a few extra steps after installation: 'sudo mkdir /var/lib/linuxsampler', and 'sudo linuxsampler –create-instruments-db /var/lib/linuxsampler/instruments.db'. Other programs related to Linuxsampler like Qsynth and Gigedit are in the repositories, and installed by default on Ubuntu Studio.
4. Qsampler
- Qsampler is one of the available frontends for Linuxsampler. Another frontend that is popular is called Jsampler. When you start up Qsampler, it will automatically startup linuxsampler as well. You can control how this is done with 'View-> Options-> Server' from the main menu. Normally, these settings should be ok, so I won't discuss them any further.
- The first thing you probably want to do when you started Qsampler is to configure the audio and midi devices. You can do this by clicking the 'Device configuration' button somewhere below the main menu (or press F11). This will open a new configuration window. On the left hand side, you will see a tree view, with all the devices that are defined. If you don't have any devices yet, you will just see two entries called "Audio Devices" and "Midi Devices". Let's assume we want to connect to the JACK server for audio playback, and to the alsa sequencer for midi. First of all, click on the 'Audio Devices' entry. On the top right, you will see a drop down list called "Driver", and you can select JACK from this list. A number of parameters for the jack device will become visible, such as the number of output channels, or the JACK client name. You can change them if you want, but the default values should be ok. Now you can click on the 'Create' button (bottom right) to make the new device. Now a new device will become visible under the 'Audio Devices' entry. In addition, you will see parameters for the different JACK channels, below the device parameters. You will only see the parameters for one channel at a time. You can use the drop down list next to "Channel:" to show the parameters of a different channel. One channel parameter that can be quite handy is called "JACK_BINDINGS". You can use it to automatically connect the Linuxsampler outputs to the "system:playback" input ports. Now we can go on and make a new midi device. Just select on the 'Midi Devices' entry, choose ALSA from the "Driver:" drop down list, and click the 'Create' button. Now, a new midi input for Linuxsampler is created in the ALSA sequencer. Now we have made one audio output (but with 2 channels), and one midi input port. But if you want, you can define multiple jack output ports, and multiple midi input ports. You will be able to choose one of the devices you defined, for every 'gig' file you load. If you are ready with your configuration, you can just close this window.
- The next step is loading a Gigasampler file into Linuxsampler. To do this, click the 'Add Channel' button. Again, this will open a new window, this time to configure the channel. At the top, you can choose the Linuxsampler engine to use. But currently, there is only one choice, the GIG engine. Below this you can specify the gig file itself. You can enter a filename (a pathname), or you can browse for the file if you click on the folder icon. When you have chosen the file, you will be able to select a specific instrument from that file (see "Instrument:" entry). Further below, you will see two fields in which you can select a midi input device, and an audio output device for that channel. When you are done, you can click the 'Ok' button. Now a new channel strip will become visible in the main window. The gig file will be loaded, and the progress of this will be shown in the strip. When the file is loaded completely, you can start sending midi information to the Linuxsampler input port.
5. Gigedit
- Gigedit is an editor for the Gigasampler file format. You can use it as a stand-alone program (just issue 'gigedit' command), or it can be used as a plugin that is loaded by Linuxsampler. The version supplied by Ubuntu Studio, is build without the plugin. This is a pity, because if you use the stand-alone version, you are not able to listen to your changes directly. You have to save the Gig file first, and load it in Linuxsampler to be able to hear your changes. If you have the plugin installed, you can start Gigedit from within Qsampler. On the channel strip, an extra button called "Edit" should become visible. I have had no luck with the Gigedit plugin so far (I compiled the plugin, but it didn't function for some reason), and I have not yet used it very much. But I would like to give you a short introduction, just to get you started.
- At the left hand side, you will see a field with two tabs, "Samples" and "Instruments". In the 'Samples' field, you will see a group named "Default Group". Groups are just meant as a convenient way to organize your samples. You can make new groups by right-clicking in this field, and choose 'Add Group'. To import samples to a group, you have to right-click the group, and choose 'Add Sample(s)'. You will be able to browse for the samples you want to add.
- Next, you can add these samples to particular ranges on the keyboard. First you have to make a new range. You can do so by right-clicking a particular note on the keyboard (but also above the keyboard), and choosing 'Add'. The range will span one note, but you can extend it on either side by click-dragging the start and end points of the range. If a particular range is selected (click on the range, or on the keyboard), you can add a sample to this range. I will explain how to do this now. On the right hand side, you will see a field with tabs as well. One of these tabs is called "Sample", and it has a section called "Mandatory Settings" with two entries: "Sample", and "Unity note". You will see that the "Sample" entry is initialized to "NULL". To add a sample to a range, you have to drag the sample from the left hand side (as listed under the groups) to the 'Sample' entry on the right hand side. With the "Unity note" entry you can change the root note of the sample (see Swami).
- You can layer samples on the keyboard as well. If you right-click the range above the keyboard and choose "Dimensions", you will get a small window, with an 'Add' and 'Remove' button. If you click 'Add', you will get a window called "New Dimension" with two drop down selectors. In the first one you can choose "Layer", and in the second one, you can choose how many layers you want. If you click 'Ok', you will see the layers below the keyboard. You can click on one of the layers to select it, and you can add a sample to that layer as described above. You can change the settings (the tabs on the right hand side) seperately for each range, but also for each layer. There are three check boxes above the keyboard ("Changes apply to": "all regions", "all dimension splits", "both channels") which you can use to change the settings for all regions/dimension splits/channels at once. E.g: if you change the gain of one region with the "all regions" checkbox on, the gain of all other regions will be changed as well.
- [1]
- If you make presets in the 'Percussion' folder, they will be in bank 128.