Re: [music-dsp] Playing a Square Wave

2018-06-17 Thread Theo Verelst



First, let me agree with the notion that through interference of the supersonic 
elements,
audible artifacts through reverberation can come into existence. The early reverb can 
easily transfer some energy into the audio band and the (partially non-linear) reverb tail 
of any non-dead listening space will even out frequencies (measuring supersonic components 
as well) and will easily concentrate mid-long reverb components in standing waves, which 
can be driven by higher than 20kHz harmonics as well.


Moreover, the speaker will have a big impact on the sound of the square wave: 
the long
horizontal parts will be strongly influenced by how low you sub-woofer goes and how 
straight it is, the rise time will be influenced by the amplifier, the impedance of the

tweeter and it's physical properties. In my case for instance I use a ribbon 
tweeter with
fast enough rise time very neutral amplifier, with a separation filter at 8kHz, 
so that
essentially it reproduces the top octave of the audible frequencies only. The 
mids must
be very straight to make the rest of a "perfect" input square come out your 
speakers
neutrally, which especially digitally is hard to do (the reconstruction filter 
will at
the very least show lag of phases in the mid frequency range) unless you know 
how to
prevent that.

The limiting of the frequency components in order to prevent aliasing is kind 
of needed
per the definition of the reconstruction theory, *how* you do that is of course another 
discussion. For instance you could add all harmonics with high mathematical accuracy 
according to the curve of a perfect 2 order filter, and then cut off all the harmonics
above a little under half the sampling frequency (so including natural looking phase shift 
above a certain frequency) which might look more natural.


*How* you're going to, lets say right at the output of your chosen DAC, make sure your 
digital square + DAC preparation is going to be as close to a "normally pure" square as

possible isn't really the issue, but if you do nothing but a simple curve, my 
statement
is that you might not get harmonic distortion down as far as I would deem 
needed for HiFi
response.

T.
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp



Re: [music-dsp] Playing a Square Wave

2018-06-14 Thread Sound of L.A. Music and Audio


Hi Paula and all

Am 13.06.2018 um 14:35 schrieb pa...@synth.net:

Though, remember these are mass market products, they will use the 
appropriate part for a given price point.
Right, wherey according to my exoeriences, the exisiting DACs Chips of 
the higher price reagion we have nowadays really do a very good job 
since the make use of dithering, oversamping and pre distortion to drive 
the analog AA filters perfectly. Also the chip technology progressed 
that way, that it is possible to integrate perfectly working analog 7 
pol elyptic filters into the chips leading to an incredible precision.


So it is more a question to get this out into the PCB. EMI, shielding 
and analog signal treatment is more important. If people e.g. are using 
unbalanced analog out with chinch and such, you can forget this.


But again: This only speaks for the audible spectrum where these chips 
are designed for.



Now, if you want a GORGEOUS sounding DAC, go play with a synclavier.
These are discrete DACs and sound like NOTHING I've ever heard before.. 
just utterly amazing.


Regarding the different approaches of DACs trying to overcome 
Delta-Sigma-DACs I mostly observed an increased brilliance caused by 
exactely this unintend harmonics we have, when not performing filtering 
correctly. We did a lot of research on DACs in our ultrasonic projects 
and usually THIS is the big difference, and as stated above, the 
specific way the in audible alias harmonics trigger the subsequent 
analog elektronic and mechanic makes the sound. And there is much room 
for "design" and optimization.


I very well admit and expect that people have designed nice sounding 
equipment, but this is nothing else then sound design having not much to 
do with authentic wave replaying what we need in recording cases. And 
again: The particular loudspeaker has a strong impact, when it's 
internal filters are fed with harmonics >20kHz. The parts rejected at an 
inductance will cause a ping pong reflection pattern showin up elsewhre 
and that part passed through will cause audible harmonics at all non 
linear components. Then we have saturation effects and partital movement 
of the loudspeaker membrane. Beeing involved in a project to reduce 
these artifacts be actively controlling the membrane, I observed that 
all sound of music became less harsch, up to "boring". Brilliance was lost!


So maybe an synth-DAC might be differently designed, than a HIFI-DAC 
possibly, such es a techno loudspeaker ist different from those for 
acoustical music.


Anyway: I had a look at the mentioned synclavier: It seems to have used 
a higher sample rate of 100kHz. This makes sense, when using only 16 bit 
and trying to modulate the waves like required in a synth. The higher 
the incoming material, the less artifacts you will get because of the 
resampling which is required when interplating the waves and moving the 
to another pitch. So this is clear to me that this instrument ust have 
had a better smoothed sound with eg vibrato and such..



Jürgen
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Playing a Square Wave

2018-06-14 Thread Sound of L.A. Music and Audio

Am 13.06.2018 um 15:01 schrieb Niels Dettenbach:


By theory, any square wave could be constructed by a infinite number of
(sinus) signals, while many of that images seems like produced from a finite
number of such "signal parts". this means - if i think correctly - a really
perfect square would have "infinite energy" required (pls correct me, if i'm
wrong here).


To get a good sqare, it is nearly impossible to get this by sinus 
overlay, since this does not converge well enough. You might get an 
impression here, where I show some additive synthesis:


But:

regarding the ear and hearing up to only 20kHz it is very well possible 
to synthesize a "sqare like" sound with only harmonics up to 20kHz. This 
works even better, since the filters in our system to not have to be 
neutral against the very high frequencies coming with a digital square 
wave.


so, what we hear when using real squares from a digital pin is mainly 
the summed up artifacts caused by the filters, the transmission and 
finally the loudspeakers.


What we also have to take into account when comparing waves:

Somtimes we can hear even ultrasonic waves, since they do have an impact 
on the membrane and littel bones in our ear. it is a kind of masking at 
high levels, so the sound impression is sightly different with / without 
utrasonic waves.


So in theory it should be right to generally provide frequencies of the 
real live up to 50kHz and above when replaying sound, but practically 
this required other hardware to do so.


I always recommend to limit the specttru down to 16-18kHz.

On the other hand: Feed hard squares into the filters might be used in 
sound synthesis for intended effects:


As you pointed out, more harmonics mean "more energy" and the non 
linearity and imperfectnes of all filters and systems will definitly 
cause impact on the final sound - also in der audible region.


Jürgen

___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread Ethan Duni
>The simple question that forced itself on me often, as I"m sure some can
relate,
>after having been used to all those early signal sources including a host
of analog
>synthesizers I had in the past, and a lot of music in various analog forms
from standard
>pop to G. Duke and Rose Royce to mention a few of my favorites from an
earlier era,
>is how can it be that such a simple wave like the square wave, just two
signal levels
>with a near instantaneous jump between them, can be so hard to make
digital, if you
> listen with a HiFi system and some normal musical signal discernment ?

I think this is less of a DAC issue than the various quirks of the analog
VCO designs. Like the classic function-generator style ones that start with
a sawtooth oscillator, then use comparators to generate a pulse wave,
full-wave rectifier to get triangle output, and wave shaping on triangle to
generate a sinusoidal output. Do VA people simulate these circuits
explicitly? Most of what I recall has been BLIT based stuff, or for digital
synthesis of specific waveform types the wavetable approach described by
RBJ is pretty straightforward and compelling.

For those who don't recall from undergrad EE lab:

The sawtooth oscillator is, basically, a variable current source feeding a
capacitor, which dumps when its voltage reaches a constant (say 1V). So you
get a linear rise (constant current feeding constant capacitance) and
control the frequency by altering the input current. The capacitor has to
drain through a non-zero resistor, so there is some finite discharge time
to reset, and also temperature compensation is required on the current
source, etc. You probably also put a DC-blocking cap at the output, so
there is some fixed highpass characteristic built in there (but maybe not
if this is an LFO). You can implement hard sync with another oscillator by
dumping the cap whenever the master oscillator hits some level.

To get the pulse output, you run this through a comparator circuit, with
the comparison voltage determining the pulse width (0V for square wave,
assuming a +/-1V sawtooth).

To get a triangle wave output, you full-wave rectify the sawtooth (and then
need to add another DC blocker)

To get a sinusoidal output, you use some diodes or other nonlinear
components to do an approximate instantaneous wave shaping on the triangle.

The fun bit in a modular synth is that all these synchronized outputs are
available simultaneously, and can be run through different
filter/modulation paths downstream, etc.

E



On Wed, Jun 13, 2018 at 9:06 AM, Theo Verelst  wrote:

> Neil Goldman wrote:
>
>>  > such a simple wave like the square wave, just two signal levels with a
>> near instantaneous
>> jump between them
>>
>> I think I disagree with this definition of a square wave
>>
>> Even assuming a magically perfect and noiseless analog square wave
>> generator, at the very
>> least your speaker cones can't teleport between two positions.
>>
>
> Sure, there's a lot of stuff not just happening with speakers, but with
> acoustics of
> any kind as well, always very audible.
>
> For me when I started building musical circuits of the kinds I described,
> in high school,
> there were perfect enough squares available: electronics "function
> generators" would offer near perfect square waves with rise times orders of
> magnitude faster than an audio circuit would normally require, and crystal
> oscillators would keep jitter pretty low for
> creating square tones.
>
> It's true the imperfections I mean are the "digitally created" ones, which
> includes the exact filtering in the DAC, the linearity of it, which filter
> components have been (and not been) used like for DC coupling and analogue
> (mean IIR automatically) anti-aliasing filtering. The converter chip I use
> often at the moment (a PCM5102A DAC with up to 50MHz very low jitter and
> ground separated clock) is analog filtered with a single high quality
> component analog filter, DC coupled with a very high quality OPA627 OpAmp,
> with no subsequent electrolytic capacitors in the signal path. On my big
> monitoring or studio headphones it should be able to be very accurate.
>
> It's hard to explain, but it's possible to take the given filtering inside
> a DAC (to begin with the standard "oversampling" digital one) and try to
> invert it to the extend that the streaming filter inversion allows you to
> control the signal at oversampling clock speed to some level of accuracy.
> This might cost headroom: some inversions might take a lot of amplitude
> which is lost in the out coming signal, but nevertheless there are a few
> ways to try to do this.
>
> So taking a square wave with a given limitation of zero harmonics above a
> certain frequency (like can be created with additive synthesis)
> approximating the "perfect reconstruction" at the output of the DAC
> oversampling filter output is a real possibility. Unfortunately inversion
> of such a FIR or IIR filter with near bit-accuracy
> at 

Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread Neil Goldman
>  A bandlimited squarewave of 8 kHz @ 44.1 kHz samplerate is a sinewave. 3
* 8 kHz is already outside of the bandwidth.

Well the example used was Middle C, which is 261.6 Hz. And would have 75 or
so harmonics before reaching the limit.

> This means that the basic frequency must be pretty low to get a square
wave shape.

Yeah, but that's exactly what I mean. At any frequency, you lose the upper
harmonics that make it perfectly square. So at what point do we cross the
threshold of it being square enough, or near-perfect enough. When is it
considered a square or not?

If you record that 8khz square and your result is a signal with 3
harmonics, did you not actually record a square? Record a 1hz square, it
will look square... until you zoom in far enough. You'll still get some
very tiny ripple because you only keep the highest 44k harmonics and not
all infinity harmonics. And if you don't get a ripple, you're probably
aliasing.

So my point is I think it's incorrect to assume it needs to look like a
square shape to be considered a square wave. Because no matter what, if you
zoom in enough a correct square stops looking like a square.

We can try to debate the threshold at which is looks or sounds squarey
enough, but that's more of a philosophical debate than a technical one.

Neil

On Wed, Jun 13, 2018 at 4:58 PM Uli Brueggemann 
wrote:

> 75th or 150th harmonics?
> A bandlimited squarewave of 8 kHz @ 44.1 kHz samplerate is a sinewave. 3 *
> 8 kHz is already outside of the bandwidth.
> This means that the basic frequency must be pretty low to get a square
> wave shape.
>
> - Uli
>
> 2018-06-13 20:40 GMT+02:00 robert bristow-johnson <
> r...@audioimagination.com>:
>
>>
>>
>> ---------------- Original Message 
>> Subject: Re: [music-dsp] Playing a Square Wave
>> From: "Neil Goldman" 
>> Date: Wed, June 13, 2018 11:16 am
>> To: ra...@raito.com
>> music-dsp@music.columbia.edu
>> --
>>
>> >> such a simple wave like the square wave, just two signal levels with a
>> >> near instantaneous jump between them
>> >
>> > I think I disagree with this definition of a square wave. This is what a
>> > perfect, ideal one would look like, but even in reality I don't think
>> any
>> > system (digital or analog) can exactly produce a perfect square and the
>> > infinite bandwidth it takes for the infinite number of harmonics.
>> >
>> > Even assuming a magically perfect and noiseless analog square wave
>> > generator, at the very least your speaker cones can't teleport between
>> two
>> > positions. And I'm no electrical engineer but the circuitry must also
>> have
>> > some kind of damping effect on the extreme ranges? I mean even the
>> > infinitesimally faint harmonics that will exist in the Mhz range, Ghz
>> > range, etc up to infinity.
>> >
>> > If you remove or dampen any of those higher harmonics, even ones well
>> > beyond the range of human hearing, this perfect square shape takes on a
>> bit
>> > of a ripple shape. At what point is it no longer a "true" square wave?
>> >
>> > So I would argue that a perfect square wave doesn't exist anywhere
>> except
>> > in theory, and it's more useful to define it by its harmonic series.
>> And at
>> > that point it doesn't look easier or more complex than any other common
>> > waveshape.
>>
>>
>> Neil here hits it pretty much spot on.  Theo's equipment and Theo's
>> hearing does not have infinite bandwidth.  i sorta doubt that he would be
>> able to discern the difference between a "perfect" square wave and the same
>> waveform passed through a nearly perfect brickwall filter with the upper
>> edge at 20 kHz.  they'll sound the same.
>>
>> so then the task to generate this square wave digitally is to generate a
>> bandlimited representation keeping all of the harmonics up to our limit of
>> hearing.  for a square wave at middle C, you need to break it down to
>> harmonics (say, using Fourier Series), keep all of the harmonics up to the
>> 75th harmonic (about 20 kHz), ditch the rest, and then digitally reproduce
>> that waveform.
>>
>> there is BLIT (or integrating a BLIT to get a square wave), but those
>> BLITs are stored in some kinda wavetable, and i don't see why not just
>> represent the bandlimited waveform itself in a wavetable.
>>
>> so using an FFT of a large size.  let's say N=64K 

Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread robert bristow-johnson







 Original Message 

Subject: Re: [music-dsp] Playing a Square Wave

From: "Uli Brueggemann" 

Date: Wed, June 13, 2018 4:57 pm

To: "robert bristow-johnson" 

"A discussion list for music-related DSP" 

--



> 75th or 150th harmonics?



i said for middle C (261 Hz) for the 75th harmonic.� and an octave below (131 
Hz) for 150 harmonics.
didn't say that nor mean that for an 8 kHz note.� (that's barely on the MIDI 
spectrum and is way above the top note of an 88-key piano.)



> A bandlimited squarewave of 8 kHz @ 44.1 kHz samplerate is a sinewave. 3*8 
> kHz is already outside of the bandwidth.

> This means that the basic frequency must be pretty low to get a square wave

> shape.
yes.� the whole idea of using wavetable synthesis to do "classic" waveforms (or 
any other waveforms, including those extracted from "real" acoustic 
instruments) is to have different wavetables for different ranges (or "splits") 
of the
keyboard.� but, unlike a discrete split, you would be mixing synchronous 
wavetables in the region of the note played.� with Fs = 48 kHz and a top limit 
of 19 kHz, one can show that two wavetables per octave is good enough.� but 
there's nothing magic about 2 per octave.� you could
have another split every 5 semitones, if you want.
--
r b-j

>

> 2018-06-13 20:40 GMT+02:00 robert bristow-johnson 

> :

>

>>

>>

>> ---- Original Message 

>> Subject: Re: [music-dsp] Playing a Square Wave

>>

From: "Neil Goldman" 

>> Date: Wed, June 13, 2018 11:16 am

>> To: ra...@raito.com

>> music-dsp@music.columbia.edu

>> --

>>

>> >> such a simple wave like the square wave, just two signal levels with a

>> >> near instantaneous jump between them

>> >

>> > I think I disagree with this definition of a square wave. This is what a

>> > perfect, ideal one would look like, but even in reality I don't think any

>> > system (digital or analog) can exactly produce a perfect square and the

>> > infinite bandwidth it takes for the infinite number of harmonics.

>> >

>> > Even assuming a magically perfect and noiseless analog square wave

>> > generator, at the very least your speaker cones can't teleport between

>> two

>> > positions. And I'm no electrical engineer but the circuitry must also

>> have

>> > some kind of damping effect on the extreme ranges? I mean even the

>> > infinitesimally faint harmonics that will exist in the Mhz range, Ghz

>> > range, etc up to infinity.

>> >

>> > If you remove or dampen any of those higher harmonics, even ones well

>> > beyond the range of human hearing, this perfect square shape takes on a

>> bit

>> > of a ripple shape. At what point is it no longer a "true" square wave?

>> >

>> > So I would argue that a perfect square wave doesn't exist anywhere except

>> > in theory, and it's more useful to define it by its harmonic series. And

>> at

>> > that point it doesn't look easier or more complex than any other common

>> > waveshape.

>>

>>

>> Neil here hits it pretty much spot on. Theo's equipment and Theo's

>> hearing does not have infinite bandwidth. i sorta doubt that he would be

>> able to discern the difference between a "perfect" square wave and the same

>> waveform passed through a nearly perfect brickwall filter with the upper

>> edge at 20 kHz. they'll sound the same.

>>

>> so then the task to generate this square wave digitally is to generate a

>> bandlimited representation keeping all of the harmonics up to our limit of

>> hearing. for a square wave at middle C, you need to break it down to

>> harmonics (say, using Fourier Series), keep all of the harmonics up to the

>> 75th harmonic (about 20 kHz), ditch the rest, and then digitally reproduce

>> that waveform.

>>

>> there is BLIT (or integrating a BLIT to get a square wave), but those

>> BLITs are stored in some kinda wavetable, and i don't see why not just

>> represent the bandlimited waveform itself in a wavetable.

>>

>> so using an FFT of a large size. let's say N=64K points. in that 64K

>> buffer, draw out a single cycle of the analog waveform you seek; square,

>> saw, triangle, PWM, sync-saw, sync-sq

Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread Uli Brueggemann
75th or 150th harmonics?
A bandlimited squarewave of 8 kHz @ 44.1 kHz samplerate is a sinewave. 3 *
8 kHz is already outside of the bandwidth.
This means that the basic frequency must be pretty low to get a square wave
shape.

- Uli

2018-06-13 20:40 GMT+02:00 robert bristow-johnson 
:

>
>
>  Original Message 
> Subject: Re: [music-dsp] Playing a Square Wave
> From: "Neil Goldman" 
> Date: Wed, June 13, 2018 11:16 am
> To: ra...@raito.com
> music-dsp@music.columbia.edu
> --
>
> >> such a simple wave like the square wave, just two signal levels with a
> >> near instantaneous jump between them
> >
> > I think I disagree with this definition of a square wave. This is what a
> > perfect, ideal one would look like, but even in reality I don't think any
> > system (digital or analog) can exactly produce a perfect square and the
> > infinite bandwidth it takes for the infinite number of harmonics.
> >
> > Even assuming a magically perfect and noiseless analog square wave
> > generator, at the very least your speaker cones can't teleport between
> two
> > positions. And I'm no electrical engineer but the circuitry must also
> have
> > some kind of damping effect on the extreme ranges? I mean even the
> > infinitesimally faint harmonics that will exist in the Mhz range, Ghz
> > range, etc up to infinity.
> >
> > If you remove or dampen any of those higher harmonics, even ones well
> > beyond the range of human hearing, this perfect square shape takes on a
> bit
> > of a ripple shape. At what point is it no longer a "true" square wave?
> >
> > So I would argue that a perfect square wave doesn't exist anywhere except
> > in theory, and it's more useful to define it by its harmonic series. And
> at
> > that point it doesn't look easier or more complex than any other common
> > waveshape.
>
>
> Neil here hits it pretty much spot on.  Theo's equipment and Theo's
> hearing does not have infinite bandwidth.  i sorta doubt that he would be
> able to discern the difference between a "perfect" square wave and the same
> waveform passed through a nearly perfect brickwall filter with the upper
> edge at 20 kHz.  they'll sound the same.
>
> so then the task to generate this square wave digitally is to generate a
> bandlimited representation keeping all of the harmonics up to our limit of
> hearing.  for a square wave at middle C, you need to break it down to
> harmonics (say, using Fourier Series), keep all of the harmonics up to the
> 75th harmonic (about 20 kHz), ditch the rest, and then digitally reproduce
> that waveform.
>
> there is BLIT (or integrating a BLIT to get a square wave), but those
> BLITs are stored in some kinda wavetable, and i don't see why not just
> represent the bandlimited waveform itself in a wavetable.
>
> so using an FFT of a large size.  let's say N=64K points.  in that 64K
> buffer, draw out a single cycle of the analog waveform you seek; square,
> saw, triangle, PWM, sync-saw, sync-square, or even a single cycle of a
> recorded waveform.
>
> FFT the bastard.  bin 0 will have DC.  bin 1 and bin N-1 will have the
> amplitude and phase of the 1st harmonic.  bins 2 and N-2 have the 2nd
> harmonic (the evens should be zero for a square wave), etc.
>
> then for middle C, go up to the 76th bin and zero all of them up to the
> (N-76)th bin.  that will bandlimit your waveform.
>
> then inverse FFT the thing.
>
> the waveform you have left in 64K points is a bandlimited square wave that
> will sound just fine for around middle C.  you can reduce the size of that
> waveform by decimating (or down-sampling) down to about a 256-point
> waveform for storage.  but for wavetable synth playback, you really want
> that waveform represented with more points than 256.  i would recommend
> 2048 or 4096 points.
>
> then you have to do this again for square waves at other pitches.  say one
> octave lower, then you need to keep 150 harmonics.  or an octave higher
> than middle C, you need to bandlimit it to 37 harmonics.
>
> then, in keeping with wavetable synthesis, you keep all of these
> bandlimited square waves (say 2048 points per waveform) in memory and you
> mix them proportionately as the note goes up and down the keyboard.  i
> think that two waveforms per octave is generally good enough.  but maybe
> you want 3 or 4.
>
> so BLIT, wavetable, or some other mathematical algorithm to generate a
> bandlimited square on the fly (i did something like that for K

Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread robert bristow-johnson







 Original Message 

Subject: Re: [music-dsp] Playing a Square Wave

From: "Neil Goldman" 

Date: Wed, June 13, 2018 11:16 am

To: ra...@raito.com

music-dsp@music.columbia.edu

--



>> such a simple wave like the square wave, just two signal levels with a

>> near instantaneous�jump between them

>

> I think I disagree with this definition of a square wave. This is what a

> perfect, ideal one would look like, but even in reality I don't think any

> system (digital or analog) can exactly produce a perfect square and the

> infinite bandwidth it takes for the infinite number of harmonics.

>

> Even assuming a magically perfect and noiseless analog square wave

> generator, at the very least your speaker cones can't teleport between two

> positions. And I'm no electrical engineer but the circuitry must also have

> some kind of damping effect on the extreme ranges? I mean even the

> infinitesimally faint harmonics that will exist in the Mhz range, Ghz

> range, etc up to infinity.

>

> If you remove or dampen any of those higher harmonics, even ones well

> beyond the range of human hearing, this perfect square shape takes on a bit

> of a ripple shape. At what point is it no longer a "true" square wave?

>

> So I would argue that a perfect square wave doesn't exist anywhere except

> in theory, and it's more useful to define it by its harmonic series. And at

> that point it doesn't look easier or more complex than any other common

> waveshape.

�
Neil here hits it pretty much spot on.� Theo's equipment and Theo's hearing 
does not have infinite bandwidth.� i sorta doubt that he would be able to 
discern the difference between a "perfect" square wave and the same waveform 
passed through a nearly perfect
brickwall filter with the upper edge at 20 kHz.� they'll sound the same.
so then the task to generate this square wave digitally is to generate a 
bandlimited representation keeping all of the harmonics up to our limit of 
hearing.� for a square wave at middle C, you need to break it
down to harmonics (say, using Fourier Series), keep all of the harmonics up to 
the 75th harmonic (about 20 kHz), ditch the rest, and then digitally reproduce 
that waveform.
there is BLIT (or integrating a BLIT to get a square wave), but those BLITs are 
stored in some kinda wavetable, and i
don't see why not just represent the bandlimited waveform itself in a wavetable.
so using an FFT of a large size.� let's say N=64K points.� in that 64K buffer, 
draw out a single cycle of the analog waveform you seek; square, saw, triangle, 
PWM, sync-saw, sync-square, or even a single
cycle of a recorded waveform.
FFT the bastard.� bin 0 will have DC.� bin 1 and bin N-1 will have the 
amplitude and phase of the 1st harmonic.� bins 2 and N-2 have the 2nd harmonic 
(the evens should be zero for a square wave), etc.�
then for middle C, go up to the 76th
bin and zero all of them up to the (N-76)th bin.� that will bandlimit your 
waveform.
then inverse FFT the thing.
the waveform you have left in 64K points is a bandlimited square wave that will 
sound just fine for around middle C.� you can reduce the size of that waveform 
by
decimating (or down-sampling) down to about a 256-point waveform for storage.� 
but for wavetable synth playback, you really want that waveform represented 
with more points than 256.� i would recommend 2048 or 4096 points.
then you have to do this again for square waves at other
pitches.� say one octave lower, then you need to keep 150 harmonics.� or an 
octave higher than middle C, you need to bandlimit it to 37 harmonics.
then, in keeping with wavetable synthesis, you keep all of these bandlimited 
square waves (say 2048 points per waveform) in memory and
you mix them proportionately as the note goes up and down the keyboard.� i 
think that two waveforms per octave is generally good enough.� but maybe you 
want 3 or 4.
so BLIT, wavetable, or some other mathematical algorithm to generate a 
bandlimited square on the fly (i did something
like that for Kurzweil, but i ain't saying what it was, and i don't recommend 
it anyway).� that's how you do these things.
�
--

r b-j� � � � � � � � � � � � �r...@audioimagination.com



"Imagination is more important than knowledge."

�
�
�
�
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread Theo Verelst

Neil Goldman wrote:

 > such a simple wave like the square wave, just two signal levels with a near 
instantaneous
jump between them

I think I disagree with this definition of a square wave

Even assuming a magically perfect and noiseless analog square wave generator, 
at the very
least your speaker cones can't teleport between two positions.


Sure, there's a lot of stuff not just happening with speakers, but with 
acoustics of
any kind as well, always very audible.

For me when I started building musical circuits of the kinds I described, in 
high school,
there were perfect enough squares available: electronics "function generators" would offer 
near perfect square waves with rise times orders of magnitude faster than an audio circuit 
would normally require, and crystal oscillators would keep jitter pretty low for

creating square tones.

It's true the imperfections I mean are the "digitally created" ones, which includes the 
exact filtering in the DAC, the linearity of it, which filter components have been (and 
not been) used like for DC coupling and analogue (mean IIR automatically) anti-aliasing 
filtering. The converter chip I use often at the moment (a PCM5102A DAC with up to 50MHz 
very low jitter and ground separated clock) is analog filtered with a single high quality 
component analog filter, DC coupled with a very high quality OPA627 OpAmp, with no 
subsequent electrolytic capacitors in the signal path. On my big monitoring or studio 
headphones it should be able to be very accurate.


It's hard to explain, but it's possible to take the given filtering inside a DAC (to begin 
with the standard "oversampling" digital one) and try to invert it to the extend that the 
streaming filter inversion allows you to control the signal at oversampling clock speed to 
some level of accuracy. This might cost headroom: some inversions might take a lot of 
amplitude which is lost in the out coming signal, but nevertheless there are a few ways to 
try to do this.


So taking a square wave with a given limitation of zero harmonics above a certain 
frequency (like can be created with additive synthesis) approximating the "perfect 
reconstruction" at the output of the DAC oversampling filter output is a real possibility. 
Unfortunately inversion of such a FIR or IIR filter with near bit-accuracy

at the streaming signal output might not be easy, is hard to verify (unless you 
have
and accurate model of the filter) and requires also a signal example (the required output) 
which is up sampled or otherwise known to or at the over sample frequency.


Now if you've got that, for the DAC being used, you could indeed worry about if the "all 
harmonics up to Niquist" is perfect and good sounding. And certainly: do I want to

include some sort of analogue filter simulation in the signal path for better 
sound, etc.

I've got a (very complicated) setup that certainly will work with 
pre-inversions of DAC
reconstruction/anti-alias/oversampling filtering, which IMO is absolutely 
necessary to
get the quality I want, but mainly the kind of processing prepares signals to 
sound
alright in *any* normal, small or big, damped or reverberating, acoustic space. 
And I
found a lot of high quality recorded (commercial) music contains preparations 
for that
principle of letting acoustics not get in the way of music enjoyment. Probably 
a domain
Lexicon has been one of the main players in, and indeed my Lexicon digital 
reverberation
unit almost cries and sings when these "signal preparations" start to sound 
good.

I'm sure a lot of modern speakers are very prepared for use with digital 
signals, and
often, I wish they would be more neutral and the reconstruction filters in DAC 
better.

TV
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp



Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread Neil Goldman
>  such a simple wave like the square wave, just two signal levels with a
near instantaneous
jump between them

I think I disagree with this definition of a square wave. This is what a
perfect, ideal one would look like, but even in reality I don't think any
system (digital or analog) can exactly produce a perfect square and the
infinite bandwidth it takes for the infinite number of harmonics.

Even assuming a magically perfect and noiseless analog square wave
generator, at the very least your speaker cones can't teleport between two
positions. And I'm no electrical engineer but the circuitry must also have
some kind of damping effect on the extreme ranges? I mean even the
infinitesimally faint harmonics that will exist in the Mhz range, Ghz
range, etc up to infinity.

If you remove or dampen any of those higher harmonics, even ones well
beyond the range of human hearing, this perfect square shape takes on a bit
of a ripple shape. At what point is it no longer a "true" square wave?

So I would argue that a perfect square wave doesn't exist anywhere except
in theory, and it's more useful to define it by its harmonic series. And at
that point it doesn't look easier or more complex than any other common
waveshape.

I also don't know the answer but agree with the guess that it's probably
analog imperfections that make it sound good, rather than analog perfection.

Cheers,
Neil


On Wed, Jun 13, 2018 at 10:51 AM  wrote:

> Theo,
>
> My tl;dr answer to your question is it's difficult because even if it's
> digital, it's not digital. Ever. It's always analog.
>
> Like you, I'm a university EE (and Comp. Sci.) because I wanted to go into
> chip design. This was back in the early 80's. So maybe my classwork was
> different than yours. It was always amusing to deal with my computer
> science classmates when something that dealt with the inherent analogness
> of even digital logic came up.
>
> In the late 70's, when I was in high school, I also tried to build an
> organ. But back then, I had few resources, monetary or otherwise. I didn't
> know about top octave chips or anything. So what I used were TTL inverter
> circuits to make square wave oscillators, and fed those into J/K
> flip-flops for dividers (a bit overkill, that). I also used some other TTL
> logic to take those square waves and make some very steppy sawtooth waves
> (which I then filtered to make them smoother.)
>
> Currently, I emulate one of those old MOSTEK chips + dividers on an FPGA.
> I'm not using much of the FPGA, but since I need oodles of output pins, I
> have to use something fairly stout. No DACs necessary. I may try a version
> sometime that mixes the signals internally to a single bus, then use a DAC
> on that, but I fear I won't get it to sound as nice.
>
> Neil Gilmore
> ra...@raito.com
>
> >
> > There's this preoccupation I have since the advent of going "digital",
> > let's say since I
> > heard music being played on CD in the early 80s. I grew up with access to
> > electronics
> > equipment that would generate "square waves" in some sorts of analogue
> > fashion, including
> > originally "digital" chips, even driven from frequency stable crystals
> and
> > so on. In fact
> > I built my own organ/synthesizer based on a top octave synthesizer chip
> > around 1980 which
> > I gave CMOS divider chips to get well symmetrical, pure and pretty
> > undistorted square
> > waves to a analog mixing rail construction, and I must say (I was a
> > teenager) I recall the
> > different sounds. the feel if you like, of all those different square
> > waves by themselves
> > and some the filter and modulation constructs I made quite well.
> >
> > Now, like everybody else, I'm used to listening to a lot of audio in some
> > form of digital
> > source format, ending up at one of the varying types of Digital to Analog
> > Converters, to
> > enjoy digital music on for instance a smart phone, a HDMI based digital
> > stream converted
> > by a TV/Monitor, a very high quality DIY kit based converter setup,
> > standard computer and
> > bluray player outputs (both not bad) and known brand studio quality USB
> > ADC/DAC units
> > (Lexicon, Yamaha, and a Burr Brown/TI chip based DIY kit) and finally
> from
> > some variety of
> > digital music synthesizers (a.o. a Kurzweil and a Yamaha).
> >
> > The simple question that forced itself on me often, as I"m sure some can
> > relate, after
> > having been used to all those early signal sources including a host of
> > analog synthesizers
> > I had in the past, and a lot of music in various analog forms from
> > standard pop to G. Duke
> > and Rose Royce to mention a few of my favorites from an earlier era, is
> > how can it be that
> > such a simple wave like the square wave, just two signal levels with a
> > near instantaneous
> > jump between them, can be so hard to make digital, if you listen with a
> > HiFi system and
> > some normal musical signal discernment ?
> >
> > The answer is relatively simple: a digital sq

Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread raito
Theo,

My tl;dr answer to your question is it's difficult because even if it's
digital, it's not digital. Ever. It's always analog.

Like you, I'm a university EE (and Comp. Sci.) because I wanted to go into
chip design. This was back in the early 80's. So maybe my classwork was
different than yours. It was always amusing to deal with my computer
science classmates when something that dealt with the inherent analogness
of even digital logic came up.

In the late 70's, when I was in high school, I also tried to build an
organ. But back then, I had few resources, monetary or otherwise. I didn't
know about top octave chips or anything. So what I used were TTL inverter
circuits to make square wave oscillators, and fed those into J/K
flip-flops for dividers (a bit overkill, that). I also used some other TTL
logic to take those square waves and make some very steppy sawtooth waves
(which I then filtered to make them smoother.)

Currently, I emulate one of those old MOSTEK chips + dividers on an FPGA.
I'm not using much of the FPGA, but since I need oodles of output pins, I
have to use something fairly stout. No DACs necessary. I may try a version
sometime that mixes the signals internally to a single bus, then use a DAC
on that, but I fear I won't get it to sound as nice.

Neil Gilmore
ra...@raito.com

>
> There's this preoccupation I have since the advent of going "digital",
> let's say since I
> heard music being played on CD in the early 80s. I grew up with access to
> electronics
> equipment that would generate "square waves" in some sorts of analogue
> fashion, including
> originally "digital" chips, even driven from frequency stable crystals and
> so on. In fact
> I built my own organ/synthesizer based on a top octave synthesizer chip
> around 1980 which
> I gave CMOS divider chips to get well symmetrical, pure and pretty
> undistorted square
> waves to a analog mixing rail construction, and I must say (I was a
> teenager) I recall the
> different sounds. the feel if you like, of all those different square
> waves by themselves
> and some the filter and modulation constructs I made quite well.
>
> Now, like everybody else, I'm used to listening to a lot of audio in some
> form of digital
> source format, ending up at one of the varying types of Digital to Analog
> Converters, to
> enjoy digital music on for instance a smart phone, a HDMI based digital
> stream converted
> by a TV/Monitor, a very high quality DIY kit based converter setup,
> standard computer and
> bluray player outputs (both not bad) and known brand studio quality USB
> ADC/DAC units
> (Lexicon, Yamaha, and a Burr Brown/TI chip based DIY kit) and finally from
> some variety of
> digital music synthesizers (a.o. a Kurzweil and a Yamaha).
>
> The simple question that forced itself on me often, as I"m sure some can
> relate, after
> having been used to all those early signal sources including a host of
> analog synthesizers
> I had in the past, and a lot of music in various analog forms from
> standard pop to G. Duke
> and Rose Royce to mention a few of my favorites from an earlier era, is
> how can it be that
> such a simple wave like the square wave, just two signal levels with a
> near instantaneous
> jump between them, can be so hard to make digital, if you listen with a
> HiFi system and
> some normal musical signal discernment ?
>
> The answer is relatively simple: a digital square wave for musical
> application comes out
> of all current standard DACs with imperfections that I recognize and have
> an immediate
> form of musical dislike about. Not that a software synth can't be put on,
> played and
> create some fun with square waves, I'm sure it can to some degree be fun
> and played with
> in some music, but for sound enthusiasts, all that digital signal
> processing does come
> across as often the same sounding and not as musical as I remember it can
> be by far.
>
> Is it possible to do something about that? I'm an univ. EE so im y
> official background
> knowledge, there's enough to understand some of the reasons for these
> sound limitations
> easily. Solving all of them will prove to be very hard, given standard DSP
> and normal
> current DACs, so there is that. To begin with the understanding *why* such
> a simple
> "digital" square wave doesn't sound warm and nicely flutey from a digital
> system in many
> cases: the wave as to be "rounded" to fit in the sample timing, and the
> DAC essentially
> doesn't necessarily "know" how to create those up and down signal edges
> with accurate
> timing. So for instance 1 standard 1kHz square wave coming out of a
> CD-rate (44.1e3
> samples per second) DAC will have maximum up and down square wave edge
> timing errors in
> the order of 1000/44100 * 100% ~= a few percent timing errors. Doesn't
> sound like much,
> but all the harmonics might be involved, and for a High Fidelity system,
> and error of 1/10
> of a percent nowadays just like in the early days of tube HiFi is
> considered quite

Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread Sound of L.A. Music and Audio

Hello Theo

same as me :-) I played electronic organ sind 1982 and quicky started to 
modify it with own electronics. Later, I started with GALs and PLDs to 
create an own organ. The first concept was like this:


http://96khz.org/htm/pldmodularorgan.htm

A coarse DDS created from a digitally devided oscillator and then 
filtered the analog way (light blue box lower left corner)


Later I used 12 optimized OSC crystals to create the required 11 
fundamental frequencies and thus shunning the DDS issues caused by 
"gaps" and "hops" in the table / synth maths.


When then coming to FPGAs, I thought of a method to tune these 
frequencies in one chip and came to this solution:


http://96khz.org/oldpages/frequencyshifter.htm

It is possible to tune frequencies down to some 0,001% of an incoming 
frequency. With that concept it is possible to get all freqs out of one 
chip and one oszillator only and make use of FPGAs with less than 11 
clock capable inputs.


What I would suggest with todays electronics (and if there is enough 
time any money :-) ):


Use 11 Crystals/PLL and an FPGA to create a very high resolution vector 
for DDS and drive 11 wave tables from Block-RAMs. Then you get all notes 
perfectly trimmed without DDS issues. This is they way were are doing in 
an audio meassurement system.


The other way is extremely high sample frequency and very large RAMs 
using common DDS. This also makes it possible to perform vibrato without 
issues.


Regarding the perfect square:

With common DACs this is hardly possible, since they all use dithering 
and filtering as well as band width limiting on order not to generate 
ultra sonic frequencies and alias as you decribed. With industrial squre 
waves, We do not use DACs at all. Instead there is high frequency design 
and rapid gating with GAS-Transistors to e.g. produce GHz-pulses from 
FPGAs and tune them in the range of some 50ps in phase. For one of my 
customers I built a system with a double DDS tuneably in MHz-region and 
beeing able to trim the wave at 20ps only.


Coming back to audio:

From my point of view, this is finally a matter of the edge frequency:
In my 768kHz systems driving a PDM->Analog Filter, it is no problem to 
generate a pulse with harmonics up to 50...100 khz having an edge 
frequency in that region for the analog filter. Therewith there should 
be no audible difference anymore between this and a perfect squre. This 
wals also prooved by some tests we did in the field of medical ultra 
sonic wave generation and processing. But keep in mind, we need special 
"loud speakers" for this to produce these waves in real air :-)
And, starting from 10kHz, the distance to your speaker becomes relevant. 
There is a significant samping caused by the air. Frequencies in the 
range of 50kHz are significantly reduced in a larger distance, so you 
need a kind of emphasis possibly.


Regarding the methods of filtering:

FIR can and cannot be a good choice to prepare the signals for DACs 
because of pre-ringing. This all depends on the analog filter design and 
the response. The best perfect pulse in theory can be obtained by 
sending the response  of a DIRAC, namly the standard filter coefficiants 
of a low pass filter into such a low pass filter with an edge frequency 
meeting that of the FIR coefficient. This is the best trade off between 
steepness and overshot.


Jürgen

Am 13.06.2018 um 12:59 schrieb Theo Verelst:


There's this preoccupation I have since the advent of going "digital", 
let's say since I heard music being played on CD in the early 80s. 


___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread Niels Dettenbach
Am Mittwoch, 13. Juni 2018, 14:35:27 CEST schrieb pa...@synth.net:
> > Is it possible to do something about that? I'm an univ. EE so im y
> > official background knowledge, there's enough to understand some of
> > the reasons for these sound limitations easily. Solving all of them
> > will prove to be very hard, given standard DSP and normal current
> > DACs, so there is that. To begin with the understanding *why* such a
> > simple "digital" square wave doesn't sound warm and nicely flutey from
> > a digital system in many cases: the wave as to be "rounded" to fit in
> > the sample timing, and the DAC essentially doesn't necessarily "know"
> > how to create those up and down signal edges with accurate timing.

I recommend to take a look at oscilloscope / - graph images  from "square" 
waves out of different types of sources -i.e. digital and analog (synths and 
other generator types/sources).

By theory, any square wave could be constructed by a infinite number of 
(sinus) signals, while many of that images seems like produced from a finite 
number of such "signal parts". this means - if i think correctly - a really 
perfect square would have "infinite energy" required (pls correct me, if i'm 
wrong here).

A lot of the "subtile timbre" of a synths square wave could be "found" in the 
(by tech limits / physics always a bit imperfect) "edges" of the squares. i 
assume if you want to reproduce such "analogish" square in digital, the 
resulution of the sampling and reproduction at this stage should be 
important.

sorry for possible tech imperfections -my view onto this is more one from a 
synth user then a DSP specialist.


just my .02


niels.
-- 
 ---
 Niels Dettenbach
 ((db))
 dettenbach audio
 http://dettenbach.com
 PGP: https://syndicat.com/pub_key.asc
 ---
 






___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp



Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread paula

Comments in line.


There's this preoccupation I have since the advent of going "digital",
let's say since I heard music being played on CD in the early 80s. I
grew up with access to electronics equipment that would generate
"square waves" in some sorts of analogue fashion, including originally
"digital" chips, even driven from frequency stable crystals and so on.


Correct, though most analogue synthesisers generate a sawtooth or a 
triangle and then use a comparator to turn that into a square wave.

So, square isn't the only waveform.


In fact I built my own organ/synthesizer based on a top octave
synthesizer chip around 1980 which I gave CMOS divider chips to get
well symmetrical, pure and pretty undistorted square waves to a analog
mixing rail construction, and I must say (I was a teenager) I recall
the different sounds. the feel if you like, of all those different
square waves by themselves and some the filter and modulation
constructs I made quite well.


The other REALLY important thing to mention is that you can pretty much 
guarantee that not all 12 waves were perfectly in tune relative to each 
other.
This subtle detuning, or beating, makes a huge difference to the feel of 
"analogue" Vs Digital, but it can be replicated




Now, like everybody else, I'm used to listening to a lot of audio in
some form of digital source format, ending up at one of the varying
types of Digital to Analog Converters, to enjoy digital music on for
instance a smart phone, a HDMI based digital stream converted by a
TV/Monitor, a very high quality DIY kit based converter setup,
standard computer and bluray player outputs (both not bad) and known
brand studio quality USB ADC/DAC units (Lexicon, Yamaha, and a Burr
Brown/TI chip based DIY kit) and finally from some variety of digital
music synthesizers (a.o. a Kurzweil and a Yamaha).


Though, remember these are mass market products, they will use the 
appropriate part for a given price point.

Now, if you want a GORGEOUS sounding DAC, go play with a synclavier.
These are discrete DACs and sound like NOTHING I've ever heard before.. 
just utterly amazing.



The simple question that forced itself on me often, as I"m sure some
can relate, after having been used to all those early signal sources
including a host of analog synthesizers I had in the past, and a lot
of music in various analog forms from standard pop to G. Duke and Rose
Royce to mention a few of my favorites from an earlier era, is how can
it be that such a simple wave like the square wave, just two signal
levels with a near instantaneous jump between them, can be so hard to
make digital, if you listen with a HiFi system and some normal musical
signal discernment ?


because, what digital gives you is a "perfect" result, Analogue can 
never do that, even the slopes will be slightly shaped and there will be 
frequency drift and RARELY would the squarewave be precisely 50/50 duty 
cycle.




The answer is relatively simple: a digital square wave for musical
application comes out of all current standard DACs with imperfections
that I recognize and have an immediate form of musical dislike about.


I think it's the wrong way round, they have the perfections you don't 
like :)



Not that a software synth can't be put on, played and create some fun
with square waves, I'm sure it can to some degree be fun and played
with in some music, but for sound enthusiasts, all that digital signal
processing does come across as often the same sounding and not as
musical as I remember it can be by far.


Again, remember there is more than just a square wave to play with.



Is it possible to do something about that? I'm an univ. EE so im y
official background knowledge, there's enough to understand some of
the reasons for these sound limitations easily. Solving all of them
will prove to be very hard, given standard DSP and normal current
DACs, so there is that. To begin with the understanding *why* such a
simple "digital" square wave doesn't sound warm and nicely flutey from
a digital system in many cases: the wave as to be "rounded" to fit in
the sample timing, and the DAC essentially doesn't necessarily "know"
how to create those up and down signal edges with accurate timing.


actually, a lot of good "analogue synth" flute sounds were based on a 
tirangle wave, rather than a square.



Can a DAC do a better job ? Yes, but not by just feeding it a pure
square wave, rounded to the samples. One could make use of serious
oversampling, and a much higher rate DAC, for instance I've tested a
very high quality DAC with adjustable type of built in "oversampling"
filter (low pass or short, hard window reconstruction) at almost 10
times CD rate (384k s/s),and surely this makes the sound more
acceptable. The monitoring and pre-amplification as well as the
analogue (electronics based) DAC filtering will matter for the sound,
too.


This is what I mean, you're creating imperfections from a perfect 
source.



Now recently I've worked on qu

Re: [music-dsp] Playing a Square Wave

2018-06-13 Thread STEFFAN DIEDRICHSEN
How about square waves made from BLITs? That’s a standard approach. To hear the 
difference, try the test oscillator in Logic Pro. It has an anti-alias option 
to switch between a naive square / pulse wave, which is useful in some cases, 
since it has only 2 values, and a BLIT version, which sounds nice at every 
frequency.

Steffan 

> On 13.06.2018|KW24, at 12:59, Theo Verelst  wrote:
> 
> Anyone else worked on this to some extend ?

___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

[music-dsp] Playing a Square Wave

2018-06-13 Thread Theo Verelst



There's this preoccupation I have since the advent of going "digital", let's say since I 
heard music being played on CD in the early 80s. I grew up with access to electronics 
equipment that would generate "square waves" in some sorts of analogue fashion, including 
originally "digital" chips, even driven from frequency stable crystals and so on. In fact 
I built my own organ/synthesizer based on a top octave synthesizer chip around 1980 which 
I gave CMOS divider chips to get well symmetrical, pure and pretty undistorted square 
waves to a analog mixing rail construction, and I must say (I was a teenager) I recall the 
different sounds. the feel if you like, of all those different square waves by themselves 
and some the filter and modulation constructs I made quite well.


Now, like everybody else, I'm used to listening to a lot of audio in some form of digital 
source format, ending up at one of the varying types of Digital to Analog Converters, to 
enjoy digital music on for instance a smart phone, a HDMI based digital stream converted 
by a TV/Monitor, a very high quality DIY kit based converter setup, standard computer and 
bluray player outputs (both not bad) and known brand studio quality USB ADC/DAC units 
(Lexicon, Yamaha, and a Burr Brown/TI chip based DIY kit) and finally from some variety of 
digital music synthesizers (a.o. a Kurzweil and a Yamaha).


The simple question that forced itself on me often, as I"m sure some can relate, after 
having been used to all those early signal sources including a host of analog synthesizers 
I had in the past, and a lot of music in various analog forms from standard pop to G. Duke 
and Rose Royce to mention a few of my favorites from an earlier era, is how can it be that 
such a simple wave like the square wave, just two signal levels with a near instantaneous 
jump between them, can be so hard to make digital, if you listen with a HiFi system and 
some normal musical signal discernment ?


The answer is relatively simple: a digital square wave for musical application comes out 
of all current standard DACs with imperfections that I recognize and have an immediate 
form of musical dislike about. Not that a software synth can't be put on, played and 
create some fun with square waves, I'm sure it can to some degree be fun and played with 
in some music, but for sound enthusiasts, all that digital signal processing does come 
across as often the same sounding and not as musical as I remember it can be by far.


Is it possible to do something about that? I'm an univ. EE so im y official background 
knowledge, there's enough to understand some of the reasons for these sound limitations 
easily. Solving all of them will prove to be very hard, given standard DSP and normal 
current DACs, so there is that. To begin with the understanding *why* such a simple 
"digital" square wave doesn't sound warm and nicely flutey from a digital system in many 
cases: the wave as to be "rounded" to fit in the sample timing, and the DAC essentially 
doesn't necessarily "know" how to create those up and down signal edges with accurate 
timing. So for instance 1 standard 1kHz square wave coming out of a CD-rate (44.1e3 
samples per second) DAC will have maximum up and down square wave edge timing errors in 
the order of 1000/44100 * 100% ~= a few percent timing errors. Doesn't sound like much, 
but all the harmonics might be involved, and for a High Fidelity system, and error of 1/10 
of a percent nowadays just like in the early days of tube HiFi is considered quite 
noticeable or even unacceptable.


Can a DAC do a better job ? Yes, but not by just feeding it a pure square wave, rounded to 
the samples. One could make use of serious oversampling, and a much higher rate DAC, for 
instance I've tested a very high quality DAC with adjustable type of built in 
"oversampling" filter (low pass or short, hard window reconstruction) at almost 10 times 
CD rate (384k s/s),and surely this makes the sound more acceptable. The monitoring and 
pre-amplification as well as the analogue (electronics based) DAC filtering will matter 
for the sound, too.


Now recently I've worked on quite a different type of problem, not important for this 
sharing at the moment, which as one of it's (complicated) side effects can produce 
components to a digital signal that try to use the (limited) DAC filtering, usually some 
internal up-sampling ("oversampling") with either a built in DSP  FIR (some short impulse 
with at least some low-pass qualities) or IIR (some standard low pass response) to create 
a purer sounding square wave approximation from a frequency limited digital wave source.


Anyone else worked on this to some extend ?

T.V.
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp