Тёмный

Using an AY-3-8910 programmable sound generator with an Arduino 

InternalRegister
Подписаться 246
Просмотров 9 тыс.
50% 1

Step-by-step video on how to use an AY-3-8910 programmable sound generator with an Arduino UNO.
Source code and schematics here: github.com/internalregister/A...
0:00 Intro
1:30 AY-3-8910 Capabilities and internal working
7:20 AY-3-8910 Clock Intro
9:05 Clock signal from the Arduino
11:05 Deciding pin assignment
16:16 Connecting the AY-3-8910 to the Arduino
20:26 Output circuit
24:54 Writing Arduino test code
30:42 Calculating AY-3-8910 tone period
34:42 First test
35:18 Improving the project
36:05 YM file format
36:45 YM converter script
37:53 Explaining the custom file format
39:22 Changing the Arduino code
42:19 Completing the project and testing it
Corrections:
21:03 The 3.3K resistor should be connected to GND and not VCC
23:13 In the diagram, the 3.3K resistor should be connected to GND and not VCC

Наука

Опубликовано:

 

5 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 52   
@SammYLightfooD
@SammYLightfooD Год назад
Finally playing around with my ZXSpectrum, after years, I learned about the 8910. Very nice Arduino project!
@2150dalek
@2150dalek Год назад
Very coOL. I'd like to try that now that you laid this out nicely Thank you for the fun post!
@Nathan-mu8zy
@Nathan-mu8zy Год назад
this video was so helpful im building a full synthesizer based on this chip now complete with a adsr and other cool features
@BOBLAF88
@BOBLAF88 6 месяцев назад
Great video! A wonderful tour of :Data Sheets,ARDUINO and the AY-3-8910. I like the frame adjustment at register 16 and the reasoning is just very thorough! Now if we could get larger industries and governments to apply themselves with the same respect we could rest a little easier 🤔😎
@peterhutt4807
@peterhutt4807 2 года назад
Awesome video, thanks for all the explanations.
@internalregister974
@internalregister974 2 года назад
Thank you 🙂
@achalasamapriya2701
@achalasamapriya2701 3 месяца назад
Awsome project
@xotmatrix
@xotmatrix 2 года назад
Very helpful.
@internalregister974
@internalregister974 2 года назад
Thanks! 🙂
@b213videoz
@b213videoz 6 месяцев назад
Now AY3's frog croacking on Arduino 😁
@robertmonroe9728
@robertmonroe9728 2 года назад
There are AVR chips with 8080 compatible parallel interface, you can map this chip regs to ram space. Stm32 has FSMC for that
@internalregister974
@internalregister974 Год назад
I didn't know some AVR microcontrollers could interface with it using a compatible interface, I've only used some 8-bit AVR micros and I've never used an STM32 microcontroller either, so I had no idea, but it's good to know, maybe I'll try it out one of these days. Thanks.
@siriokds
@siriokds Год назад
Hi, have you ever used the FSMC to interface the STM32 (f429?) to a zip system?
@JakeTheCake254
@JakeTheCake254 4 месяца назад
Hi I just put your circuit together to verify my AY-3-8910s I have just received are working, and they are! Thank you for the demonstration circuit, and really cool YM converter code! I would like to ask if you have an idea as to how the latching registers are able to respond to the speed of the Arduino? It runs at 16 MHz and so I'd imagine the writes to port D are really fast compared to the 2MHz clock on the AY-3-8910, and I don't really see how it can latch signals going at that speed. Unless the initial setup for the clock also set the Arduino clock to that speed? not sure. Please let me know your thoughts. Thanks!
@matthewlister3755
@matthewlister3755 2 года назад
I thought I commented earlier but I don't see my comment now. I believe my comment was full of praise but if I somehow offended you and it was removed I am truly sorry. On the contrary this project has been nothing short of amazing, as I have been trying to find a way to play back files I create in Arkos Tracker 2 on actual hardware. I live in the US so simply buying a ZX Spectrum or Amstrad CPC is out of the question, being too expensive to get around the issues of the PAL format and the voltage of standard US electrical outlets, not to mention the cost of importing the computer from the UK. This was a great, low cost option and I can not thank you enough. My problem now is the fact that this project seems to only work with noise and square waves. When I try to add the so called "hardware curve" (that's the terminology Arkos tracker 2 uses) that allows me to go beyond simple square waves I get silence. Do you have any idea what could be causing that? Again, and I can't stress this enough, thank you for everything you have done. I've been making music in Arkos Tracker 2 for a while now and I've always wanted to play the music I've made back on the actual soundchip. I can't thank you enough for giving me an ultra low cost option to do so. You're the best and when I release an album of AY-3-8910 chiptunes you will be credited because without you none of this would have been possible.
@internalregister974
@internalregister974 2 года назад
Ok, so unfortunately I know very little about music and composing it, however I have downloaded the Arkos Tracker 2 and managed to create a test using the "hardware curve", this is the term they use for hardware envelope, registers 11, 12 and 13 of the AY-3-8910 that I didn't mention in the video, but it should all work as you're sending raw data to the chip. I put the project back together over here and I think I managed to replicate the sound of the tracker sample I created. Also right now I'm playing the example that came with the tracker named Hocus Pocus and it seems to play ok even though it has some instruments using "hardware curve". It could be that the registers might be changing too fast in your case and the Arduino can't keep up, have you tried using the example "AY-3-8910_sd_card_2.ino" from my repository, I think it works a bit better with this, it uses a buffer and an extra timer. If this still doesn't work, I'm not sure what it could be, but you can send me a small example that won't work in your project to internalregister (at) gmail (dot) com and I'll have a look. And I didn't remove any comment, I'm glad you're finding the project useful 🙂
@matthewlister3755
@matthewlister3755 2 года назад
@@internalregister974 email sent! Not sure why I thought my comment was removed. Most likely I wrote it and forgot to post it. Then I wonder why I'm having problems with this arduino project. Ha! I'm pretty forgetful and I botch really simple things all the time. Thank you so much!
@artotrogus
@artotrogus Год назад
Great video, thanks! The 3.3k pulldown resistor seems to be connected to high instead of ground on the schematic, you might wanna fix that.
@internalregister974
@internalregister974 Год назад
Thanks for the heads-up. I've added a correction to the video for now. although it's not a perfect solution.
@ceesandcam
@ceesandcam 2 года назад
Hello, very interesting project! can't wait to get started on it. in the early years of this chip I came across it in video games and pinball machines. never forgotten, but haven't been able to do anything with it until now, I hope, the parts are ready Nice project to start and build on. my question, can you also put MIDI files (.sng) directly on the sd card and play them here? thanks in advance, gr, Cees
@internalregister974
@internalregister974 Год назад
I decided to go for a custom file format to make it more effecient for the Arduino to stream data to the audio chip. The Arduino is a slow chip interfacing with the SD card and the AY-3-8910 so it seemed like the best approach. I don't have a lot of experience with MIDI files, in theory it would be possible to convert some MIDI files to play on this audio chip taking into account it's limitations, of course (3 channels, common volume, etc), but I don't know if the Arduino is powerful enough to stream MIDI files and decode them in real-time. So this project just uses SNG files (I file format I came up with and decided for the SNG name, because it sounded right). And thanks for the feedback.
@carranen
@carranen 9 месяцев назад
Do you plan to use AY-3-8910 as a midi synth and if yes, how to implement this on the code ? Nice tut man!
@internalregister974
@internalregister974 7 месяцев назад
I think the AY-3-8910 is somewhat limited as a MIDI device. So no I never thought of doing that. And thanks for the feedback 🙂
@nicolacalderone6788
@nicolacalderone6788 2 года назад
It's a good job, these days I'm reproducing the project. Unfortunately, the python script does not successfully convert files from the .ym format. It always returns me errors related to "Invalid header in input file" or "Error reading input file: 'ascii' codec can't decode byte 0xb5 in position 0: ordinal not in range(128)". I have tried with tons of different YM files from different sources and unfortunately, it doesn't work. It's a shame. we have to improve the script, but I am not capable by myself.
@internalregister974
@internalregister974 2 года назад
Let me try to help you. That error means the header (the first four bytes) are not in ASCII, which means it's not an uncompressed YM file (the first bytes should be something like "YM3!" all the way to "YM6!"). Most YM files are compressed and my script doesn't support that, so it's possible you're using a compressed one. Try opening the YM files you have in 7zip or a similar application if using Windows or in UNIX use the "lha" tool to extract the file ("lha x file.ym"). Hope it helps and that you can replicate the project!
@maximjacquet2942
@maximjacquet2942 Год назад
Where do you put the YM file? Your script just tells me no file found so where in my directory would I put my YM files?
@maximjacquet2942
@maximjacquet2942 Год назад
I really don’t understand how the script works and don’t understand python too so I’m pretty lost
@davidknab8299
@davidknab8299 Год назад
Great project. I was having trouble translating this into using the Arduino Mega so I went ahead and got the Uno and it works just fine. I'm now trying to play downloaded YM files after being converted to SNG. It seems that I convert the files ok as my screen after conversion looks like yours. But when I look at the file with Notepad++ for example, I don't really see the 5 bit header. Here's one example of the first part of line 1 SNG SOH NUL NUL ; SOH NUL STX Is this what I should be getting? When I plug in the SD card all I get is some random noise. Any thoughts?
@internalregister974
@internalregister974 Год назад
Hi and thanks. You're looking at the file using a text editor, but the file is binary, you'de have to use something like Frhed to view it correctly. Maybe my explanation was misleading, but the file is actually stored in binary and not text to make it more efficient.
@davidknab8299
@davidknab8299 Год назад
@@internalregister974 I did assume it could be possibly something other than a text file but was hoping it might be viewable to see if it was converted properly since I am having problems reading the file from the SD card but I can run the test program just fine. Any thoughts? Do you have a file already converted that i could try on my end to see if it works?
@internalregister974
@internalregister974 Год назад
@@davidknab8299 if you're on some UNIX compatible system, like Linux, MacOS or WSL in Windows, maybe the tool "xxd" can help. Let's say you have a file "output.sng": Using the command: xxd -c 2 -i -s 5 output.sng It skips the header and outputs the pair register value of the SNG file. If you want to output this to a file (output.txt) just do: xxd -c 2 -i -s 5 output.sng > output.txt The result is in hexadecimal but maybe it's good enough for you to see the content of file.
@davidknab8299
@davidknab8299 Год назад
@@internalregister974 I do already program using 6502 and Z80 languages so I have a programmer that reads and writes hex info and writes it to eeproms. I opened one of the output.sng files and the first six bits (or bytes) are 53 4E 47 01 00 00 Is this what you'd expect?
@internalregister974
@internalregister974 Год назад
@@davidknab8299 That's correct, the header should be: 'S' 'N' 'G' 1 0 in hexadecimal 0x53 0x4e 0x47 0x01 0x00 The next value is part of the register, value pair of the content of the file.
@Carlou_
@Carlou_ Год назад
Thx for the video but i don't understand why the register R10 is 8? (sorry i'm french) Edit: ok, it's 10 octal so 8 decimal?
@internalregister974
@internalregister974 Год назад
Because the number of the is in octal (système octal) and not in decimal. 10 in decimal is of course ten, 10 in binary is 2, 10 in hexadecimal is 16 and 10 in octal is 8. Octal numbers only have 8 digits so counting up it goes like this: 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12 ... 17, 20, ... So 10 is actually the 8th number. It's not that common to see octal numbers in the wild, but they do pop up sometimes. (Just noticed your "edit" and that's right.)
@kennycheng4756
@kennycheng4756 2 года назад
I would like to ask: The issue for me is, when I tried to play 2 same notes (For example CC), with 400 delay, the sound would be like one note but 800 delay, how can I solve this problem?
@internalregister974
@internalregister974 2 года назад
So if I understand correctly you want to play the same note twice as if you were in the piano and played the same key twice. When you tell the AY-3-8910 to "play a note" this means "emit a sound with a certain frequency" it will continue to do so until you change its state to do something else, sending the same command twice will not change the state and so it'll continue to do the same. I think that what you want to do can be achieved by setting the chip to play a note for 400ms then mute the chip for say 100ms and then play the same note for 400ms and that way you'll hear the same note being played twice, basically putting a silence gap between each note. A more complex and maybe better sounding alternative would be to decrease the volume while the note is being played (fade out), either doing it manually or using an appropriate envelope and resetting it when you play another note, that way you would also notice the two notes being played. I hope this helps.
@kennycheng4756
@kennycheng4756 2 года назад
@@internalregister974 Thanks for the solution. It helps a lot. But how can I mute the chips by using Arduino? Because there is no mute() there.
@internalregister974
@internalregister974 2 года назад
@@kennycheng4756 My guess is you're using the code I provided and trying to change it a bit. In the video, I explain how you can interact with the chip, you can't use the native functions of the Arduino, all the bit-banging is done in the code. Even though I haven't used all the functionalities I try to show where you can find them and use them. For example, if you watch the video in minute 29:05 for example, you can see the table of registers, I mention the Amplitude register (amplitude = volume). So, if you're using channel A as I was using in the example, to mute that channel, write to register 8 the value 0, and then before you play the next note set it back to value 15 for full volume.
@kennycheng4756
@kennycheng4756 2 года назад
@@internalregister974 Thanks a lot for your explanation, I am going to make some musics for my school projects. Thank you so much!
@internalregister974
@internalregister974 2 года назад
@@kennycheng4756 You're welcome.
@marisakirisame867
@marisakirisame867 7 месяцев назад
Bro could you do Arduino with FM synth chip?
@internalregister974
@internalregister974 7 месяцев назад
I was actually thinking of finishing another video which is completely unrelated to this 😅. But I do have some FM synth chips around here and I have used the YM3834 with an Arduino once, so maybe I'll do a video one of these days, it's just that I haven't had much time for hobbies lately, my life got a bit busier.
@TheFreaxTux
@TheFreaxTux 7 месяцев назад
I have googled the name of the sound chip and there was a library already existing. Any particular reason you chose not to use it?
@internalregister974
@internalregister974 7 месяцев назад
Good question. At the time I had another project where I used a soft-core implementation of this chip in an FPGA alongside a Z80 and I was trying to understand how this sound chip worked. I ended up using an Arduino to test everything until I got things working, later I decided to make a video explaining everything about the interaction of the 2 components, datasheets, etc, because I thought it would be a nice thing to do. Honestly I didn't even look for a library because it defeated the purpose. But it's an obvious good choice for anyone just wanting to use this chip with an Arduino, good point.
@TheFreaxTux
@TheFreaxTux 7 месяцев назад
@@internalregister974 I see. That sounds like a good reason to make a test code from scratch :)
@Flo_Resolution
@Flo_Resolution 2 года назад
What does the AY even stand for?
@washer_person
@washer_person 5 месяцев назад
Nothing. Its old ic
@timcoles2172
@timcoles2172 Год назад
can I borrow your code please. I would like to try to play sid files. great video
@internalregister974
@internalregister974 Год назад
Thanks. I can use the code however you like.
Далее
R.I.P. AY
14:39
Просмотров 10 тыс.
We Added Time Travel to Portal, it got Weird
11:41
Просмотров 383 тыс.
ЮТУБ БЛОКИРУЮТ?
01:52
Просмотров 761 тыс.
I Built 3 SECRET Rooms In School!
33:34
Просмотров 10 млн
AY-3-8910 Sound Generator with Arduino
9:26
Просмотров 4,1 тыс.
My modified Ben Eater 6502 Computer PCB!
11:51
Просмотров 39 тыс.
This $20 synthesizer sounds very nice indeed
11:45
Просмотров 53 тыс.
TMS9918A on Arduino
19:44
Просмотров 13 тыс.
Designing a simple analog kick drum from scratch
39:11
Просмотров 598 тыс.
A new OS for the Z80! [Open Source][Zeal 8-bit OS]
11:05
КАКОЙ SAMSUNG КУПИТЬ В 2024 ГОДУ
14:59