I could not find any info on the AY-1-1012 chip, but I’m guessing it is like the MK50242 except the AY-1-1012 produces an octave starting at A (3520Hz) instead of C# (4434Hz).
I looked at the pdf Lyrebird Keyboard Tone Generator.kicad_sch - from that it is clear the board generates 12 notes. I figured the ATmega328/P solution would be a drop in replacement for that board, and not require tuning. Basically 3 ICs - ATmega328/P + 2 * 4069.
I will look into changing the program to produce the AY-1-1012 notes.
I think this might be a typo in the original article. There is a Top Octave Generator AY-1-0212. Which may explain why I couldn’t find a specification.
I have a working Top Octave Generator that I believe produces the correct notes. I don’t have a frequency counter so relying on programs that use the sound card as input. All the notes are mathematically related so if one is right (within a reasonable tolerance) then they all are right.
It is not an exact reproduction of the AY-1-0212, that would require a 12.70016 MHz crystal. It is in my opinion better. A problem with a standard TOG is they do integer division of the input frequency. They approximate the equal temperament scale (which many instruments use) but are unable to produce the exact note (except 1 - usually C or A). For example F# should be 5,919.91Hz but the TOG produces 5923Hz. This implementation also cannot produce the exact note, but the error is less than 0.1Hz for all notes (assuming the CPU oscillator is 16MHz).
I can forward the details to anyone who is interested.
So after getting needed medical treatment, and spending a little too much time on my mates private server, in the world of Azeroth. I’m back at the project and have made a number of significant changes, I’m yet to upload.
I have moved a portion of the envelope circuitry back to the key assembly as how the original keyboard was designed, so the PCB’s form not just part of the envelope circuitry but the PCB forms the keyboard assembly, so I’m working on the changes, but I am yet to upload to GitHub.
So keep an eye on the GitHub repository, and I’ll also pull my finger out and get the video done as well.
I am unfamiliar with how to upload files and pictures to this forum. Since there was no reply I changes it to the MK50242 notes that start at C#8 and published it elsewhere. What is the best way to communicate source file and a few pictures.
I can do the pictures:
This is a test bed. The Top Octave Generator is the blue PCB, an Arduino pro mini clone I think. The program was loaded via FT232 adapter using the multicolour ribbon, left connected to supply power. The black and white jumpers are for testing the outputs, black is earth, the white is moved to one of the 12 pins. The rather disreputable brown board is a divider to get line input levels to feed to the PC sound card.
I used a program AUdio Measurement system downloaded from SourceForge. This is its analysis of an A note. It thinks it is 7040Hz, which is what it should be.
It also has an “oscilloscope” function. This is a different note. Although the input should be a square wave, the crude divider, limitations of the sound card, and the digitising process round off the shoulders considerably.
All I would need is the code and pin out of MCU as I have made my own custom ATMega328P boards before, and know how to implement both SPI and serial communication, check out my arcade hat on my github where i have done this, and used it as a coin pool.
Plus the arcade hat v2 build on my youtube channel shows me assembling my own MCU solution.
This rounding is probably due to the limitations of the sound card which is probably limited to audio frequencies.
Looking at the top and bottom of that trace I would guess the bandwidth cuts off at somewhere not far above the 3rd and 5th harmonic of the fundamental.
A decent square wave will have all the odd harmonics to 11th, 13th or even 15th or maybe even more. If you can measure the 10% to 90% rise time of the square wave and convert twice that (I think from memory) to frequency you will get a very good indication of how many harmonics are involved. Of course the native rise time of the instrument should be something like 10 times better than the measured waveform or the results will be pretty meaningless. This is where knowing the limitations of your test equipment is a must to be able to analyse with any degree of certainty.
I recently saw a U-Tube demo of some “amateur” checking out an oscilloscope with a published bandwidth (-3db) of 100MHz. He fed a 100MHz (???) square wave into it and because the instrument did not produce a “square” wave he categorically decided the scope did not meet specification. What a joke. The scope would need a bandwidth of something like 1GHz plus to do that. The highest decent “square” wave that scope would display would be about 10MHz.
But as I said, you don’t need a 100MHz instrument to be very useful, One of mine is a modest 25MHz and I have found this to be adequate. Better in some ways, as the higher bandwidth allows you to see worrying bits that do not really matter and are quite possible put there by an improperly adjusted probe.
My other one is quoted as 100MHz but I take that with a grain or two of salt. But is more portable and easier to get screenshots. The important thing is I know the limitations of both.
Cheers Bob
It’s a blocking capacitor. 100k/10k divider, the cap is feeding the audio to the sound card. Just removing the DC bias. May not be needed. This was never intended to be anything more than proving there was in fact output from all the pins. Some of the frequencies are above my hearing! I was surprised at how good a result I got from a free program and throwing a few parts together. I don’t have any test gear (except a multimeter) so this avoided the need to find someone nearby to do testing.
Hi Alan
You are right. I really should have looked closer. Forget I said that bit. Will try to remove it in case anybody else gets fooled.
Cheers Bob
You then learn to improvise which you have done pretty well.
Would be interested to know just what the bandwidth of your sound card is if it is published.
Hi Alan
Just had a closer look at that spectrum analysis. You see the fundamental at 7040Hz as indicated then the next spike at about 20 something kHz which would be the 3rd harmonic I mentioned. Then nothing, whichI suspect is the limit of the sound card.
If you do the same thing at about 1kHz you will see what I mean by all the odd harmonics.
Cheers Bob
I have copied all the Top Octave Generator data to SourceForge. The link is https://sourceforge.net/projects/top-octave-generator/
Two versions of the program are uploaded, the one for the Lyrebird project is in folder A7toGsharp8. If there are modifications needed, this is where they will be updated.
Could you give a pin out of assigned pins of the atmega328, as it will take me a bit of time to figure out from the code, assembly on the atmega is not a strong ability.
You are unlikely to be able to figure it from the code. However, the pinout is both in the README file in the folder with the asm and hex, and also in the source asm introductory comments.
Sorry I did not have a closer look, thanks for that, in the interest of simplifying, I’ll adjust the design to use the atmega, which has reduced the complexity and cost of the project.
I’ll implement it on the board directly, as using the plug in development board would make it on the bulky side, as to put it on the instrument card, would be just the atmega, a 16mhz crystal, a few caps, and a resistor, and two sets of pin headers for programming.
Sorry there has not been much traction on this, been busy with my day to day life, plus have spent time on another large project that’s been in the pipeline since November 2022.
I’ve finally got working after many failures, or hiccup’s, and also using neo pixels in the project. It’s my arcade HAT, and also leads onto my CM4 version of this project.