How to make Samples with just MPT?

Started by LPChip, August 07, 2006, 08:50:53

Previous topic - Next topic

LPChip

Did you knew you were able to do this? no? i though so.

What you require
A sample that is various, like a drumsample, or a sound that is quite complex. (maybe recording you saying IM GAY ) and ofcource MPT.

What you will make
The samples you can make of this are synths, but if you're really good, you could make alot of different types of samples, like a flute or a trumpet.

The procedure
Its really simple. you can create a new sample quite easilly, but if you want to get advanced, there's more coming up after.

Making the building blocks
First we will make building blocks for our sample, or better said... making other samples.

Go to the sample screen, and load a sample by choice. (drumsamples are preffered) Figure 1.

now comes the trick. Upsample for about 5 times. This will smoothen up the waveform. you should see curves. select a bunch of curves Figure 1., and trim it. Figure 2.

Now you see the trimmed selection very tiny. Zoom to fit the window. As you can see, it are alot of wave forms. If you are looking for a sinewave, try and find one in your wave pattern Figure 2., select it and trim it. Figure 3. Then set the loop points and you're ready. You can also try to make any selection, and give that a loop. It often gets nice results. Don't forget that after you're done, to check if you can downsample it, and then adjust the playkey, cus it probably is on c-1. Put it around c-4 and you're set.



You could save this to wav, and you have a new sample. However, we're going further.

Making a basedrum
If you want to make a stereo sample, you should first set the panning according to channels. This will make the editing alot easier. I would suggest to take channel 1 and 2 LEFT, 3 and 4 CENTER and 5 and 6 RIGHT.

Although you might be ready with only 2 channels, its better to be prepared (depends on ur creativity and the complexness of the upcoming sample)

Lets start with a nice basedrum.

Would be really simple. Just make a tone around C-5, give it volume command d09 and effect command E60 (anything from 20 to D0 would do)

increase the volume and effect collums if required (probably) and play it. By changing the E60 to a higher number, will increase the speed of the downtune, which gives it more a trance type of basedrum.

You could now add in another channel another sound, let it fade out on lets say... a E-4. This will give it like a techno sound.

There are alot of possibilities... just play a bit with it.

Making a flutelike tone
to create a flute is really hard, because you have to relie on your own hearing, and if the initial sample you made is different from a sine, the entire flute will sound different, and maybe not even close to a real one. However it will give great synthy results.

lets say we choose a startnote of c-6

Because a flute has depth, we begin with a c-5 to give it more EQ. We give it a low volume because we do not want it to be the main thing of the sound.

|C-501v10...

in the next channel we're going to place the main sound. a C-6 with almost full volume. However, since you have an attack, i start with v25 and do a volume up command (D30).

|C-601v25D30

There are more tones to support this one, so we're going to add another one in the next channel. a G-7 with low volume.

|G-701v04...

and to make it complete, we're putting another higher note in it.

|C-801v10...

The above will produce a simple note that will be the same after the first second. So you could render this as wave, load it into MPT, then trim it to shorter, and place a loop on it.

You can also add variations with volume and effects. I would suggest not to add stuff as vibrato's and pitching effects, since those can be done when using them.

Note that you can also take parts of different samples, and combine them into a new sample. It works great!

With big thanks to Relabsoluness for saving this post, so I could repost it.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Dj-Flo

Sweeeeeeeeet, but the sounds dont sound proffesional :P, and i like commercial sounds :( .. but in the end its Sweet. :)

LPChip

Quote from: "Dj-Flo"Sweeeeeeeeet, but the sounds dont sound proffesional :P, and i like commercial sounds :( .. but in the end its Sweet. :)

Experience is the key ;)

Note that its not illegal to add effects to it. For instance, a commercial bdrum is compressed, and only by compressing your sound, you'll get the same result.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Sam_Zen

How to create samples with OMPT if you don't have samples at all ?
Copy at random some file from your HD to the sample-directory, files like report.txt, holiday.jpg or play.dll, and rename the extension to .wav.
Import the file in OMPT. If this succeeds, than you can save the sample as a real wav-file and edit whatever you want to do with it.
0.618033988

LPChip

Or OpenMPT.exe for that matter... :)

This is a good idea indeed, but do note that you'll never get a sine which will get you the smoothest sounds.

You could ofcource download a chiptune with a sine in it and use that sine to fabricate your own sound. :)
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Sam_Zen

Quite right. This method mostly will produce rather harsh, noisy sounds to start with.
Now I wonder : what if I deliberately make a plain txt-file for this purpose, using the values of the ascii-table ?
With the order of certain characters one could make a model of a sine, I guess (or any other basic waveform by the way).
Considering the part of the ascii-table with the alphanumeric chars, it has the order : numbers, capitals, lower case.
A range of 62 values. I admit, a small resolution, but it could create a model of a sine, by just typing in increasing and decreasing orders.
A simple model with only the number-range to create a triangle form : 5-6-7-8-9-8-7-6-5-4-3-2-1-0-1-2-3-4.
Of course this is theory, it's quite some work to test this, and also the bias could be a problem.

EDIT : Case tested. I took the range of numbers and upper case. 36 characters. So I wanted to start at the middle one, the 18th, which was the "H".
So I made the string 'HIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA9876543210123456789ABCDEFG'
Then I discovered in the hex-values nr 40h missing between the 'A' and the '9'. It appeared to be the '@'. So I corrected the string as :
HIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA@9876543210123456789@ABCDEFG
and saved the txt-file. Then I renamed the file with an extension '.wav' and opened it as a sample with OMPT.
Choices in import frame. About 8 or 16 bits, and signed or unsigned. Different unbiased levels around the zero-level, but not that important.
It's only 35 steps, but once loaded and set in a loop, it plays a tone.

But this is still not an answer strictly to the question of the thread, because still external material is involved to load in OMPT.
Is OMPT capable of rendering some wav-file on its own, without any input ?
0.618033988

LPChip

Quote from: "Sam_Zen"So I corrected the string as :
HIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA@9876543210123456789@ABCDEFG
and saved the txt-file.

Interesting. What kind of waveform does this produce? Is it noise, or is it actually a sine?
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Sam_Zen

Certainly not noise, because it produces just one waveform from some regular value-order. No sine either, because the number-order of this string is just lineair up and lineair down, so the result is a single triangular waveform. Screenshot of imported MP sample :



It sounds like some high flute, when looped. I still can't explain the twitch at pos. 45 and 64, where the '@' is..
To approach a sine with this string, one would have to make a different, more logaritmic, order of the chars.
One could also make a simple noise-emulation with such a string, by shuffling the chars in a random position.

But this is of course a small range of the 8-bits resolution of the ascii-set. 37 characters out of 256.
For the highest resolution I should take char#128 as the zero-point in my waveform : ?.
One could even think of strings in Unicode, then it's 16-bits.
0.618033988

LPChip

Interesting.

This means that anyone with a bit of program skills can make a program that makes a wave form understandable by mpt.

Just write the height of the line as a byte and load it into mpt :)

I could even program something like that in php that outputs you a string to copy although I'm curious if it'd work as it probably doesn't allow a user to copy the special chars.

But even if you have qbasic from msdos, you can do this already.

just a matter of:

open FILENAME for output as #1

x = 1 'value between 0 and 255
put chr(x), #1
put chr(6), #1
put chr(80), #1
put chr(6), #1
put chr(255), #1
'... etc.
close (1)
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Sam_Zen

MPT understands the file because it can read it as a 'raw PCM' file (along with the choice 'signed/unsigned'). So only the sound-data, no headers or trailers. But, wanting to be treated as a wav-sample, the string still has to start and finish as close to the middle 'zero' as possible.
0.618033988

LPChip

I've started a small project to make a pulse based on a simple algorithm. I should be able to complete the program tonight or tomorrow (depending on how much time I have).

I'll put it online afterwards. I already have a preview window and settings to view. (very basic, but enough to get different results). Next step is to output it to a string, which is not that much of extra work. I think that I only need another 15 minutes or so. Total time on this small project would be about an hour :)
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

LPChip

Okay Peepz,

Here is the program that makes a txt file with the date of a chippy pulse waveform. Pretty configurable, but surprisingly, the result is not as diverse as I thought it would be :P

Oh well, its a simple program so here's it anyway.

http://files.lpchip.nl/temp/MPPulser.zip

I didn't build interesting features like a good looking save, cus that took too much time for what I wanted to accomplish, and even tho the preview looks fancy, its only a few lines of code, so nothing big...
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Sam_Zen

Nice experiment. Fancy preview indeed, but what's the meaning of the blue vertical line, following the mouse, on the waveform ?

Some comment :
~ Obviously a default (still greyed) pulse waveform (I would call it a square-wave, but that's another discussion).
~ So I discovered that the value Height 1 defines the left half of the wave, Height 2 defines the right half. 128 = zero level.
~ Set to the max, so H1 = 255 and H2 = 0, I saved as pulse.txt. I found the two corresponding bytes FF 00. But this was followed by two codes for a linefeed : 0D 0A. This is incorrect, because then it's not a 'raw' wav-file anymore. (only data, no commands)
~ Enabling 'mirror' shows 2 cycles of the waveform. Txt-file : FF 00 FF 00 0D 0A. Apart from the LF again, this doesn't seem very useful. One duplicate of the same. In most wav-editors the 'mirror' function means a vertical phase-swap of the wave, so in this case it could mean exchanging the values of H1 and H2.
~ Disabling mirror but setting Number of Pieces to 2, gives also two pulses, but the display of the waveform is different, and the txt-file too : FF 00 00 FF FF 00 0D 0A.
~ Setting NoP to 3, gives : FF 00 00 00 FF FF 00 00 FF FF FF 00 0D 0A
I still can't seem to lay the finger on the algoritm behind this.
0.618033988

LPChip

The mouse... I thought it looked fancy and might set Rewbs or Relabsoluness to make it in MPT :P

I was thinking about making it so that mouse in a section highlights that section and on click save that section only, but it takes too much time :P

About the comments: it is actually a pulse. A pulse is a square waveform where the left side and right side are increased/decreased.

The enabling mirror does something, and the waveforms are not identically the same. If you play a pulse at high speed in mpt with atleast having it a length of 50, you'll notice that when the 2nd tick comes the pitch shifts slightly. A known SID technique. (c64 chip) Explaination will follow below.

The algorithm is quite easy actually :P

First you give a length, say... 3.

What the algorithm does is making a pulse with 3 different sections.

In the next series of calculations, v1 = the height1 value, v2 = the height2 value.

I loop through values 1 to length (1 to 3)

In each loop, i then add to the file: v1 x char1
In each loop, i then add to the file: (length - v2 + 1) x char2

So, if i have 3, the loop outputs this

(a = char 1, z = char2)

a
zzz
aa
zz
aaa
z

which looks like azzzaazzaaaz
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Sam_Zen

It was indeed the first thing I tried with the mouse.. Selecting part of the waveform. :)
QuoteA pulse is a square waveform where the left side and right side are increased/decreased.
I agree. That's why I called the basic form with length = 1 a square wave, because then it's a 50/50 duty-cycle.

Nice explanation about the algorithm. In that way it makes sense to have a length variable.
I guess the 2nd tick seems to have a pitch shift, because it has a shorter positive phase, so more higher harmonics involvd.
Still : how about the linefeed chars ?
0.618033988