But assuming I ever get this working to the point
that anyone else would want to use it, they'll
also have the same issue with latency since sound
cards no longer include real low-latency hardware
synths.
So I'm looking for a good, inexpensive way to get
low latency. The idea here is to appeal to folks
who don't already have a MIDI instrument, so it
would be nice if they didn't have to make a big
investment to see if my approach even suits them.
A low-latency freeware (or shareware with a free
trial) soft-synth would be ideal. So far, my
searches seem to come up with 'jmsynth', which is
built into other products but not (as far as I can
tell) available as a stand-alone. Any other
candidates?
Failing that, is there an inexpensive USB synth
module? Note that this doesn't need a keyboard,
just the ability to produce the sounds with low
latency. Or how about a sound card with a real
hardware synth?
Thanks, and best regards,
Bob Masta
DAQARTA v4.51
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
FREE Signal Generator
Science with your sound card!
You might want to look into fluidsynth. This is a GPL soundfont synth
that's cross-platform -- including Windows. Unfortunately in my quick
search, I can't find a downloadable executable for Windows, so you
might have to compile it.
I use it -- with no noticeable latency -- on both Linux and BeOS.
It did need some tweaking of buffer size and count on both machines
to get that, though. [The default setup on Ubuntu had a delay of over
a second...!! -- the result of a giant default buffer in the audio
driver.] I see comments on the web (google "fluidsynth latency") that
suggest 8 x 512 bytes might be good. Other posts suggest just 2 buffers,
but too few and you may get underruns.
If you're doing pitch-to-MIDI, though, aren't you going to have slight
latency problems there, anyway? (:-/)
-- Pete --
--
============================================================================
The address in the header is a Spam Bucket -- don't bother replying to it...
(If you do need to email, replace the account name with my true name.)
============================================================================
Thanks for these tips... I'll check into
fluidsynth right away!
>If you're doing pitch-to-MIDI, though, aren't you going to have slight
>latency problems there, anyway? (:-/)
That's the big question, of course, which is why I
need a low-latency synth... as it is now, the
Microsoft GS Wavetable latency totally dominates,
so it makes it hard to tell if my approach is
viable. It looks OK as far as getting a prompt
visual display of each note, but I suspect that
hearing may be a lot more sensitive to latency
than vision. I've heard that 10 msec is about the
upper limit for tolerable keyboard latency, which
is probably close to the *lowest* I'm getting now.
More work is (always) needed!
On 23 Dec, in comp.music.midi -- article <4950e2d...@news.sysmatrix.net>,
Bob Masta <NoS...@daqarta.com> wrote:
>On Mon, 22 Dec 2008 14:59:40 -0600,
>neve...@GOODEVEca.net (Pete) wrote:
>>In article <494fa046...@news.sysmatrix.net>,
>>Bob Masta <NoS...@daqarta.com> wrote:
>>>Greetings. I am playing around with pitch-to-MIDI
>>>algorithms, but the latency of the default Windows
>>>GS Wavetable synth on my development laptop is
>>>intolerable. For now I will probably just get a
>>>cheap USB-to-MIDI cable and drive my ancient
>>>DX-11... I don't care about audio quality so much
>>>at this point, as long as I can get the pitch to
>>>track.
>>>
>>>But assuming I ever get this working to the point
>>>that anyone else would want to use it, they'll
>>>also have the same issue with latency since sound
>>>cards no longer include real low-latency hardware
>>>synths.
>>>
>>>So I'm looking for a good, inexpensive way to get
>>>low latency. [....]
>>>
>>
>>You might want to look into fluidsynth. [......]
>
>>If you're doing pitch-to-MIDI, though, aren't you going to have slight
>>latency problems there, anyway? (:-/)
>
>That's the big question, of course, which is why I
>need a low-latency synth... as it is now, the
>Microsoft GS Wavetable latency totally dominates,
>so it makes it hard to tell if my approach is
>viable. It looks OK as far as getting a prompt
>visual display of each note, but I suspect that
>hearing may be a lot more sensitive to latency
>than vision. I've heard that 10 msec is about the
>upper limit for tolerable keyboard latency, which
>is probably close to the *lowest* I'm getting now.
>More work is (always) needed!
>
Either other folks are a lot more sensitive to latency than I,
or that 10 msec figure is a bit low. I'd have thought that if
that is really the value you are seeing, you wouldn't be bothered
by it at all. After all, that's about the delay you'd get from a
speaker 10 feet away (speed of sound a little over 1 ft/msec).
I gather from browsing the web, that latency in (out-of-the-box)
Windows can be something like half a second (!), which obviously
is not acceptable. Apparently something like Steinberg's ASIO
is needed to bring it down to a reasonable value.
As I said -- in a bit I snipped above -- I'm using fluidsynth on
Linux and BeOS with "no noticeable latency". In other words when
I play my keyboard I don't feel that there's anything tardy about
the sounds generated. I *can* tell that it's there if I have the
keyboard or hardware synth producing sound also, but to me it's very
slight and not at all bothersome.
To get a better idea of what the latency actually is, and what I find
noticeable, I set up a system where I can feed MIDI directly to the
software synth, and the same events delayed by an adjustable amount
to the hardware synth. Or -- alternatively -- send both channels to
hardware, so that I can tell what various latencies actually sound like.
Taking the second case first, I find that 10 msec is barely, if at all,
noticeable, even on sharp percussion. By 20 msec there is a definite
'doubling' of percussive sounds, but others just sound a bit "richer".
Even a piano doesn't really suffer -- maybe even improved a bit!
(I've seen this technique of two piano channels, one delayed, recommended
as a way of making a piano in a midifile more resonant.)
Determining the exact latency of fluidsynth was a bit harder, because
of my inability to hear small differences, but by bracketing -- finding
the delay that sounded about the same as no delay -- it seems that I'm
getting about 20-25 msec on my Linux system with default parameters.
Looking at those parameters, there are 16 buffers of 64 frames each,
playing at 44100 frames/sec. Given that the latency is a result of
the total buffer length: 16 x 64 x 1000 / 44100 = 23.2 msec
which seems to match.
I changed the number of buffers to 8 -- without seeming to cause any
hiccups -- and definitely reduced the latency, to something like 12 msec.
So I guess I'll be using that instead of the default...
Anyhow, that's my take on "no noticeable latency". I'd be interested
to hear others' differing opinions, and also what people are actually
getting under Windows (which I, as you gather, don't use).
Thanks for reporting these experiments... good
stuff! The 10 ms number is one I recalled from
the early days of hardware synths. The earliest
synths of course produced essentially *no* latency
since the keyboard directly produced the Voltwage
Controlled Oscillator (VCO) control voltage and
gated the envelope generator. (Only a single note
could be played at a time... a handicap shared by
most orchestral instruments.) But then when
computer control and polyphony came along, the
latency issue started to rear its head. 10 msec
was regarded as generally acceptable to just about
everyone for keypress-to-sound latency. That
seems to fit with your experiments with sharp
percussion.
As for Fluidsynth, I haven't gotten it running
yet. I downloaded it and took a quick look, and
realized that I would need to also grab many
megabytes of soundfont just to try it out. I did
a search for GM fonts and got bogged down trying
to find a good truly-general choice... everyone
seems to offer specialty versions. (Any
recommendations? One that has the same
instruments on the same voice numbers as the set
in Microsoft GS Wavetable would be ideal.)
I also wasn't quite sure how Fluidsynth was
supposed to work, since it did not appear to
install a driver or anything. (The "manual" was
not very helpful, alas.) I assume that after I
invoke Fluidsynth from the command line, I can
then start my own program and it will see an added
MIDI device that can be selected, but I have yet
to try it.
Instead, my cheapie USB-to-MIDI cable arrived and
I used it with my old DX-11 to find that my
pitch-to-MIDI routine has no "obvious" latency
when I whistle into it. (A whistle is a pretty
pure sine wave, which makes its pitch easy to
determine.) But it needs a bit of work to reduce
noise sensitivity, and to support human voice and
other timbres with multiple harmonics. I'm
working on that now, so it may be a while before I
get back to Fluidsynth... but I definitely intend
to do so, so your buffer-length experiences are
much appreciated.
Best regards,
>Thanks for reporting these experiments... good
>stuff! [....]
Thanks. And thanks for your comments, which I've snipped a lot of below.
>As for Fluidsynth, I haven't gotten it running
>yet. I downloaded it and took a quick look, and
>realized that I would need to also grab many
>megabytes of soundfont just to try it out. I did
>a search for GM fonts and got bogged down trying
>to find a good truly-general choice... everyone
>seems to offer specialty versions. (Any
>recommendations? One that has the same
>instruments on the same voice numbers as the set
>in Microsoft GS Wavetable would be ideal.)
You're right that tracking down a good soundfont can be a real pain.
The "GM" font I have (a pretty close subset of "GS" I think) is
"Unison.sf2". It is, however, on the gigantic side all right: 28 MB...
As far as I can tell it's freely distributable [freely available
on the web, anyway...]. I don't actually use it much except for testing,
because between my piano and HW synth I have lots of GM stuff. I'd
say it's "reasonable" though -- I like some voices (like the violin)
better than my hardware, but I find the pianos rather weak.
Another GM font I have is the 'GM11' one from my Soundblaster CD.
That's only 100KB -- so there *are* small ones! -- but it's obviously
*not* freely distributable.
The two main sources of free soundfonts seem to be hammersound.com
and personalcopy.com. They totally frustrate me, though, as a non-
Windows-user, because all the ones I think I might want are compressed
in proprietary formats (SFArk or sfpack). I WISH PEOPLE WOULDN'T DO
THAT! (:-/) There is a decompressor from *some* SFArk files available
for Linux, but the sfpack people apparently met a Boojum [and silently
vanished away] so it's essentially a Lost Format. Ugh. [Editorial:
this passion for special compression formats is rather pointless --
especially these days, with so many good, STANDARD, schemes around.
One of the fonts I looked at was actually a self-extracting zip...
that turned out to unpack into an sfpack(!), which was just a bit smaller
than the executable (1.94MB:2.02MB). When I recompressed it as a
non-self-extracting zip, it was smaller still (1.93MB)! So the
special-purpose proprietary scheme didn't save any space at all over
your basic, not-as-good-as-some-other-schemes, zip archive!]
>
>I also wasn't quite sure how Fluidsynth was
>supposed to work, since it did not appear to
>install a driver or anything. (The "manual" was
>not very helpful, alas.) I assume that after I
>invoke Fluidsynth from the command line, I can
>then start my own program and it will see an added
>MIDI device that can be selected, but I have yet
>to try it.
Can't help you there, I'm afraid. Looking at the source, it seems
to hook into the Windows MIDI system, so I suppose it probably does
what you suggest. [And its manual *is* a deficiency for sure (:-/)
-- like 90% 0f other free (and even unfree) software...]
The possibility that worries me now is that for sound *output*
fluidsynth may just connect to Windows' standard MMS, giving you
the same sort of latency as before.
>
>Instead, my cheapie USB-to-MIDI cable arrived and
>I used it with my old DX-11 to find that my
>pitch-to-MIDI routine has no "obvious" latency
>when I whistle into it.
Cool! That has to be pretty good for a pitch-to-midi algorithm.
Good luck with development.
Cheers,