Jump to content
43oh

2-osc PWM Midi Synth


Recommended Posts

I put together a 2 oscillator PWM MIDI synthesizer based on NatureTM's (thanks!) 'simple synth'. No DAC is needed. The second oscillator can be detuned and has a blend control, both accessed via midi cc's. A clip of it, and the code, are on my site at the perspectivesound blog. I haven't added adsr, I may add some more features soon.

Link to post
Share on other sites
  • 2 weeks later...

nice work! will be keeping an eye on this one. had a play with naturetm's simple synth a while ago - much fun. http://naturetm.com/?p=111

 

you mention stuck notes on your blog - i had some midi communication problems when i added an opto isolator, no problems at all without it, but also wanted to stick to midi spec: http://www.midi.org/...electrispec.php which is kinda vague, not for 3.3v and i couldn't source a 6n138 or pc900 so only had a 4n35 available. once i added the opto i had all sorts of problems, erratic response, stuck notes, etc. requiring frequent resets.

 

i fiddled with resistor values on the msp side which improved it somewhat but with still the occasional glitch. adding an led on the midi side has cured it with flawless response and no stuck notes but i've no idea as to why - if anyone can explain it would be appreciated. i had been using the led to check for midi output as here: http://www.alfors.co...estKonektor.jpg and here: http://www.epanorama...s/miditest.html due to an intermittent fault in my midi cable and stumbled upon this 'solution' by accident.

 

anyways, here's what i ended up with (note that the 1k resistor should be 1k47):

 

post-3-0-34414700-1352564909_thumb.png

 

i used two resistors, 1k and 47ohms in series, on the msp side. might be worth playing with. i look forward to trying out your code.

 

other links i stumbled upon when trouble shooting:

 

http://blog.gg8.se/w..._side_of_things

http://www.gammon.co...connections.png

Link to post
Share on other sites

MIDI current loop is 5mA, so 4N35 is not the best choice for MIDI application.

On top of that, you have LED, which is in parallel with opto LED and resistor.

If you want to see MIDI activity, connect your LED (with current limiting resistor) on the other side of opto.

 

post-3-0-78074700-1352564981_thumb.png

Edited by bluehash
Removed external link
Link to post
Share on other sites

hi rob - i hoped you'd chip in.

 

either you have misunderstood my post or i am misunderstanding your response.

 

4n35 is all that was available. i found a work around. it worked.

 

your schematic closely resembles my described solution. i don't understand what it is that you are recommending.

 

please forgive my slowness.

Link to post
Share on other sites

The schematic is exactly your solution, posted it to show the whole loop.

I would expect more problems with that extra LED than without, so that is weird.

Try removing that extra LED and replace 1k resistor with 270-330ohm.

Are you using 2231? If not, try hardware UART instead of the software one.

Link to post
Share on other sites

Ok-- posted my current code. Three osc now. Messy code, I know, but it leaves room for playing with, I hope!

 

code link is borked.

 

The schematic is exactly your solution, posted it to show the whole loop.

I would expect more problems with that extra LED than without, so that is weird.

Try removing that extra LED and replace 1k resistor with 270-330ohm.

Are you using 2231? If not, try hardware UART instead of the software one.

 

i agree it's weird but it worked - i've no idea why. tried various resistor values (from 10r to 10k) at the time, with and without the led after replacing the dodgy midi cable, and settled on 1k47r with led for the best response. yes, it's a 2231. it's not an issue - i'm just curious.

 

*edit* forgot to mention - i said above that i had no problems without the opto but this was only true if powering the midi keyboard from usb, as was the msp - sharing ground from the one laptop i presume. all sorts of erratic behaviour if keyboard was powered from it's own psu. no such probs with opto. hope that all makes sense and helps - need sleep.

Link to post
Share on other sites

quite possibly - i wasn't 100% on the dco calib having worked tho it seemed to pass the test... i'll check it out when i next break out the breadboard for some tinker time. i assumed the resistor value was due to the msp's 3.3v rather than midi spec'd 5v. but as i say it works, which is good enough for me. much fun thru lunetta style cmos circuits: http://electro-music.com/forum/forum-160.html

Link to post
Share on other sites

I didn't have any luck with the diode and a V900 opto. I'm trying to get UART going, but the only valid data it sees is Ox80 ----note off. I may just be getting garbage, but thats the only valid control byte the prog sees! Any pointers to how to set that up right are very welcome. I am a noob, sorry if its too obvious.

[quote]void uart_init(void)
{
uart_set_rx_isr_ptr(0L);

P1SEL = RXD + TXD;					
P1SEL2 = RXD + TXD;					
UCA0CTL1 |= UCSSEL_2;					 // SMCLK==4mhz
UCA0BR0 = 32;						 // DIVIDES SMCLK BY 128/16 = 31250 = MIDI SPEC w/UCOS16 oversample
UCA0BR1 = 0;							 //
UCA0MCTL = ~UCBRS0 + UCOS16;// + ~UC7BIT ;					 // Modulation UCBRSx = 1
UCA0CTL1 &= ~UCSWRST + ~UCMSB;					 // Initialize USCI state machine
IE2 |= UCA0RXIE;						 // Enable USCI_A0 RX interrupt
}[/quote]

Link to post
Share on other sites

I made schoolboy mistakes...this is ok.(?)

void uart_init(void)
{
uart_set_rx_isr_ptr(0L);
P1SEL = RXD + TXD;					
P1SEL2 = RXD + TXD;					
UCA0CTL1 |= UCSSEL_2;					 // SMCLK==4mhz
UCA0BR0 = 8;						 // DIVIDES SMCLK = 31250 = MIDI SPEC w/UCOS16 oversample
UCA0BR1 = 0;							 //
UCA0MCTL = UCBRS0 + UCOS16;// + ~UC7BIT ;					 // Modulation UCBRSx = 1
UCA0CTL1 &= ~UCSWRST;// + ~UCMSB;					 // Initialize USCI state machine
IE2 |= UCA0RXIE;						 // Enable USCI_A0 RX interrupt
}

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...