#ay38910 — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #ay38910, aggregated by home.social.
-
Кросс-трекеры: ретро-музыка на современном ПК
Я не раз обращался к теме музыкальных редакторов системы «трекер». Казалось бы, сколько можно, горшочек, не вари. Но этих программ насчитывается сотни, и несмотря на сходство до степени смешения, созданы они с разными намерениями, посвящены решению различных задач, а к их появлению привели исторические причины разной степени занимательности. В то же время, эта нишевая тема, развивавшаяся десятилетиями, почти не имела выхода за пределы специализированных сообществ в формате обзорных публикаций для массового читателя. А значит, можно и нужно продолжать её раскрывать. Сегодня уделю пристальное внимание явлению «кросс-трекеров» — программ для современных ПК и операционных систем типа Windows и Linux, позволяющих создавать музыку для различных старых компьютеров, игровых приставок и прочих подобных устройств, а точнее, для их музыкальных синтезаторов. Зачем, почему, что происходит, кто здесь — как обычно, сейчас разберёмся во всех этих животрепещущих вопросах.
https://habr.com/ru/companies/ruvds/articles/976554/
#трекер #tracker #звуковой_чип #soundchip #chiptune #sid #ay38910 #2a03 #pokey #ruvds_статьи
-
Ok, starting to get a little silly now, but I thought I'd try to use the AY-3-8910 as a 4-bit DAC for Mozzi synthesis...
https://diyelectromusic.com/2025/07/14/arduino-and-ay-3-8910-part-4/
-
Arduino and AY-3-8910 – Part 4
After Part 3 I started to go back and add MIDI, and changed the waveform on the touch of a button, and then started to wonder if I could add envelopes and so on.
And then it occurred to me, I didn’t really need to re-implement my own synthesis library, I could probably write a custom audio output function for Mozzi and get it to use the AY-3-8910 as a 4-bit DAC…
- Part 1 – Getting started and looking at playing YM files.
- Part 2 – Adding basic MIDI control.
- Part 3 – Basic experiments with direct digital synthesis.
- Part 4 – Using the AY-3-8910 as a 4-bit DAC for Mozzi.
- Part 5 – Driving four AY-3-8910s using my AY-3-8910 Experimenter PCB.
https://makertube.net/w/ast3HQ2a3fCanKy9Pr6qUc
Warning! I strongly recommend using old or second hand equipment for your experiments. I am not responsible for any damage to expensive instruments!
These are the key tutorials for the main concepts used in this project:
- Arduino AY3891x Library: https://github.com/Andy4495/AY3891x
- Arduino Nano AY-3-8910 PCB: https://github.com/GadgetReboot/AY-3-8910
- AY-3-8910 on synth DIY wiki: https://sdiy.info/wiki/General_Instrument_AY-3-8910
- Mozzi: https://sensorium.github.io/Mozzi/learn/
If you are new to Arduino, see the Getting Started pages.
Parts list
- Arduino Uno.
- AY-3-8910 chip.
- Either GadgetReboot’s PCB or patch using solderless breadboard or prototyping boards.
- 5V compatible MIDI interface.
- Jumper wires.
Mozzi Custom Audio Output
Mozzi supports a wide range of microcontrollers with a range of different output methods from PWM, built-in DACs, I2S, through to custom output options with DMA or something else.
I’m not going to go over how Mozzi works here, but here are details of how to run with the different audio output modes here: https://sensorium.github.io/Mozzi/learn/output/
The key option for me is MOZZI_OUTPUT_EXTERNAL_CUSTOM. There are a number of configuration options that must be set prior to include the main Mozzi file as follows:
#include "MozziConfigValues.h"
#define MOZZI_AUDIO_MODE MOZZI_OUTPUT_EXTERNAL_CUSTOM
#define MOZZI_AUDIO_BITS 8
#define MOZZI_CONTROL_RATE 64
#define MOZZI_AUDIO_RATE 16384
#define MOZZI_ANALOG_READ MOZZI_ANALOG_READ_NONE
#include <Mozzi.h>
#include <Oscil.h>
#include <tables/cos2048_int8.h>
#include <mozzi_midi.h>
#include <mozzi_fixmath.h>This sets up the audio synthesis parameters to 8 bit audio with a sample rate of 16384Hz.
Implementing a custom audio output this way requires two functions. One for the audio output and one to tell Mozzi when it is time to call the audio output function.
I would rather have used MOZZI_OUTPUT_EXTERNAL_TIMED which handles the calling at the correct AUDIO_RATE for me, but that relies on the use of the ATMega328’s Timer 1, but in this case Timer 1 is providing the 1MHz clock for the AY-3-3810.
But rather than implementing yet another timing routine, I just used the micros() counter to decide if it was time to generate audio or not.
void audioOutput(const AudioOutput f)
{
int out = MOZZI_AUDIO_BIAS + f.l();
ayOutput(0,out);
}
unsigned long lastmicros;
bool canBufferAudioOutput() {
unsigned long nowmicros = micros();
if (nowmicros > lastmicros+58) {
lastmicros=nowmicros;
return true;
}
return false;
}To get samples produced at the required 16384Hz sample rate means there needs to be one sample produced 16384 times a second. There thus needs to be a sample every 60uS. If I implement the above function checking for nowmicros > lastmicros + 60 then the resulting sound is slightly flat (in tuning). I’m guessing this is related to the overheads of the function call and logic, so I’ve gone with lastmicros+58 and that sounds pretty good to me.
My ayOutput() routine takes an 8-bit sample and cuts it down to the 4-bits required for a level on the AY-3-8910.
FM Synthesis on the AY-3-8910 (sort of)
I wanted to try the FM synth mode just to see what would happen and thought it would be interesting to switch between the carrier sine wave signal and the modulated signal by pressing the button.
Unfortunately, I just could not get the button logic to work, even though I could see the state of the pin (A5) changing.
Finally after an hour or so of puzzling why such an apparently simple test of logic wasn’t working, I realised what the issue must be. Mozzi, for the AVR microcontrollers, has its own fast ADC routines. It turns out that these were interferrng with using A5 as a digital input pin.
It is fairly easy to override the Mozzi fast ADC though by setting MOZZI_ANALOG_READ to NONE.
The Mozzi code has a carrier and modulator waveform running at audio rate and an index running at the control rate to bring the modulator in and out.
It is just about possible to see the FM modulation on the oscilloscope as shown below.
Of course, the AY-3-8910 isn’t actually doing FM synthesis itself. It is just acting as a 4-bit DAC, but it is still quite fun to see.
Closing Thoughts
This is all getting a little pointless really, as there is nothing being done that the Arduino Nano couldn’t do better on its own, but it is a bit of fun to see where this thread ends up.
There are a number of interesting angles now. One of which would be to utilise all three channels. This could provide a form of additive synthesis, it could perform some fixed interval additional oscillators, or it could be used for 3-note polyphony.
Now that Mozzi is running it is also possible to do anything Mozzi can do, and that includes implementing envelope generation.
Kevin
-
Arduino, AY-3-8910 and Mozzi
-
Arduino and AY-3-8910 – Part 2
Following on from my initial experiments in Arduino and AY-3-8910 this post looks at the sound generation capabilities in a little more detail and adds some basic MIDI control.
- Part 1 – Getting started and looking at playing YM files.
- Part 2 – Adding basic MIDI control.
- Part 3 – Basic experiments with direct digital synthesis.
- Part 4 – Using the AY-3-8910 as a 4-bit DAC for Mozzi.
- Part 5 – Driving four AY-3-8910s using my AY-3-8910 Experimenter PCB.
https://makertube.net/w/3CxNBDKu5Gm6MQzMcLZYz6
Warning! I strongly recommend using old or second hand equipment for your experiments. I am not responsible for any damage to expensive instruments!
These are the key tutorials for the main concepts used in this project:
- Arduino AY3891x Library: https://github.com/Andy4495/AY3891x
- Arduino Nano AY-3-8910 PCB: https://github.com/GadgetReboot/AY-3-8910
- AY-3-8910 on synth DIY wiki: https://sdiy.info/wiki/General_Instrument_AY-3-8910
If you are new to Arduino, see the Getting Started pages.
Parts list
- Arduino Uno.
- AY-3-8910 chip.
- Either GadgetReboot’s PCB or patch using solderless breadboard or prototyping boards.
- 5V compatible MIDI interface.
- Jumper wires.
AY-3-8910 Sound Generation
The most basic means of sound generation is to use the three tone generators to generate square waves at a frequency set using the on-chip registers (note in the following data from the datasheet, the R numbers are in octal – so there are 16 registers in total):
I don’t plan to get into the ins-and-outs of how to interface to the chip, instead I’ll link off to some excellent discussions here:
- https://github.com/Andy4495/AY3891x/blob/main/Register-Summary.md
- http://blog.tynemouthsoftware.co.uk/2023/01/driving-ay-3-8910-ym2149-from-8-bit.html
- Sections 2.4 and 2.5 in the AY-3-8910 datasheet.
The frequency registers have a 12-bit resolution, spread over two 8-bit registers as shown below.
The datasheet tells us how to calculate the value to write to the register for a specific frequency:
- Reg Value = System Clock / (16 * frequency)
For a 1MHz clock, the register value is thus 62500 / frequency, so the higher the frequency, the lower the register value. This means that concert A at 440Hz requires the value 62500 / 440 = 142, so:
- R1 = 142 >> 8;
- R0 = 142 & 0xFF;
For a 1MHz clock, the range of frequencies goes from 1MHz / 16 to 1 MHz / (16 * 4095) or ~62.5kHz to 15 Hz
The AY3891x library has a set of definitions that already defines the frequencies for each MIDI note from C0 to B8.
The volume for the note is set in another register:
When Mode=0, the amplitude is set by the 4-bit fixed level. When Mode=1, the amplitude is controlled by the built-in envelope generator.
The envelope generator is a “global” setting for all channels, so for finer control, people often wrote their own envelope generator, manipulating the volume levels directly.
The datasheet describes the four parameters required to define an envelope:
Envelopes have a cycle time, which is set by R13 and R14 in a similar way to the frequency. This time the formula is:
- Reg value = System Clock / (256 * env frequency)
Once again this is split over two registers, but this time supports a full 16-bit value.
There are graphical representations of what the combinations of the envelope bits mean, but I must confess I’m not entirely sure I understand them all and some don’t seem to sound, at least at the frequency I’ve chosen.
The Circuit
I’m reusing the PCB from GadgetReboot from Part 1, but this time I’ve added the button in (it is connected to A5 and GND) and added headers to the UART connection.
Unfortunately the UART only has GND, TX, RX – to use it with one of my Arduino MIDI Interfaces also requires a 5V connection, so I’ve taken that from the SD card header.
The Code
The note-playing code comes from the “AY3891x_EX3_Simple_Tone” example, including the ATmega328 specific code for the 1MHz clock. There is a table of note frequencies already provided for notes C0 through to B8, so it is just a case of mapping these onto MIDI notes C0 (12) through B8 (119).
One thing I wanted was to support simple polyphony using all three channels. But that means deciding what to do when a fourth note comes in – i.e. to ignore it or to replace one of the existing playing notes. I’ve left options for both.
I also wanted to make use of the channel volume too, so it is relatively trivial to map the MIDI 0..127 note velocity values onto the 0..15 levels for the sound generator. This is using the “fixed” level mode mentioned earlier.
But I also wanted the option to play with the envelopes, so I’ve wired in the button and have an option to use that to change between the different envelopes. As I’m not attempting anything particularly complex right now, I just gone with a fixed 10Hz frequency for the envelope generator’s cycle.
It won’t win any prizes for synthesis, but it does work.
Closing Thoughts
Fundamentally, without the envelope generation this is the same as a three-channel Arduino tone() function, but at the time that was pretty ground-breaking as it allowed a system to keep playing a tone without having to keep driving it from the CPU.
Add in the noise channel, amplitude control and envelopes and you can start to see why this is also a step up musically too.
But when you get to making custom, per-channel envelopes, or even manipulating the 4-bit level control as a simple DAC or PCM generator, then you can start to see how some of the outstanding chiptunes of the time could be generated.
But even in this simple form there is still a fair bit more that could be done. Some examples might be:
- Adding a potentiometer to control the envelope frequency. The when used with the triangle envelope this will act as a modulation control.
- Add MIDI control values for the volume levels, modulation and choice of envelope.
- Define some specific parameters to create “instruments” which can be selecting using MIDI program change messages.
- Get the noise generator into the mix and define some percussion “instruments” too.
But what I really want to do is start taking a look at some of the sound drivers that were written that allow some of the chip tunes to come out.
I’m also getting to the point where I want my own PCB with things on it that I want to play with too.
Kevin
-
Arduino and AY-3-8910 – Part 2
Following on from my initial experiments in Arduino and AY-3-8910 this post looks at the sound generation capabilities in a little more detail and adds some basic MIDI control.
- Part 1 – Getting started and looking at playing YM files.
- Part 2 – Adding basic MIDI control.
- Part 3 – Basic experiments with direct digital synthesis.
- Part 4 – Using the AY-3-8910 as a 4-bit DAC for Mozzi.
- Part 5 – Driving four AY-3-8910s using my AY-3-8910 Experimenter PCB.
https://makertube.net/w/3CxNBDKu5Gm6MQzMcLZYz6
Warning! I strongly recommend using old or second hand equipment for your experiments. I am not responsible for any damage to expensive instruments!
These are the key tutorials for the main concepts used in this project:
- Arduino AY3891x Library: https://github.com/Andy4495/AY3891x
- Arduino Nano AY-3-8910 PCB: https://github.com/GadgetReboot/AY-3-8910
- AY-3-8910 on synth DIY wiki: https://sdiy.info/wiki/General_Instrument_AY-3-8910
If you are new to Arduino, see the Getting Started pages.
Parts list
- Arduino Uno.
- AY-3-8910 chip.
- Either GadgetReboot’s PCB or patch using solderless breadboard or prototyping boards.
- 5V compatible MIDI interface.
- Jumper wires.
AY-3-8910 Sound Generation
The most basic means of sound generation is to use the three tone generators to generate square waves at a frequency set using the on-chip registers (note in the following data from the datasheet, the R numbers are in octal – so there are 16 registers in total):
I don’t plan to get into the ins-and-outs of how to interface to the chip, instead I’ll link off to some excellent discussions here:
- https://github.com/Andy4495/AY3891x/blob/main/Register-Summary.md
- http://blog.tynemouthsoftware.co.uk/2023/01/driving-ay-3-8910-ym2149-from-8-bit.html
- Sections 2.4 and 2.5 in the AY-3-8910 datasheet.
The frequency registers have a 12-bit resolution, spread over two 8-bit registers as shown below.
The datasheet tells us how to calculate the value to write to the register for a specific frequency:
- Reg Value = System Clock / (16 * frequency)
For a 1MHz clock, the register value is thus 62500 / frequency, so the higher the frequency, the lower the register value. This means that concert A at 440Hz requires the value 62500 / 440 = 142, so:
- R1 = 142 >> 8;
- R0 = 142 & 0xFF;
For a 1MHz clock, the range of frequencies goes from 1MHz / 16 to 1 MHz / (16 * 4095) or ~62.5kHz to 15 Hz
The AY3891x library has a set of definitions that already defines the frequencies for each MIDI note from C0 to B8.
The volume for the note is set in another register:
When Mode=0, the amplitude is set by the 4-bit fixed level. When Mode=1, the amplitude is controlled by the built-in envelope generator.
The envelope generator is a “global” setting for all channels, so for finer control, people often wrote their own envelope generator, manipulating the volume levels directly.
The datasheet describes the four parameters required to define an envelope:
Envelopes have a cycle time, which is set by R13 and R14 in a similar way to the frequency. This time the formula is:
- Reg value = System Clock / (256 * env frequency)
Once again this is split over two registers, but this time supports a full 16-bit value.
There are graphical representations of what the combinations of the envelope bits mean, but I must confess I’m not entirely sure I understand them all and some don’t seem to sound, at least at the frequency I’ve chosen.
The Circuit
I’m reusing the PCB from GadgetReboot from Part 1, but this time I’ve added the button in (it is connected to A5 and GND) and added headers to the UART connection.
Unfortunately the UART only has GND, TX, RX – to use it with one of my Arduino MIDI Interfaces also requires a 5V connection, so I’ve taken that from the SD card header.
The Code
The note-playing code comes from the “AY3891x_EX3_Simple_Tone” example, including the ATmega328 specific code for the 1MHz clock. There is a table of note frequencies already provided for notes C0 through to B8, so it is just a case of mapping these onto MIDI notes C0 (12) through B8 (119).
One thing I wanted was to support simple polyphony using all three channels. But that means deciding what to do when a fourth note comes in – i.e. to ignore it or to replace one of the existing playing notes. I’ve left options for both.
I also wanted to make use of the channel volume too, so it is relatively trivial to map the MIDI 0..127 note velocity values onto the 0..15 levels for the sound generator. This is using the “fixed” level mode mentioned earlier.
But I also wanted the option to play with the envelopes, so I’ve wired in the button and have an option to use that to change between the different envelopes. As I’m not attempting anything particularly complex right now, I just gone with a fixed 10Hz frequency for the envelope generator’s cycle.
It won’t win any prizes for synthesis, but it does work.
Closing Thoughts
Fundamentally, without the envelope generation this is the same as a three-channel Arduino tone() function, but at the time that was pretty ground-breaking as it allowed a system to keep playing a tone without having to keep driving it from the CPU.
Add in the noise channel, amplitude control and envelopes and you can start to see why this is also a step up musically too.
But when you get to making custom, per-channel envelopes, or even manipulating the 4-bit level control as a simple DAC or PCM generator, then you can start to see how some of the outstanding chiptunes of the time could be generated.
But even in this simple form there is still a fair bit more that could be done. Some examples might be:
- Adding a potentiometer to control the envelope frequency. The when used with the triangle envelope this will act as a modulation control.
- Add MIDI control values for the volume levels, modulation and choice of envelope.
- Define some specific parameters to create “instruments” which can be selecting using MIDI program change messages.
- Get the noise generator into the mix and define some percussion “instruments” too.
But what I really want to do is start taking a look at some of the sound drivers that were written that allow some of the chip tunes to come out.
I’m also getting to the point where I want my own PCB with things on it that I want to play with too.
Kevin
-
Русская «Ардуина»: первый взгляд любителя
Я — самодельщик-ардуинщик со стажем. Люблю пихать ардуины во всякие подходящие и не очень места. Как-то раз я уже показывал свою коллекцию Arduino-совместимых плат, и с тех пор она только росла и ширилась. Теперь в ней случилось особенное пополнение: русская (пока не) народная «Ардуина» ELBEAR от сибирской компании «Элрон» на базе отечественного микроконтроллера MIK32 «Амур», о существовании которой я узнал несколько дней назад из статьи на Хабре . В статье я изложу частный опыт искушённого любителя, который пытается импортозаместить зарубежную Arduino и приспособить данную плату для своих любительских нужд, не залезая в дебри. Конечно, это далеко не первая подобная публикация, с поездкой на поезде хайпа я припозднился примерно на годик. Зато она отражает актуальное положение дел и демонстрирует, чем чреват смелый прыжок веры прямо в неизвестность без предварительного изучения вопроса. К тому же, я не самый обычный ардуинщик. Вкусы мои специфичны: я не сделал ни одной метеостанции, мой дом глуп как пробка, и даже мои часы на Arduino — стрелочные. Вместо этого я делаю вещи, так или иначе связанные с электронными и видеоиграми, демосценой, звуком и музыкой с уклоном в ретро. И разнообразные ардуины мне нужны и интересны именно в этом контексте. А значит, есть шанс, что будет интересно.
https://habr.com/ru/companies/ruvds/articles/919202/
#ruvds_статьи #arduino #arduino_nano #arduino_uno #arduino_ide #ардуина #микроконтроллеры #микроэлектроника #ws2812 #adafruit #амур #мик32_амур #mik32_amur #amur #К1948ВК018 #микрон #элрон #ELBEAR #ELBEAR_ACEUNO #ELBEAR_ACENANO #AY38910 #ST7789 #SH1106 #ILI9488 #ili9341 #импортозамещение
-
A fascinating new look at what is basically an Apple II Mockingboard soundcard...for the PC...sold by Mindscape.
"Do you own the rarest PC sound card in the world?" -- https://www.youtube.com/watch?v=Eeo4INoGyRY
#AppleII #IBMPC #DOSPC #DOS #soundcard #soundboard #AY38910 #SweetMicroSystems #Mockingboard #Mindscape #chiptune #audio #PCaudio #soundblaster #adlib #vintagecomputing #retrocomputing #retrogaming #computinghistory #vintageapple #deepdive #video #gamers #games #interview #ADSR #nostalgia #tech