oh, btw.... I designed/built a hardware knobby controller for the YM2151, but Ive been lazy with the documentation
wow that's amazing! Will you make a video of it in action?
chipmusic.org is an online community in respect and relation to chip music, art and its parallels.
You are not logged in. Please login or register.
oh, btw.... I designed/built a hardware knobby controller for the YM2151, but Ive been lazy with the documentation
wow that's amazing! Will you make a video of it in action?
@Charbot
Please try these three things and tell me which ones work?Try to send a sysex with some other tool (e.g. Midiox) to the Arduino. Does the Tuning Change?:
Use this Pattern: f0 4d 54 [Value] f7
Where [Value] is something between 00 and 7fTry to connect "The Control App" -> "Virtual Midi Port" -> "midiOx". Can you see the Sysex Messages?
Follow this Tutorial on how to use MidiOx:
https://support.native-instruments.com/ ControllerTry to use an older Version of the Arduino IDE (Version 1.6.8 because i know this works, because I tested)
Btw: Which OS and which Version of Java do you use?
Ok- I used hexfiend and Sysex Librarian, respectively, to write and send the sysex tune message. Totally works. The issue is with the Java controller. Mine want a master tune value of 00.. strange that there is that much of a discrepancy between mine and yours.
Im using a mac w/ osx 10.11.6. java.... not sure what is going on here... Jar Launcher 15.0.1 is what is the default option to open,
MainJFrame Java 1.0 is what is running when the app is open.
Last edited by Charbot (Feb 21, 2017 6:49 am)
Charbot wrote:oh, btw.... I designed/built a hardware knobby controller for the YM2151, but Ive been lazy with the documentation
wow that's amazing! Will you make a video of it in action?
I plan to
@Charbot
OK, its a Problem with the Implementation of Midi in Java in Mac OS (It seems like this bug was there for ages). It prevents you from sending sysex messages in a Java app. But there are replacement libraries, which I can use. Will fix sometime soon.
The Master Tune Value you are using is not very much off from the Value I used. The Arduino will calculate [Value] - 63 so you are also able to tune downwards. In my case the real Value that got sent over Midi was 21. But both the Arduino and the Java app are using the range from -63 to 64.
Thanks for helping
Last edited by masl (Feb 21, 2017 11:09 am)
Was nothing- thank you for all your effort on this project.
I just sent you my version w/ master volume.
oh and feel free to email me any updates that you need tested. Happy to help.
Last edited by Charbot (Feb 22, 2017 10:37 pm)
Hey dudes! Fair warning, somewhat long post ahead.
I'm trying to build an Arduino YM2151 of my own, but I have an Uno R3, Protoshield v6 R3, and am using an MCP23017 because I need the inputs for a 37-key "keyboard" (5*8 multiplexed membrane buttons, to be exact, from a $30 "toy" electric piano from Rite Aid). I do not have the optocoupler anywhere in the circuit, as I don't see where in the original schematic it connects to the actual YM2151+YM3012+op-amp+audio output section of the circuit. I'm prototyping on a breadboard until I get audio.
The problem I have is I'm not getting audio!
I've spent a few hours cutting new wire because apparently my jumper wires from the YM3012 to the TLC2274 op-amp were frayed or something and I'm going over my code, modified from the various updates of the original Yukio Ishii code because I'm not doing direct I/O. The key difference is using the MCP for I/O instead of direct Arduino port manipulation, and my MCP-based ym_write is below:
// ... stuff ...
#define RD_HIGH (ym_pin_mask = ym_pin_mask | MUX_YM_RD)
#define RD_LOW (ym_pin_mask = ym_pin_mask & ~MUX_YM_RD)
#define WR_HIGH (ym_pin_mask = ym_pin_mask | MUX_YM_WR)
#define WR_LOW (ym_pin_mask = ym_pin_mask & ~MUX_YM_WR)
#define A0_HIGH (ym_pin_mask = ym_pin_mask | MUX_YM_A0)
#define A0_LOW (ym_pin_mask = ym_pin_mask & ~MUX_YM_A0)
#define IC_HIGH (ym_pin_mask = ym_pin_mask | MUX_YM_IC)
#define IC_LOW (ym_pin_mask = ym_pin_mask & ~MUX_YM_IC)
#define MCP_LED_HIGH 0x80
#define MCP_YM_STATUS 7
// ... stuff ...
//// on MCP23017, set A pins have YM2151's IC, A0, WR, RD, and an LED
//// set B pins have YM2151's 8 data pins
void ym_write(byte addr, byte data) {
//// TODO: wait for not busy
#if DEBUG_YM
Serial.print("ym_wr:"); Serial.print(addr,HEX); Serial.print(","); Serial.print(data,HEX); Serial.println("...");
#endif
bool waiting = 1;
unsigned wait_limit = 64, wait_i = 0; // hard-limit status waits to prevent potential infinite loops
byte can = MCP_LED_HIGH;
mcp.setPinModes(0, 0xff); // set I/O A pins to output/write, B pins to input/read
A0_LOW;
RD_LOW;
mcp.write_one_a(ym_pin_mask|can);
wait(4);
while (waiting) {
wait(4);
//RD_LOW; // commented out because don't need?
mcp.write_one_a(ym_pin_mask|can);
wait(4);
can = mcp.read_one_b();//&_BV(MCP_YM_STATUS); // ym_read_pin(D7) returns 1 while busy
//RD_HIGH; // commented out because don't need?
mcp.write_one_a(ym_pin_mask|(can&_BV(MCP_YM_STATUS))); // light LED if busy
wait(4);
#if DEBUG_YM
Serial.print("...wait:"); Serial.print(wait_i); Serial.print(","); Serial.print(can,HEX); Serial.println("...");
#endif
if (can==0) {waiting = 0; /*Serial.print(wait_i); Serial.println(":done waiting");*/}
else wait(4);
wait(12);
++wait_i;
if (wait_i>16) wait(4);
if (wait_limit) {
if (wait_i>wait_limit) waiting = 0;
}
}
wait(4);
RD_HIGH;
mcp.write_one_a(ym_pin_mask);
wait(4);
#if DEBUG_YM
if (wait_limit&&wait_i>wait_limit) Serial.println("Too long reading, early break");
#endif
mcp.setPinModes(0, 0); // set I/O A pins to output/write, B pins to output/write
A0_LOW; // addr mode
mcp.write_one_a(ym_pin_mask|MCP_LED_HIGH);
mcp.write_one_b(addr);
wait(4);
WR_LOW;
mcp.write_one_a(ym_pin_mask|MCP_LED_HIGH);
wait(4);
WR_HIGH;
mcp.write_one_a(ym_pin_mask|MCP_LED_HIGH);
wait(2);
A0_HIGH; // data mode
mcp.write_one_a(ym_pin_mask|MCP_LED_HIGH);
wait(2);
mcp.write_one_b(data);
wait(4);
WR_LOW;
mcp.write_one_a(ym_pin_mask|MCP_LED_HIGH);
wait(4);
WR_HIGH;
mcp.write_one_a(ym_pin_mask);
wait(2);
}
The debug serial prints are telling me that the status loop at the beginning of ym_write isn't executing properly, usually displaying the value of the previous data write as if it was latched by the MCP or something before write instead of the proper status value. I also have an LED attached to the two audio outputs that's glowing a constant dim red as if there's some modulated output.
Anyone here have any ideas on how to fix it?
Last edited by neologix (Feb 24, 2017 3:40 am)
I dont even know where to begin...
I think that you'd be better off by building the YM/arduino synth as-is (using a standard midi keyboard for testing); then build a midi controller w/ the toy keyboard and using a separate arduino . Then when both are working, you can attempt to merge the two the sketches to run on on a single arduino.... but by then you might realize that there is no need- even the cheapest midi controller will have a better keybed than the CVS toy.
Last edited by Charbot (Feb 24, 2017 9:25 pm)
@Charbot - I would love to eventually do something like that, but I'm limited to what I currently have (all the pieces from the original BOM without MIDI) due to money reasons. To actually have enough I/O pins for my project (which also includes an LCD shield that has an MCP of its own, so no extra pins needed) I had a choice between hooking the YM or the 5*8 membrane buttons to the MCP and I chose the YM, though nothing is soldered in stone yet so to speak. I tried doing the original schematic and code with direct port manipulation but no sound came out, and the only MIDI keyboard I have is a Korg K49 USB MIDI keyboard.
I know the pins themselves and the MCP work because everything but the sound generation actually does what I intended.
well to start, youll need to hook it up to an amplified speaker. It sounds like you said that you have an led on the output... In not so sure that it will flash w/ output the way that you are expecting. beyond that, the issue could be anywhere ....software, hardware..... both? Thats why Id reccomend sticking to a known entity- verified code to test your hardware setup... then experiment on code with verified hardware. Beyond that, I dont think that I can help. sorry
Last edited by Charbot (Feb 25, 2017 3:57 am)
I switched the wires and code back to the direct I/O version and swapped back in the 3.5mm stereo jack with headphones instead of LED. Still no audio output and while running Serial Monitor ym_read (and the read status loop) still returns the last data written by ym_write.
Amplified output. Dont think the op amp has enough oomph to drive headphones.... but it sounds like you potentially have other issues.
Update: I got it to work!!!! I had read the MSX expansion sound card SFG-01/05 schematic today (here, here, here, here) and the key wiring difference between the SFG schematic and previous incarnations of the Arduino/Raspberry Pi YM2151+YM3012 schematic I've read (especially any based off the original design) is the wiring to the op-amp.
Basically, other than the photocoupler wiring which is apparently used for the MIDI input that would drive activation of the overall circuit, every non-SFG schematic had one significant thing different from the working SFG-based approach I used: the YM3012-to-op-amp connection was wired differently.
Every non-SFG schematic had op-amp 1 output bridged with op-amp 1- and one connection to YM3012 pin 13 (V/2 or MP) bridged with pin 14 (BIAS1 or BC). YM3012 pins 9 (ch 1) and 10 (ch 2) connected to op-amp 3+ and 4+ through resistors in series, with capacitors as noted.
The SFG had both sides of the YM3012-to-op-amp 1 connection unbridged, op-amp 1 output to YM3012 pin 13, and op-amp 1- to YM3012 pin 14. YM3012 pins 9 and 10 connected directly to op-amp 3+ and 4+ without any resistors in between, with relatively no change to locations of capacitors in the circuit.
Regarding the op-amp-to-audio output, I found that one could get similar working results by either connecting the final capacitor's ground to the audio output's channel in series or by grounding that capacitor and instead connecting the final resistor to the audio's channel. In practice, I could not perceive any significant difference in resulting audio volume through the headphones.
So! After connecting the membrane button strip, my final step before eventually putting everything into the piano housing is to connect the audio output to speakers. I have two 4 ohm 3W piezo speakers that as of yet do not work with the circuit I as I currently have it. How should I fork the op-amp's output to successfully play through the speakers? Do I need an external amplifier circuit like this MAX98306 I bought from Adafruit and if so what's the recommended wiring from the op-amp to the MAX98306?
Great. You should post your final schematic and code.
You will prob want an amplifier of some kind to drive a speaker (effectively). Personally, Id have at least a line out jack on there too, for if you every wanted to record or perform/play at any volume
Last edited by Charbot (Mar 4, 2017 4:48 pm)
Great. You should post your final schematic and code.
Yea, I'm Fritzing-ing the board currently and will GitHub the cleaned up code after.
You will prob want an amplifier of some kind to drive a speaker (effectively). Personally, Id have at least a line out jack on there too, for if you every wanted to record or perform/play at any volume
Re amplifier - would it connect directly to the 3 OUT and 4 OUT of the op-amp or does it need to be after the capacitor like the stereo jack?
Re line out - wouldn't the existing stereo jack and circuit work for line out or would I need a different jack and circuit?
Hello everyone, I'm starting my YM2151 + Arduino world and I really like this forum. I'm trying to build a PCB based on the Arduino Pro MINI as suggested. However, I did not find the parts list complete. In one of the images available, has almost everything, but some resistors and capacitors are missing, can they help?
Hello everyone, I'm starting my YM2151 + Arduino world and I really like this forum. I'm trying to build a PCB based on the Arduino Pro MINI as suggested. However, I did not find the parts list complete. In one of the images available, has almost everything, but some resistors and capacitors are missing, can they help?
Moi? Ill try to check my github soon. apparently there is at least one other error with the stuff i posted.