@masi:
I've tried to replay a multi-channel midi with the YM2151 shield. I've imported some OPM instruments, which I've mapped using the java application (instrument 1 to channel 1, instr. 2 to chan. 2 etc)

The problem is I can't play instruments according to the channel choosen, either using a virtual keyboard which can choose which channel to play, or with my midi sequencer. It seems only the latest loaded instrument is played, regardless of the channel used. I've also used the "sync instruments" option, reset the arduino, but it's the same.

Now I'm wondering about this "poly mode" and "set poly instrument", I assumed it was for being able to play several instruments at the same time, but I haven't tried to remove the option yet (I don't have access to the shield at the moment), maybe it's for something else and interfere with the midi...

ok, it is what I supposed: the "poly instrument" mode prevents to play the instruments individually. I don't know why it's enabled by default. If I read correctly in the source code, it starts when the first instrument loads, but if you load other instruments you have to disable the mode. [EDIT] Now I know what the poly instrument means, I've discovered it while playing from a real keyboard: it for polyphony, to be able to play chords. Otherwise it would be only monophonic.

So now it's almost perfect.

Some thoughts:

- For better editing the instruments, having the value associated to the knobs would be helpful:
either when turning the knobs, or better, permanently (it could be close to the name, like "level, mul, det1 etc")

- The theme could use the java nimbus theme
http://docs.oracle.com/javase/tutorial/ … imbus.html

It seems I can start it this way:

java -jar -Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel YM2151-Controller.jar

So thank you Yukio Ishii for the original design, thank you Synthy for the new boards and developments, thank you Masi for the improvements (multichannels) and thank you Charbot the new design with a smaller arduino!

Here is a quick recording from the 2151 shield, with 6 different instruments: http://picosong.com/zKZk
I should tweak more some instruments but it's for giving an idea.

It's a cover of a PC-98 tune (different chip, YM2608, but the FM synthesis is similar): http://battleofthebits.org/arena/Entry/ … set/22807/ (this version is using an emulator)

Last edited by garvalf (September 3, 2016 2:10 pm)

Other questions/remarks:

1/ The ym2151 seems to support panning for instruments (there is is line //CH: PAN    FL CON AMS PMS SLOT NE in the opm instruments), but the java controller doesn't display this option, I guess it's not supported in the arduino sketch or for another reason?

2/ For the BOM (bill of materials) there are at least:

- YM2151 (obviously)
- YM3012 (dac)
- 6N138 or 6N137  (optocoupler, you can use either I think). The 137 version seems to be more easily findable on ebay
- TLC2274 or MCP6004 (amp). The latest sketch from Charbot is with a TLC2274 but my shield has a MCP6004, I guess they are interchangeable in this context: http://www.me.umn.edu/labs/hmd/lab/electronics/ic.html
- I'll look later for the various resistors and condensators

3/ I see on http://www.ooishoo.org/?page_id=15 there is a SketchMDXPlayer (chiptune player, the MDX is compiled from MML), has anyone tried this? I tried but didn't manage to make it connect between the windows program and the arduino
There is also this: https://github.com/zenmai/portableMDXPlayer but no info in the readme

4/ for the pitch difference (1/2 tone higher), could it be the quartz?

Last edited by garvalf (September 3, 2016 10:00 pm)

A LM324 is a drop in replacement for the TLC2274, albeit with more noise. 
opto- I actually used a 6n139,  but I dont think that it matters... you may have to play w/ the value of of the resistor between 5v and the arduino RX.    Also, I just used all .001uf caps,   I didnt have any .0015uf on hand.  Cant imagine that it matters much.     
My board use a full-can oscillator cuz thats what I could get most easily.   (Its the same thing, just larger package)

here are the  jacks I used that will fit the layout :    1/8" audio         Jameco #568392                        DC power  Jameco #101179
they are pretty common.   you shouldnt have any trouble finding them from other distributors.... or just solder in wires and use the jacks(s) of your choice

i might be sick, but Im thinking of building a full  knob-per-function hardware controller for this thing.    Oled display to show the Algorithm...   maybe patch memory.    Anyone interested?

Charbot wrote:

i might be sick, but Im thinking of building a full  knob-per-function hardware controller for this thing.    Oled display to show the Algorithm...   maybe patch memory.    Anyone interested?

I like your thinking smile
Yogi

@Charbot, what is the value of the oscillator you're using on your board?
Will you make and sell the PCB for your version (I've just ordered the parts)?

4mhz- same as the original.    here is the exact part i used, but you can find them anywhere.       
http://www.jameco.com/z/OSC4-4-MHz-Full … 27967.html
remember full-can!

I would like to get some boards made but I have a lot on my plate right now and not a lot in the coffers....
Perhaps if there was a bit more interest.  If i knew i break even, id be much more inclined to get the ball rolling.    (I am going a head w/ the knobby controller wink   
Sorry- keep forgetting to post the eagle files to github.   will try to get to is soon.    You could prob get a 1-off from oshpark, but it would be expensive.

really home etching is not hard...  and it opens up a whole world as electronics tinkerer

Charbot wrote:

4mhz- same as the original.    here is the exact part i used, but you can find them anywhere.       
http://www.jameco.com/z/OSC4-4-MHz-Full … 27967.html
remember full-can!

I would like to get some boards made but I have a lot on my plate right now and not a lot in the coffers....
Perhaps if there was a bit more interest.  If i knew i break even, id be much more inclined to get the ball rolling.    (I am going a head w/ the knobby controller wink   
Sorry- keep forgetting to post the eagle files to github.   will try to get to is soon.    You could prob get a 1-off from oshpark, but it would be expensive.

really home etching is not hard...  and it opens up a whole world as electronics tinkerer

I'm a big fan of OSH Park for small projects. It opens things up for DIYers at a reasonable price.  At $5 per sq inch of design it works out to ~ $1.67 per board sq inch. And finding 2 other people that want a board is easier. Where as one can get better prices with larger runs,  but as you say it's hard to judge if you can break even.
Yogi

4mhz... my board has a 3.57mhz crystal, it's probably the reason for the pitch difference. But if I remember well on my board the pitch is higher, so if the crystal is slower it should sound lower shouldn't it?

For the knobs, why not, but I think we still need the board to be connected to a PC for making the sounds so it can't be an independent instrument? I have a master keyboard with knobs, so I thought to change the arduino sketch to support it, but I fear it might be too complicated for my usage, I don't know...

Hmm.. thats weird.   I built mine following the original japanese pdf  (the schematic and parts list is english)    Also, im pretty sure that other schematics that ive seen for this chip use a 4mhz.     Mine seems in-tune.      perhaps synthy can chime in.

what im envisioning w/ the knob controller can totally make it an independent instrument.   we'll see

Last edited by Charbot (September 9, 2016 9:15 pm)

did some testing w/ a tuner   and  garvalf, dude... you have a way better ear than I.   Mine is 1 1/2 semitones over. whoa!
  perhaps 3.5 ish mhz would be a better value?  or adjust the note array in the sketch.

Last edited by Charbot (September 10, 2016 8:40 pm)

Here is a quick  and dirty trick to transpose the notes.  works for me.
   on the main (first) page of the sketch; change these two subroutines by adding or subtracting the number of semitones you are off  from "note".   like this:

void handle_NoteOn(uint8_t channel, uint8_t note, uint8_t value){
        channel = channel - 1;
        NotePool.handleNote(true, channel, note -3, value); //  mine is 3 semitones above the correct note so... -3
    }

    void handle_NoteOff(uint8_t channel, uint8_t note, uint8_t value){
        channel = channel - 1;
        NotePool.handleNote(false, channel, note -3, value);  // make sure this is the same number of there will be hanging notes!!
    }

Last edited by Charbot (September 10, 2016 8:39 pm)

Maybe ill try one of thses:  http://www.digikey.com/product-detail/e … 7-ND/31822

I don't think I have a better ear, when I discovered that I was using the sound to mix with other instruments (soundfont in midi), and it was obviously out of tune.

On the ym2151 datasheet, we can read this:
http://html.alldatasheet.com/html-pdf/9 … M2151.html

"clock frenqucy min 3, std 3.58 max 4 mhz" so between 3 and 4 it's ok. I don't know if the chip should be able to handle the differences but obviously it's out of tune. Maybe with 3 mhz it would be correct? Anyway, it was not supposed to be used in an orchestra, just in bar on coin-op machines...

I was looking for a solution but couldn't find one myself.
Thanks for the tune fix, I'll test this.

Got a new oscillator: 3.579545mhz.    Using the stock code, just like w/ garvalf's, mine was still 1 note above what it should be.  However, after executing the  "note -1"  code patch it is dead-on perfect;    While w// the 4mhz, even after correcting the 3 note discrepancy, checking w/ a  tuner showed that everything was about 2-3 cents flat.      Can anyone check theirs and see how accurate it is w/ a 3.58mhz?   wondering if it makes a difference.   

following that thought:    Thinking that it would be nice to add a 'master tune' trim to one of the unused analog-ins, but I really cannot figure out how the midi note # gets translated into a freq or command for the YM.   Anyone have any clues as to how this works?   Probably can easily be used for pitch bend too