Skip to content

Instantly share code, notes, and snippets.

@yandod
Last active July 2, 2017 11:55
Show Gist options
  • Save yandod/2c79bdbee5689f389a6827fb290c245f to your computer and use it in GitHub Desktop.
Save yandod/2c79bdbee5689f389a6827fb290c245f to your computer and use it in GitHub Desktop.
#include <YMZ294.h>
#include <Wire.h>
#define ADDR_FREQ_A CH_A
#define ADDR_FREQ_B CH_B
#define ADDR_FREQ_C CH_C
// Output Pins
const byte WRCS_PIN = 8;
const byte A0_PIN = 9;
const byte RESET_PIN = 10;
YMZ294 ymz(WRCS_PIN, A0_PIN, RESET_PIN);
void set_ch(Channel ch, int note) {
if(ch==CH_A || ch==CH_B) {
ymz.SetEnvShape(1,0,0,1);
ymz.SetEnvFrequency(15);
}
ymz.SetFrequency(ch, noteFreq[note]);
}
void user_delay(int time) {
delay(time / 1.1);
}
void setup() {
DDRD = 0b11111111;
pinMode(WRCS_PIN, OUTPUT);
pinMode(A0_PIN, OUTPUT);
pinMode(RESET_PIN, OUTPUT);
ymz.Reset();
ymz.SetMixer(0b111, 0b000);
ymz.SetVolume(CH_A, 0b00001110);
ymz.SetFreqBit(CH_A, 0);
ymz.SetVolume(CH_B, 0b00001110);
ymz.SetFreqBit(CH_B, 0);
ymz.SetVolume(CH_C, 0b00001111);
ymz.SetFreqBit(CH_C, 0);
ymz.SetEnvEnable(CH_A, false);
ymz.SetEnvEnable(CH_B, false);
ymz.SetEnvEnable(CH_C, false);
}
void loop() {
playSong();
}
void playSong() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment