You are here

Questions on how to sample a keyboard sound

Greetings, Rui!

I have a question that is mostly directed towards your experience, not pertaining to a single one of The Q/Vee Tools, that is.

Say that I have a nice keyboard that comes with sounds and everything, but I do not want to carry it to a live performance, for some reason or another (e.g., weight, keybed size and quality, etc.). I would like to investigate sampling said keyboard (say two or three sounds) and playing the samples through more modular, lighter, open source, custom equipment (e.g., a laptop or Raspberry Pi, a MIDI master keyboard, etc.).

There are several issues, but for starters I would like to ask if you are aware of ways to sample a single sound in an automated way.

There are several issues, still. Let's assume that I am interested in a piano sound (no looping is needed) and that each note is completely dead after 15 seconds. I am also interested in velocities 31, 63, 95, 127 only, for the 88 notes of a full-size keyboard. Let's assume that I have a MIDI connection and an audio connection of my nice keyboard to my Ubuntu computer through a nice audio interface. I am interested in a soundfont as a result, e.g. an SFZ file.

Is there a tool that can automate all or most or key aspects of the process implied above? How would you go at it, using open source tools and custom scripting, maybe?

This is currently a mental exercise, as I will not be trying anything in the near future. I would really like your insight into it, though. :)


rncbc's picture

you have synthclone for exactly that prospect


Thanks, Rui! synthclone seems great! Regarding automatic loop detection, finding a start and an end sample in a WAV file that denote a section that can be looped, are you aware of either a tool or an algorithm that handles it?

rncbc's picture

none that i know about: this is rather arbitrary in the general sense and context, whatever

do you know of any "smart" software or algorithm that provides this feature? i sincerely doubt it's feasible, either musically or even scientifically or technically.
you can of course detect beat onsets, specially for high-energy transients or percussive stems or samples and that might indeed help to designate potential loop (or slice) points, but you, the human in the process, have to provide at least a fixed target or desired time-signature and a number of bars or measures in the first place anyhow--so long it goes for "automatic loop detection" :)

in summary you just don't "detect loops" but you can detect "beats" alright and proceed accordingly as for desired musical rhythm.


ps. incidentally, insider speaking re. Clip > Tempo Adjust... feature: it's been there for quite some time, though not really a definite solution for anything but an hack (i'm sure it raised too many WTF's before)... mind you, it is, has been and still is, for the whole sake of it indeed, related to this (onset/beat-detection) very topic!

so please, stay tuned, there will be news in this regard, probably targeted on this next v0.9.9 :)

Tuned I am and will be, for sure. And 0.9.9 reads as a really exciting version number. I am afraid I will be creating another itch, though.

My wording was a bit poor, I guess, but thankfully GPL-3.0 puts it articulately into C++ and calls it auto loop ( / )

Maybe it is just a paradigm shift where the mountains and the valleys are like beats or maybe it is just the time for a before-after screenshot.

I chose a specific cello sample from a cello soundfont. I just right-clicked on one of the mountains that came well before release time, roughly setting the right border of the section to be looped and ran Toolbox / Auto loop. Then the closest zero-crossing was found, I guess, for the right border (look at the "after" sample size being slightly above the "before" selected right sample) and a suitable left border was automatically found, so that the resulting loop is nice and click-free. My autocorrelation-fu is weak but I hope the above will hit home for you. :)

Due to lack of research, documentation, or experimentation from my part, I thought the above was not always working. Anyway, the case has now been presented. :)

rncbc's picture

well, all that seems that you have to set a start (left) and an end (right) loop point anyway--so, what gives so called "automatic loop detection" may i ask ?


ps. if it's all about finding the nearest zero-crossing point then i should say that samplv1 does give you that option alright and already ;)

I have to admit I set the right loop point myself, just making sure it was near the sample end but before release time. From what I could deduce graphically but not thinking much more. The only thing I did next was to click the magic button called auto loop. Then the left loop point was presented to me and the sample looped perfectly. Zero-crossing or cross-fading notions would be uneducated guesses from my part and require some salt. :) It plays well, which is important, so I could come back with more info, if I have the time to investigate the code more thoroughly, or ask the developer even.

Edit: describes a technique as well, together with some motivation and explanation. The dead site is the reason for the cached link.

rncbc's picture

as said earlier it seems that you must suggest the loop points in the first place and in any case; and the "software" will try to find the nearest zero-crossing point with a similar slope in an attempt to minimize clicks and pops on the (both) edges of the loop--something that samplv1 does as well as cross-fading as options..

note that (my) counter-argument is about finding loop points just auto-magically ... :)


Add new comment