News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Targhan

Anyone to make sound measurements with an oscilloscope?

Started by Targhan, 10:51, 10 April 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Targhan

>Why does the program crash the CPC and mess up the screen? Is that correct? Surely you could have just created those sounds in BASIC?

Huh, there is a basic loader loading and executing a binary program. I tested all this on a real CPC, it works fine. I created them using AT2 because it gives me more control over the sounds I want.
Please PM if you want something else, you have my email.

Edit: ok it seems you want each sound in a different program. I'll do that and sent it again to you. I don't know your process, I expected you to record everything, then "simply" take "pictures" of the signal at precise instants.
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Bryce

No, that's not the way it works. You can take long samples, but you loose the resolution. To properly zoom in on a single wave and see the details, you need to be taking lots of samples over a short time.

Bryce.

Targhan

Ok no problem. I'll come with another program :).
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Targhan

Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Animalgril987


Bryce

Hi,
I had some time this morning and set up the test. Unfortunately, most of the sounds are non-symetrical, so they don't trigger properly and don't really tell much.

As the frequencies are so low, I can't measure them on a Spectrum Analyser. They only start at 9kHz.


Bryce.


Targhan

Thanks a lot for this!

- If the period is too low, and if you have time and want to make another test, simply change the "v=&ef" value line 1000 in the code I sent you. The smaller, the higher the sound.
- I guess the yellow line is the left signal, the blue one the right?
- From what I see, the signal seems perfectly square. No "round curves". Can I deduce from that that the sound generation of the PSG is pretty accurate and does not produce "lazy" square envelopes?
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Bryce

The squareness of the wave is also due to the very low frequency. The higher it goes, the rounder it would become.

When I get time I'll do some examples of higher frequencies.

Bryce.

Targhan

That would be great, thanks!

The funny thing is that, from your standpoint, you consider the frequency as "very low", but they are actually pretty high, musically speaking.
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Bryce

Quote from: Targhan on 11:56, 27 April 21
That would be great, thanks!

The funny thing is that, from your standpoint, you consider the frequency as "very low", but they are actually pretty high, musically speaking.

The base frequency of your sample is approx. 262Hz which is middle C on a piano, so it's dead centre from a music perspective, but on the scale of what a human can hear (20Hz - 20kHz) it's pretty low down on the scale* and from a physics / electronics perspective it's extremely low.

Bryce.

*Yes I'm aware that hearing sensitivity is logarithmic so it's not quite as low as I state.

VintageAdvantage

#35
Quote from: Bryce on 08:19, 27 April 21The squareness of the wave is also due to the very low frequency. The higher it goes, the rounder it would become.

Which is usually a sign of an oscilloscope reaching its bandwidth / sample frequency limits, right? For the CPC clock, this shows up even with decent enough starter oscilloscopes. E.g., with my 80 MHz Hantek, the CPC clock doesn't look squareish at all, but already much more like Sinus Wave.

I guess 100 Mhz is already the min for 4 MHz system. Well, square waves have high frequency harmonic content in its Fourier spectrum, and if you can't capture these due to bandwith limits of the scope, it gets roundish.

For audio, it shouldn't be a problem though. Not even for these B***S*** 50 $ pocket oscilloscopes on EBay.

m_dr_m

The noise looks so cool!
Also, there are pretty fast state switches. High frequency by the PSG, and 3 octaves lower square modulation by hand?
Were you tickled by BSC's great gritty sounds?

Targhan

You're going to be disappointed, it's only basic square sound, without then with noise, then noise only :).
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

m_dr_m

Oh, so in sound4.png, you have a sound in each channel? Even if it's the case, that's doesn't square for me!


Yes, your father and I are very disappointed by your behaviour!

Targhan

Quote from: m_dr_m on 13:56, 28 April 21Oh, so in sound4.png, you have a sound in each channel? Even if it's the case, that's doesn't square for me!
The sound is only played on the center channel, so what I see on sound4 is the same signal L and R. It looks very square to me.
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Bryce

That's because it is square. Sound signals don't need to be a sinewave.

Bryce.

m_dr_m

Sound1 is square.
In Sound4, there is state alternance inside the slower state alternance! (not taking about the noise (*) but the tiny fragments on either high or low state).
That is typical of 'ring square modulation' (multiplication of 2 square signals).


It could also be achieved by a very fast and well synchronised arpeggio (i.e. the switch of periods is done at same frequency than 2* the lower sound).
If you can generate either from basic, you have all my attention.


(*) Well, maybe it's just the pseudo-random state of the noise staying constant for a while.

Bryce

Quote from: VintageAdvantage on 16:05, 27 April 21
Which is usually a sign of an oscilloscope reaching its bandwidth / sample frequency limits, right? For the CPC clock, this shows up even with decent enough starter oscilloscopes. E.g., with my 80 MHz Hantek, the CPC clock doesn't look squareish at all, but already much more like Sinus Wave.

I guess 100 Mhz is already the min for 4 MHz system. Well, square waves have high frequency harmonic content in its Fourier spectrum, and if you can't capture these due to bandwith limits of the scope, it gets roundish.

For audio, it shouldn't be a problem though. Not even for these B***S*** 50 $ pocket oscilloscopes on EBay.

It can be caused by the scope not having the bandwidth, but in the case of a sound signal obviously it would be other factors causing the roundness. Parasitic capacitance and inductance will round the wave, transistor switching times will round the wave and the miller effect can also cause it.
For a good looking square wave you need a scope with at least 10 times the bandwidth of the fundamental wave so you would expect a 40MHz scope to be enough for 4Mhz. However, the sample rate is also important, so even a 100Mhz scope will show a strange square wave if it the sample rate is too low. 

Bryce.

Targhan

Quote from: m_dr_m on 14:47, 28 April 21In Sound4, there is state alternance inside the slower state alternance!
You're right. No idea what they are! Like I told you, it's only sound + noise, generated in Basic...
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

BSC

So, Targhan, can you already conclude what you were trying to find out here?
** My SID player/tracker AYAY Kaeppttn! on github **  Some CPC music and experiments ** Other music ** More music on scenestream (former nectarine) ** Some shaders ** Some Soundtrakker tunes ** Some tunes in Javascript

My hardware: ** Schneider CPC 464 with colour screen, 64k extension, 3" and 5,25 drives and more ** Amstrad CPC 6128 with M4 board, GreaseWeazle.

Targhan

Quote from: BSC on 12:33, 30 April 21
So, Targhan, can you already conclude what you were trying to find out here?
I don't think I am the one would can conclude, only based on screenshots. Bryce can, but maybe we should wait for new recording using higher frequencies.
Basically, I just wanted to be sure that the PSG was producing perfectly or almost perfectly squared envelopes (as Sylvestre showed in his page which I linked earlier). When recording music using a sound card, I noticed very strange stuff, which I thought was because of the PSG. It seems to turn out it is just because of filters modern sound card have.

So basically, it seems the PSG doesn't do crazy stuff :). I emulated some of the strange stuff I noticed, in Arkos Tracker 1 (mostly when using noise), but removed it for AT2 (which turned out to be a wise move).
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Bryce

This might go above the heads of many here, but just for the fun of it, I analysed the highest frequency the CPC can create: Sound 2,1 which is for me at least not possible to hear.
The higher the frequency, the more expected distortion (and the easier it is for me to analyse the spectrum).

The first screenshot is taken on a 100MHz oscilloscope. This means that I am theoretically measuring up to the 1611th Harmonic (if it actually existed), so any rounding seen is due to the limits of the CPC and not the scope. As you can see, the wave is still relatively square. The rounding on the leading edges will be due to capacitance on the CPC's PCB and parasitic properties of the resistors used to merge the channels. The noise seen on the top and bottom of the waves is most likely the CPC's clocks and switching noise from other parts of the circuit. But it's at a frequency that no speaker could reproduce, no ear could hear and it's volume is tiny anyway (20mV peak to peak).

The second screenshot is a spectrum analysis of the same signal. Here you can see the fundamental frequency on the left (62.19kHz) plus the 3rd, 5th, 7th and 9th harmonic. There is a tiny 4th, 6th and 8th harmonic which contributes to the rounding, but as you can see they are 30dB below the fundamental frequency and would normally be ignored in most calculations unless I was dealing with highly sensitive GHz signals.

Btw, the actual frequency is 62,190kHz as the SA reports, not the 62.5kHz that the Oscilloscope reports. Spectrum analysers are much more accurate than scopes for measuring frequencies. The ramp up of the noise floor on the left is because the SA is approaching it's lowest frequency limit (9kHz).

So to answer the original question: The CPC produces an extremely clean, as square as possible (for the electronics in a CPC) wave.

Bryce.

RetroCPC

Bryce,

Is the component on Marker 1 the square-wave frequency?

If so, the SNR is very poor - with a wide band Spectrum NF only 30dB down?

When you short the input of your SA do you still see such a rising noise-floor?

Listening to the CPC speaker "whine" I would expect the NF to be rising as seen on your SA - in fact worst if the SA lower limit is 9KHz.

You can see the fuzz on the Square wave peaks gives you an idea of the wide-band noise levels.

As you say, to be expected from a consumer "budget" home computer design back in the 80's.

Bryce

Marker 1 is the fundamental frequency, but the SNR is not a component of the CPC, rather the fact that I am measuring a 62kHz signal on a Spectrum Analyser that has a range from 9kHz to 3.2GHz. So as expected the noise floor is raised at both ends of that spectrum and the signal I'm measuring is at the very lower limit of that spectrum. If I short the SA input, obviously, the noise floor drops to the level of the SA'S internal noise and is almost a straight line.

The CPC is an 8 bit computer, why would I expect the SNR to be anywhere close to some high-end audio equipment? The "fuzz" as you call it is the switching noise from the CPC's circuitry and at 30dB down is pretty good for a non-shielded TTL circuit with a cheap-ass AY where they didn't even bother to have separate grounds for the analogue and digital portions.

Bryce.

RetroCPC

Hi Bryce,

I'm not convinced that the noise at the bottom end of the band is due to the lower limit of your SA. Sure the close in Phase noise of an "affordable" SA local oscillator is not going to be anything to write home about, but I doubt its as bad as seen in the sweep - I think much of what your seeing is really the SNR of the CPC.


For sure the HF noise is due to the lack of Ground plane, decent PSU decoupling etc. If I had spare time on my hands I'd love to redesign the PCB for improved video / audio :) With modern Hi-bandwidth LCD monitors you can see a lot of noise on the CPC's RGB output - even with the HF BW limiting filter capacitors fitted...

Its not in anyway a criticism of the CPC :) , its just the reality of 30 years of engineering progress in consumer grade electronics...

Powered by SMFPacks Menu Editor Mod