[music-dsp] Mixing 2 or more sound signals together
rbencina at iprimus.com.au
Fri Mar 12 22:23:07 EST 2004
> > You often have to string together several integer opcodes to get the
> > same-quality result as a single float opcode-- On modern CPU's, integer
> > will likely run slower than the simpler and easier-to-write float
> Where should the conversion from 16-bit int to 32-bit float take place
> At sample load time, or as samples are processed? (ie, convert int to
> for each sample as it's processed?)
> I'm basically after the most efficient way to do it.
This is a case where memory efficiency may come into play. Some people will
say "RAM is cheap", however memory bandwidth can be a major bottle neck on
modern systems. Storing the samples in RAM as 16 bit and loading them into
floating point registers won't cost you much (if anything). So if you're
dealing only with 16 bit samples that's a good option. On the other hand, if
you have a number of different sample formats to deal with it might be
easier to store them all in RAM as floating point so that only your sample
loading code needs to know about different formats.
Btw. Converting from float to int is often not so cheap, you'd do well to
look around the net for some efficient solutions if you need to do that.
More information about the music-dsp