How2 make samples??

Link to good samples/soundfonts at http://wiki.linuxaudio.org/wiki/free_audio_data

Moderators: MattKingUSA, khz

Post Reply
nils
Established Member
Posts: 537
Joined: Wed Oct 22, 2008 9:05 pm
Has thanked: 35 times
Been thanked: 94 times
Contact:

Re: How2 make samples??

Post by nils »

This sounds like a relatively simple and therefore beginner friendly project, so you are in luck.

The recording process is the hardest part when it comes to sampling. That said... percussive instruments like drums and pianos are relatively simple, that is why they make great beginner projects and most if not all good "free" samples are such instruments.

Take your time and record clean notes, several variants of the same in multiple dynamic levels (aka velocity layers)
If your 7 note instrument can be played with varying strength I would expect 5 recorded samples for let's say 3 velocity layers (soft, medium, loud). That is a basic set appropriate for a quick sampling job without any experience. So in the end you will have 5 * 3 * 7 = 105 .wav files. Convert them to flac for better download size but never never never use lossy compression like mp3, ogg or opus.

How to play them now...
My clear advice is to use the sfz format. SFZ can be loaded in Linuxsampler (standalone or through Carlas internal implementation). Sadly we do not have an open source sfz sampler. But every new sampled instrument is one reason more to program one.

You will have to look that format up yourself for now. My advice would be to just write it with a text editor.

There is also "polyphone", a graphical editor. I didn't use it in recent times so I can't say anything about its state. But the scope of your project is small enough to write the text directly.

Also: there are several scripts to convert a directory of .wav files into an .sfz file. If you have a bit of python or bash experience you can write such a script in an evening yourself. (that is why there are so many scripts that do it :)

For the three octave instrument, that sounds like a real instrument so I would record more than the small amount of recorded samples mentioned above. Again, take your time, keep your recordings consistent (mic positions, room conditions like temperature and humidity, the room arrangement itself like furniture) so you can spread it over several days. You will end up with some hundred samples which are technically enough to have a respectful and quality sound.

A more difficult task is the varying length of the tones. There are several approaches here, but it comes down to having several .wav files and trigger them (sfz does all that for you) depending on the key action. For example in a piano that would be one sample of a key played and the ringing out (the natural behaviour). But for ending sooner you need to record the hammer and key alone. For example by pressing down the key silently and then record the release.

Recording and automatic sfz triggering of instrument noises (keys, bows, piano pedals, breath/wind, guitar slides) is a key step to make your instrument much better.

Another approach is to split it into the beginning of a tone, a looped section and the release sound. Finding good loop points (and preparing the recording with that in mind) is a task not to underestimate but very important for bow- or wind instruments. And recording a choir etc.

In the end it depends on your instrument. An experienced sample creator learned as well to analyse the instrument itself, from a musicians and from an instrument makers point of view. He learned to think like a recording engineer. And he learned to think like a programmer.

In the choose a good license. I have one but we'll cross that bridge when we get to it.
nils
Established Member
Posts: 537
Joined: Wed Oct 22, 2008 9:05 pm
Has thanked: 35 times
Been thanked: 94 times
Contact:

Re: How2 make samples??

Post by nils »

I looked a bit into polyphone and they have documentation.

https://polyphone-soundfonts.com/en/doc ... cratch/119
https://polyphone-soundfonts.com/en/doc ... sample/163
https://polyphone-soundfonts.com/en/doc ... rument/167

So the polyphone editor is a good starting point.
User avatar
briandc
Established Member
Posts: 1442
Joined: Sun Apr 29, 2012 3:17 pm
Location: Italy
Has thanked: 58 times
Been thanked: 28 times
Contact:

Re: How2 make samples??

Post by briandc »

I'd say Audacity is very good for recording. Make sure you check your settings (they say that 44100 or 48000, 16-bit is sufficient for us humans) and check the "options" when you export to save..selecting preferably a lossless format like flac, and the best quality when saving.

Swami or PolyPhone will import the files for making a SoundFont. BUT, these two apps may require that you save your audio samples as .wav files, so test these first.

brian
Have your PC your way: use linux!
My sound synthesis biome: http://www.linuxsynths.com
j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 357 times

Re: How2 make samples??

Post by j_e_f_f_g »

96KHz is bad for sampling. First of all, some audio interfaces actually perform better at lower sample rates. Secondly, a single pitch of nearly any musical instrument has no content above 20KHz of interest to a human. 96KHz is useful only if you're using something that implements over-sampling, which is not the case here. Otherwise, it just wastes ram and disk space.

Do sample at 24 bits rather than 16. The extra dynamic range helps avoid clipping during recording. After you've recorded the samples, also record 3 seconds of "silence" from your interface to capture any inherent background noise from your recording environment. Later, you can use this file with some "noise reduction algorithm" to remove the background noise from your other samples. Use a good algorithm (like Adobe"s Audition), rather than one like Audacity's which makes the sample sound like it was swept by a phase shifter.

Normalize the samples once before editing. After all editing is finished (except for looping), convert the still-normalized samples to 16-bit WAVE files.

Looping is done last. It requires a lot of expertise which is best left to another topic. For a successful loop, pitch and volume fluctuations must first be removed. I use Celedyne's pitch correction, and a subtle compressor (sometimes multi-band if there are timbre fluctuations, but here, Abobe Audition's auto-heal is great). When looping, use software that offers a 50% (not just 100%) crossfade algorithm, such as Waveosaur. 50% often works better.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

User avatar
sadko4u
Established Member
Posts: 986
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 359 times

Re: How2 make samples??

Post by sadko4u »

42low wrote: I agree Brian. Although for instance Ardour records great too. And easier to record and edit multiple recordings straight after each other without pauses.
Ardour is good for recording huge amount of samples with one shot. Then you can simply cut samples and define range for each sample. Then you can export all samples, again, with one shot. Also remember that simple similar work has always better performance than complex.
For example, I had to record audio files for IVR service. So for each phrase I should record several takes so the people who tuned this IVR service could select the best take for the voice menu item.
The first thing, for time economy I just recorded a girl and asked she to read all required phrases from the paper. When there were problems with diction or pronouncing, we paused recording to train the correct sounding. So for about 2 hours we've done more than 100 takes.
Then, the second my turn what I've done I've cut silence between phrases. I'ts simple scroll & cut operation.
The third turn was: I've aligned the beginning of all phrases to the grid. Simple scroll & move
The fourth turn: I've created ranges around phrases without naming it. Simple create range, scroll & move bounds.
The fifth turn: I've named all ranges according to the phrase number and take number. Simple scroll & rename range.
Then I've done post-processing: corrected frequency response, added compression, saturation and limiting.
And the final step, I've just ran 'export' and specified all created regions.
So overall montage work was done within 2-3 hours and voice tuning within 1 hour. If I did turns 2-5 for each cut at one time, I think I could spend much more time (2 or 3 days).
42low wrote: It's my philosophy to always record at high rates. I usually record on 96000hz. A daw is usually 32 floating internal already. And i usually export recordings at 24-bit.
Is that needed for samples? Or what rates are common for samples?
I don't think that sample rate greater than 48k is required. Also remember the higher sample rate is the larger is the sample library.
LSP (Linux Studio Plugins) Developer and Maintainer.
nils
Established Member
Posts: 537
Joined: Wed Oct 22, 2008 9:05 pm
Has thanked: 35 times
Been thanked: 94 times
Contact:

Re: How2 make samples??

Post by nils »

42low wrote: For a simple 7 tones instrument 105 samples could sound as very much.
So does that 7 tones instrument really has to give 100 files?
Yes. The most important type of samples is for repetitions, before taking any extra sample for dynamics or tone duration into account.
When I hear "simple 7 note instrument" I think Mallets. Note repetition is extremely common here. My number "5" was not arbitrary. It is a very common grouping. Like this:
mallets-repetition.png
mallets-repetition.png (19 KiB) Viewed 1522 times
Each of these notes needs its own recorded sample, otherwise it will sound bad.
j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 357 times

Re: How2 make samples??

Post by j_e_f_f_g »

nilshi wrote:The most important type of samples is for repetitions
What nilshi is referring to is a technique commonly called "round robin sampling". You have several samples all at a particular pitch, and all at approx the same volume. Each time the sampling engine (ie LinuxSampler) is asked to play that pitch, it plays a different sample (of that set). In this way, you get a slight variation (more human feel) each time that pitch sounds.

In an sfz file, this is implemented with the seq_length and seq_position opcodes. (Or it can be done with the random opcodes. But I prefer the more efficient seq opcodes).

For example, you have a loud snare hit, played by midi note d3.

Code: Select all

<group>
<region> sample=SnareLoud.wav key=d3
Now you record a second loud snare hit, and want to alternate the 2 samples each time midi note d3 is played. Since there are a total of 2 samples to alternate, set seq_length to 2. Then assign one sample seq_position 1, and the other sample seq_position 2.

Code: Select all

<group> seq_length=2
<region> sample=SnareLoud1.wav key=d3 seq_position=1
<region> sample=SnareLoud2.wav key=d3 seq_position=2
If you omit a seq_position, it's assumed to be 1. So the following is equivalent:

Code: Select all

<group> seq_length=2
<region> sample=SnareLoud1.wav key=d3
<region> sample=SnareLoud2.wav key=d3 seq_position=2
The old soundfont (sf2) format doesn't support round robin sampling.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

User avatar
Michael Willis
Established Member
Posts: 1451
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 163 times
Contact:

Re: How2 make samples??

Post by Michael Willis »

sadko4u wrote:Ardour is good for recording huge amount of samples with one shot.
I did it that way with the pipe chime samples that I recently posted here. With a single audio track in Ardour I started recording and then played a chime several times (letting it completely finish vibrating before striking it again), then picked up a different chime and played several times, until I had sampled all of the chimes that I wanted. After that I picked my favorite ones, cut up the Ardour region to isolate them, and then exported each one as a separate .wav file.
42low wrote:I don't use and don't know LinuxSampler
You don't have to know much about LinuxSampler to write an SFZ file. You can just use Carla, which uses LinuxSampler behind the scenes but it hides most of the madness. To start out, I wrote a minimal SFZ file in a text editor, saved, used Carla to load, tested, then modified in my text editor, saved again, reloaded in Carla, tested again, and repeated until I was happy with it.

The hardest part for me is that SFZ has a lot of different directives, and documentation is scattered around the internet, so I think it is best to find some examples to follow. I looked at SFZ files from No Budget Orchestra and Virtual Playing Orchestra to get some ideas of how they programmed some of their instruments.
42low wrote:For a simple 7 tones instrument 105 samples could sound as very much.
You don't necessarily need 105 samples for a 7 tone instrument. It depends on how many velocity layers, how many round robins, and how many distinct pitches you want to record. For example, let's say your notes are C4, D4, E4, F4, G4, A4, and B4. You might get away with only recording C4, F4, and B4. You can program the SFZ to tune them up and down to play the missing pitches. Then let's say you want 3 velocity layers (maybe p, mf, and ff) and 2x round robin. That's 3 * 3 * 2 = 18 samples. Of course it might sound better if you increase one or more of those numbers, which gives you a much higher multiple of samples that you have to record, but that's for you to decide.
j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 357 times

Re: How2 make samples??

Post by j_e_f_f_g »

Note that polyphone's "custom releases in an instrument" is achieved in sfz format via the trigger opcode. For example, you have a looped trumpet pitch at c5, and a second sample of just the release of that pitch. Specify "trigger=release" for the latter.

Code: Select all

<region> sample=TrumpetLoop.wav key=c5 ampeg_release=0.1
<region> sample=TrumpetRelease.wav key=c5 trigger=release loop_mode=one_shot ampeg_attack=.05
Nearly all the No Budget Orchestra sfz files use release samples.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

nils
Established Member
Posts: 537
Joined: Wed Oct 22, 2008 9:05 pm
Has thanked: 35 times
Been thanked: 94 times
Contact:

Re: How2 make samples??

Post by nils »

No problem. Let me suggest another course of action. I understand that you might be a bit overwhelmed here, so let's take it from the beginning. The goal is to get *something* in a reasonable amount of time, that works. For your 7 tone instrument:

Steps to a sampled instrument
  • Prepare your recording setup. Microphone, Instrument, Room, Ardour/Audacity etc.
  • Take the tone in the middle and record that, once.
  • Cut the recording so the tone starts directly at the beginning
  • Load the resulting .wav file into a program called "samplv1" https://samplv1.sourceforge.io/
  • In the samplv1 GUI set dial right next to the waveform display to the note you have recorded. If the tone you recorded is a "A3", set the field to A3 to give the sample engine a tuning root.
  • The other 6 tones and dynamic variations are done by the sampling engine through pitch shifting and simply making the playback softer and louder
Post Reply