On 4/9/12 1:29 PM, Julian Schmidt wrote:
Am 09.04.2012 19:16, schrieb robert bristow-johnson:
i hadn't heard of this dev board before. at
http://www.st.com/internet/evalboard/product/252419.jsp it says that
the single unit prices is US$14.9 . is that right? that's nearly free.
yes exactly. it's cheaper than buying the cortex m4 chip alone.
and you get a stereo codec (with limiter and equalizer), a class d
amplifier, a accelerometer and a mic for free.
a programmer/debugger is also directly on the dev board (st-link via usb)
where do the software tools (the compiler/linker/loader/etc) come from?
at the moment i'm using a free toolchain consisting of
Eclipse,
ARM GCC
and the st-link-gdb server delivered with the free version of attolic
studio.
there is also a stand alone loader tool for the st-link.
i just ordered the board from Mouser. ($14.87 + cheapest USPS shipping)
i'll bother you guys later about getting the software tools and figuring
out how to do a development cycle.
regarding wavetable indexing, somewhere Julian must be converting
float to int, no? i am still convinced that the correct way to
implement it is with pure integer arithmetic.
yes, the codec expects signed 16-bit integer as input.
yeah, that's that (yet) the issue.
and for the table index I slit the phase result to an integer and a
fractional value as float (used for the interpolation)
how do you do that cleanly?
The integer arithmetic point could be valid.
i think it's the only correct way to do it. maybe not.
2 or 3 years ago i made a AVR wavetable synth and i can't remember any
fluttering overtones there. The AVR used an integer phase accumulator.
unsigned long phase_accumulator=0L, phase_increment, wavetable_index,
fractional_index;
float interp_value, waveform_out;
float wavetable[1025]; // one extra point for doing linear interpolation
// make sure that wavetable[1024] = wavetable[0]
...
wavetable_index = phase_accumulator >> 22;
fractional_index = phase_accumulator & 0x003FFFFF;
interp_value = 2.38418579101562e-07 * (float)fractional_index;
waveform_out = wavetable[wavetable_index++];
waveform_out += interp_value*(wavetable[wavetable_index] - waveform_out);
phase_accumulator += phase_increment;
can't get much simpler than that. no "if" statement and the
phase_accumulator wraps around naturally.
to implement a good NCO, you need a lot of bits in the phase
accumulator. i might think that 32 would be enough. if there are
256 points in the wavetable, then the top 8 bits go to indexing into
the wavetable and the bottom 24 bits are used for interpolation
between points. usually, for mid-quality synthesis, a 256-point
wavetable oughta be good enough, but you might want it a little
bigger. maybe 1024 points. that leaves 22 bits for the
interpolation. if you have enough points in the wavetable, then
linear interpolation oughta be good enough.
Julian, are are you willing to plop up more code? if you want, i'll
dig up a snippet for how to do this without if statements and without
floating-point phase accumulator. and with linear interpolation.
it's pretty straight forward.
If I can't get it to work that would be very welcome.
I guess I'll try to implement an integer version now, and if that
doesn't work i'll get back with more code. ;)
thanks a lot for the help so far.
FWIW.
--
r b-j r...@audioimagination.com
"Imagination is more important than knowledge."
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp