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

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ธ.ค. 2024

ความคิดเห็น • 55

  • @Nightshft42
    @Nightshft42 2 ปีที่แล้ว +4

    Finally playing around with my ZXSpectrum, after years, I learned about the 8910. Very nice Arduino project!

  • @pKremer
    @pKremer 4 หลายเดือนก่อน

    Great video!! the script and SNG format were very helpful, thanks!

  • @Nathan-mu8zy
    @Nathan-mu8zy 2 ปีที่แล้ว +3

    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 11 หลายเดือนก่อน

    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 🤔😎

  • @2150dalek
    @2150dalek 2 ปีที่แล้ว +1

    Very coOL. I'd like to try that now that you laid this out nicely Thank you for the fun post!

  • @peterhutt4807
    @peterhutt4807 2 ปีที่แล้ว +2

    Awesome video, thanks for all the explanations.

  • @robertmonroe9728
    @robertmonroe9728 2 ปีที่แล้ว +1

    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  2 ปีที่แล้ว

      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 2 ปีที่แล้ว

      Hi, have you ever used the FSMC to interface the STM32 (f429?) to a zip system?

  • @tubeDude48
    @tubeDude48 หลายเดือนก่อน

    Middle C is 261.63 Hz Wish you had taken this a bit further. I was just beginning to enjoy this project!

  • @masoudsh5133
    @masoudsh5133 2 หลายเดือนก่อน

    nice Arduino project!

  • @artotrogus
    @artotrogus 2 ปีที่แล้ว +1

    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  2 ปีที่แล้ว +1

      Thanks for the heads-up. I've added a correction to the video for now. although it's not a perfect solution.

  • @JakeTheCake254
    @JakeTheCake254 9 หลายเดือนก่อน

    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 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      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!

  • @EuphCat
    @EuphCat 11 หลายเดือนก่อน

    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  11 หลายเดือนก่อน +1

      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.

    • @EuphCat
      @EuphCat 11 หลายเดือนก่อน

      @@internalregister974 I see. That sounds like a good reason to make a test code from scratch :)

  • @carranen
    @carranen ปีที่แล้ว

    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  11 หลายเดือนก่อน

      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 🙂

  • @achalasamapriya2701
    @achalasamapriya2701 8 หลายเดือนก่อน

    Awsome project

  • @maximjacquet2942
    @maximjacquet2942 2 ปีที่แล้ว

    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 2 ปีที่แล้ว +1

      I really don’t understand how the script works and don’t understand python too so I’m pretty lost

  • @nicolacalderone6788
    @nicolacalderone6788 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +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!

  • @Carlou_
    @Carlou_ 2 ปีที่แล้ว

    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  2 ปีที่แล้ว +1

      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.)

  • @Flo_Resolution
    @Flo_Resolution 2 ปีที่แล้ว +1

    What does the AY even stand for?

    • @washer_person
      @washer_person 10 หลายเดือนก่อน

      Nothing. Its old ic

  • @davidknab8299
    @davidknab8299 2 ปีที่แล้ว

    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  2 ปีที่แล้ว

      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 2 ปีที่แล้ว

      @@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  2 ปีที่แล้ว

      @@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 2 ปีที่แล้ว

      @@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  2 ปีที่แล้ว

      @@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.

  • @marisakirisame867
    @marisakirisame867 ปีที่แล้ว

    Bro could you do Arduino with FM synth chip?

    • @internalregister974
      @internalregister974  11 หลายเดือนก่อน

      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.

  • @xotmatrix
    @xotmatrix 2 ปีที่แล้ว

    Very helpful.

  • @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 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      @@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 ปีที่แล้ว +1

      @@kennycheng4756 You're welcome.

  • @timcoles2172
    @timcoles2172 2 ปีที่แล้ว

    can I borrow your code please. I would like to try to play sid files. great video

  • @b213videoz
    @b213videoz 10 หลายเดือนก่อน

    Now AY3's frog croacking on Arduino 😁

  • @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  2 ปีที่แล้ว +1

      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.