electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Digital-analog synth
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [22 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
KammutierSpule



Joined: Feb 07, 2008
Posts: 40
Location: Aveiro - Portugal

PostPosted: Thu Feb 07, 2008 2:58 am    Post subject: Digital-analog synth
Subject description: Request for ideas
Reply with quote  Mark this post and the followings unread

Hallo there! First post here!

I've starting reading about DIY synths and I'm plan play with my own. I've found nice pages around web, i'm studding the schematics and so on.
I've some ideas of what I want and I'd like know if you would like share and give me any sugestions for this:

Firstly, I'm not play doing a real analog synth, but some hybrid digital/analog control.

I'm planning use a microcontroler to control and play with analog part.
With PIC I can get: 10 MIPS, PWM (8..10bits), ADC >50ksps 10bits, comparators, IO ports, and so on.

I dont like much the idea of using a DAC because I dont have so uch CPU power to play with and to all in the CPU, but I can use some kind of "resistor DAC" to control some levels, maybe pwm to control some LFO voltages, etc
What's your opinion about "resistor DACs"?

I would like my circuit will not be too much complex, because I plan then add paralell voices, replicating the circuit, but I dont want it so simple because I would like play with lot of parameters and haver rich sounds

I'm not interested also in audophile quality assegurance, firstly I want just some nice noise Smile

The main goal using a microcontroler is to let the micro produce some kind of sound, or play wish diferent waveforms, maybe selecting them or guide them (waveguide?) and minimise the use of external components. In the schematics I'me learning in web, they are more focus for
all real< analog synths:

What do you sugest I learning and looking for? What ideas do you think I can explore using the microcontroler and analog?

I've found about 1 ou 2 projects using microcontrolers, but they seam too simple to mee, just "tri,saw,sqr" waves->Filter->envelop

Idea: If I use two separate "8bit or more resistor DAC" (resistor so we can haver different level because resistor tolerance) to play "two voices" an then put it to filter,efx,etc... will output listened sound less "8bit" ?!
what about use two 12-bit DAC?

Thanks in advance for sugestions!!
Mario "KammutierSpule" Luzeiro
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24458
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Thu Feb 07, 2008 5:35 am    Post subject: Reply with quote  Mark this post and the followings unread

welcome

I've seen some LFO implementations done on a PIC and some years ago I tried to do some simple audio stuff on a PIC12, your plans may be a bit ambitious, the AVR sems more suitable, otoh there is DSPIC and maybe a PIC24 or 32 might be useful ... some quick links :

AVR synth info : http://www.elby-designs.com/avrsynth/avrsyn-about.htm

And a PIC based LFO can be found at : http://www.tomwiltshire.co.uk/sdiy/

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24458
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Thu Feb 07, 2008 5:49 am    Post subject: Reply with quote  Mark this post and the followings unread

Oh and there is the soundgin of course Very Happy
_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Thu Feb 07, 2008 7:42 am    Post subject: Reply with quote  Mark this post and the followings unread

As Mr. Blue said, the AVR appears to be more capable as a CPU for this purpose. And the AVRsynth is already developed - you can start with that as a known working project and learn from the code and then modify or even completely rewrite it.

However, the AVRsynth is fairly well maxed out, so don't expect it to be much more than a monosynth with 2 oscillators.

I apologize for this next mental tic of mine: Consider an FPGA, at least eventually... Very powerful in comparison to the AVR, it rivals the power of DSP chips. It is, however, a very different design paradigm, but it is not unlearnable (after all, I did and I don't think I'm a friggin' genius cyclops ) It does require a bit of reading though.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
KammutierSpule



Joined: Feb 07, 2008
Posts: 40
Location: Aveiro - Portugal

PostPosted: Thu Feb 07, 2008 8:08 am    Post subject: Reply with quote  Mark this post and the followings unread

I already have look to AVRsynth and some other PIC LDO's, LFO is easy to be done at some point, but I want more. LFO's will be usefull at some point, so it will be need to be implemented anyway. I'm now more concerned in "VCO" and "VCF" part integration and control.

I know AVR are good uC(and now there are real beasts ARM's) , but I can easy get samples from microchip. An usualy PIC can give about 10MIPs, it not so few (about >200 intructions for sample @ 44.1Khz), maybe I will look in dsPICs (30MIPS).

I'm thinking make some kind of "opensource" project, so, easly phisicall program the uC and get parts will be a must.

I think I'll find some how.. to make somthing like re-synth an analog circuit and use for it less cpu power.
Example of my idea: having a VCO controled by PWM os something to get the right frequency and use control IO's with resistors to control gain in the output wave, I supose in that I'll control the shap of output wave.

Mario
Back to top
View user's profile Send private message
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Thu Feb 07, 2008 8:17 am    Post subject: Reply with quote  Mark this post and the followings unread

Do I read this right that you're doing a hybrid synth - where some bits are digital (LFOs) and other bits are analog (VCO) ?

Depending on what exactly you want to put into a PIC, or several PICs, certainly LFOs will work, also envelope generators.

Filters can require a bit more horsepower, but are not impossible, the AVRsynth is a complete synth, with a filter running in an AVR. A slower CPU like a PIC could do a filter - but be warned, I believe most PICs use 8 bit data words and you may want to use wider words for things like filters and NCOs. 8 bits is considered low-fi, but you may like that. A PIC can do 16 bit arithmetic, but you sacrifice clock cycles to do it. Remember that filters use multiply operations which are very slow programmed in PIC. The AVR or the dsPIC sound like better ideas for what you want to do.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
KammutierSpule



Joined: Feb 07, 2008
Posts: 40
Location: Aveiro - Portugal

PostPosted: Thu Feb 07, 2008 9:06 am    Post subject: Reply with quote  Mark this post and the followings unread

ScottG wrote:
Remember that filters use multiply operations which are very slow programmed in PIC. The AVR or the dsPIC sound like better ideas for what you want to do.


True, but I dont plan implement a digital filter, so there'll be no code for that. I plan do a VCF (voltage controled filter?) like any analog synth out there, I can code the LFO in PIC then connect it to VCF, right?!

Envelope generators are also LFOs so PIC can do it.

About VCO's the basic shap waves can be made with realy analog, but pic can control at some point (with less frequency) some parameter of VCO (LFO again?!) and the outputshap will be diferent than a simple "math wave"

Maybe adding an addicional uC using ADC & DAC it will be possible to add some feedback effect unity.

8 bit are really low-fi but if I play it not loud will I ear the quantization?? I plan use in some situation a 8bit dac as follow: .. if we used "hi-fi" DAC (16,24..bits) and we have a voltage(-V .. +V) to fill all the bits, then If I play it half the voltages then -> 8bits will be for -V/2 +V/2...
with that way I can't play loud sounds, but, maybe if I use 2 DACs and play "two voices" (well.. two VCO's..) and that DACs as a little voltage biased then add this will play a loud sound... comments? Razz
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24458
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Thu Feb 07, 2008 9:13 am    Post subject: Reply with quote  Mark this post and the followings unread

ScottG wrote:
[...]multiply operations which are very slow programmed in PIC.


Lots of larger PICs have a one cycle 8x8->16 (unsigned) hardware multiplier, that helps a bit Very Happy

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Thu Feb 07, 2008 9:27 am    Post subject: Reply with quote  Mark this post and the followings unread

Blue Hell wrote:
ScottG wrote:
[...]multiply operations which are very slow programmed in PIC.


Lots of larger PICs have a one cycle 8x8->16 (unsigned) hardware multiplier, that helps a bit Very Happy


Cool, I've been away from PICs for a bit. However, an 8x8 multiply isn't really what I'd use for DSP, however that would speed things up, but it (used alone and not cascaded) is still pretty low-fi when used for audio generation.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24458
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Thu Feb 07, 2008 9:39 am    Post subject: Reply with quote  Mark this post and the followings unread

Yup 16x16->32 and even 16x16->16 still take relatively much time combining the partial mult's. MAC's still take time, and I'd want saturating and signed arithmetic for audio stuff.

But this is going OT a bit I guess Very Happy

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
jksuperstar



Joined: Aug 20, 2004
Posts: 2503
Location: Denver
Audio files: 1
G2 patch files: 18

PostPosted: Thu Feb 07, 2008 11:26 am    Post subject: Reply with quote  Mark this post and the followings unread

From what you describe, I think you might not like using resistor DACs, and use either a real DAC, PWM, or most likely, a digital potentiometer, like analog devices sells. Then, you can take clearly defined analog VCO's or filters, and replace the pots or CV ins with your digitally controlled voltages, while minimizing extra logic or buffering.

A serial interface to any of these (DAC, digital pot, etc) is typically built-in to the microcontroller. Very simple protocol, and virtually no overhead in your code.
Back to top
View user's profile Send private message Visit poster's website
KammutierSpule



Joined: Feb 07, 2008
Posts: 40
Location: Aveiro - Portugal

PostPosted: Thu Feb 07, 2008 11:39 am    Post subject: Reply with quote  Mark this post and the followings unread

jksuperstar wrote:
From what you describe, I think you might not like using resistor DACs, and use either a real DAC, PWM, or most likely, a digital potentiometer, like analog devices sells. Then, you can take clearly defined analog VCO's or filters, and replace the pots or CV ins with your digitally controlled voltages, while minimizing extra logic or buffering.

A serial interface to any of these (DAC, digital pot, etc) is typically built-in to the microcontroller. Very simple protocol, and virtually no overhead in your code.



Yaps thats more my point... I have consider using digital potentiometer, they have i2c interface or SPI.. but I'll try see if with only a PWM I can use it in the VCO because the point of potentionmeter is to give a voltage to it.

Most of audio Dacs interface with I2S and this interface only apear in recently dsPICs (in case of PICs), but I've reshearch and found some DACs (8..12bits) with 6 or 8 pins with i2C or SPI, that should give a try...
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24458
Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320

PostPosted: Thu Feb 07, 2008 11:44 am    Post subject: Reply with quote  Mark this post and the followings unread

As a side note ... I've found SPI easier to implement than I2C on PICs, both with and without using the built in HW support.
_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
jksuperstar



Joined: Aug 20, 2004
Posts: 2503
Location: Denver
Audio files: 1
G2 patch files: 18

PostPosted: Thu Feb 07, 2008 11:46 am    Post subject: Reply with quote  Mark this post and the followings unread

Don't forget, I2C is a registered trademark of Philips, so some other manufacturers have an interface that's compatible, but they just call it a "Two Wire Interface" or TWI. Just take a look through your specs for the processor you want to use, and try to get the gist of the interfaces purpose. It's not that difficult, you'll learn a bit in the process, and it'll open up a lot of pins on your microcontroller to have things like switches, encoders, pots, and LEDs to control or see what your synth is doing.
Back to top
View user's profile Send private message Visit poster's website
carld



Joined: Feb 09, 2008
Posts: 5
Location: Rhode Island

PostPosted: Sat Feb 09, 2008 7:37 am    Post subject: Reply with quote  Mark this post and the followings unread

I've actually been working on a synth based on Arduino, written in C++. I'm using a pretty crude R2R ladder DAC with pretty good results, considering that my 2Rs aren't even 2*R. Wink

Right now it's 8 bits wide, as I wanted to save some of the pins for inputs, volume control, etc. It could be expanded reasonably easily, tho.

Features:
- Wavetables (I've got sine, octaves, thirds and a major chord implemented)
- Square, Triangle, Sawtooth
- Sequencer, Appegiator
- MIDI support (ie Sequencer takes MIDI notes and params - in/out will be easy to add)
- Detune
- Transpose

Written, not working:
- Polyphony
- ADSR Envelope Generator

Planned:
- LFO
- Filters (may be tough)
- Other Envelopes
- Noise (white easy, others easy if I can figure out frequency filtering)
- Ring Modulator

It was sounding pretty nice, when I was banging out the bits directly, but I want to add polyphony, which requires time-slicing the output, and I've introduced a bug or a timing issue in the process. Once I have it back in shape, I can post the code. I also have some pictures of the breadboard, but it's exactly what it sounds like, an Arduino with a couple of pins connected to a pot, and the rest going to the R2R ladder.

As far as the performance of the AVR goes, it is pretty good, but tight I would say. Using Arduino makes things a little more convenient for me (I'm a software engineer, playing with hardware, so just soldering together the system was a big step for me Smile).

The code is pretty clean and tight, and I think will be useful for building *parts* of a complete synth. I'm really designing it as a framework for playing around with the different ideas. For example, I have been thinking as you are about having the real high-frequency sound work being done off-chip, so the AVR just has to do the low-frequency thinking, UI, etc.

Others have mentioned using a digital pot to control hardware oscillators, which is a cool idea that I want to play with. I've also seen designs using looping FIFOs outputting to DACs, which fits my wavetable approach nicely. This also could allow for larger tables, completely off the AVR, perhaps with external EEPROM or even removable flash that the AVR never even has to see, other than to initiate/coordinate loading of the FIFOs.

Maybe we could work together on something...
Back to top
View user's profile Send private message
KammutierSpule



Joined: Feb 07, 2008
Posts: 40
Location: Aveiro - Portugal

PostPosted: Mon Feb 11, 2008 4:22 pm    Post subject: Reply with quote  Mark this post and the followings unread

carld wrote:
For example, I have been thinking as you are about having the real high-frequency sound work being done off-chip, so the AVR just has to do the low-frequency thinking, UI, etc.

[...]

Maybe we could work together on something...


I'm trying now figure out how could I generate some "frequency noise" with PIC and some adicional circuit (dont need to me sin,saw,sqr,etc but could be something diferent but with repetition and scalabilitie) so future I'll mix it with some kind of DAC.. so i'll have digital and analog for example.
Back to top
View user's profile Send private message
carld



Joined: Feb 09, 2008
Posts: 5
Location: Rhode Island

PostPosted: Mon Feb 11, 2008 6:01 pm    Post subject: Reply with quote  Mark this post and the followings unread

Interesting. This is one of the reasons I'm thinking about going to a more high-powered platform, like a DSP or faster processor, to do things like FFT for filtering and other effects that would be harder to do in hardware. I mean, the cool thing about analog is the purity of the sound, the downside is that it doesn't scale well. Digital seems to be getting to the point where some serious number crunching can go on at 44kHz (and higher) for multiple channels. But for more modest processors, one or two channels is probably the most you can do easily, which doesn't give much scale. So, better to use these processors to control and inject information...
Back to top
View user's profile Send private message
KammutierSpule



Joined: Feb 07, 2008
Posts: 40
Location: Aveiro - Portugal

PostPosted: Mon Feb 11, 2008 6:52 pm    Post subject: Reply with quote  Mark this post and the followings unread

carld wrote:
Interesting. This is one of the reasons I'm thinking about going to a more high-powered platform, like a DSP or faster processor, to do things like FFT for filtering and other effects that would be harder to do in hardware. I mean, the cool thing about analog is the purity of the sound, the downside is that it doesn't scale well. Digital seems to be getting to the point where some serious number crunching can go on at 44kHz (and higher) for multiple channels. But for more modest processors, one or two channels is probably the most you can do easily, which doesn't give much scale. So, better to use these processors to control and inject information...


Some questions:
How much Khz are you getting with AVR, how much intructions per sample are you getting?

Of course if you got an hiperUpperFastProcessor with a fantastic DAC, you only need to be a code artist...

My plan about use HW VCOs is not for putiry, but more for: extra sound with less MIPS.
If I can get a one/two voices in one board and it feats easly (few components, easy bulding, small size) then you addint an extra cntroller you can add more voices (polly or mono/aditive voices)

Mario
Back to top
View user's profile Send private message
carld



Joined: Feb 09, 2008
Posts: 5
Location: Rhode Island

PostPosted: Mon Feb 11, 2008 7:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

I haven't actually counted (although I plan to now), but roughing out the math says (16MIPS/44 kN/sec =~ 363 inst/N). It's a fair amount to work with, even allowing for overhead for timer interrupts, etc., but anything requiring floating point math or other involved calculations needs to be done over several samples, during initialization, etc., which can be problematic.
Back to top
View user's profile Send private message
KammutierSpule



Joined: Feb 07, 2008
Posts: 40
Location: Aveiro - Portugal

PostPosted: Thu Feb 14, 2008 2:50 pm    Post subject: Reply with quote  Mark this post and the followings unread

carld wrote:
I haven't actually counted (although I plan to now), but roughing out the math says (16MIPS/44 kN/sec =~ 363 inst/N). It's a fair amount to work with, even allowing for overhead for timer interrupts, etc., but anything requiring floating point math or other involved calculations needs to be done over several samples, during initialization, etc., which can be problematic.


How are you compute the algoritm for the sample interpolation of each step?
Back to top
View user's profile Send private message
carld



Joined: Feb 09, 2008
Posts: 5
Location: Rhode Island

PostPosted: Fri Feb 15, 2008 7:07 pm    Post subject: Reply with quote  Mark this post and the followings unread

KammutierSpule wrote:

How are you compute the algoritm for the sample interpolation of each step?


I'm not, actually. I think this might be overkill for this small processor, given the time it has. I've got some low-pass filtering after the DAC now, although now we're into the hardware side, and my mind goes weak there.

One of the things I want to do is try (again) to get PWM output working, or even better, PDM, which seems even more logical to me. This is essentially loading capacitors with voltage pulses, as far as I can tell...
Back to top
View user's profile Send private message
KammutierSpule



Joined: Feb 07, 2008
Posts: 40
Location: Aveiro - Portugal

PostPosted: Tue Feb 19, 2008 3:49 pm    Post subject: Reply with quote  Mark this post and the followings unread

carld wrote:
One of the things I want to do is try (again) to get PWM output working, or even better, PDM, which seems even more logical to me. This is essentially loading capacitors with voltage pulses, as far as I can tell...


Seams PDM to be a cool idea.. but web are not very clearance about it, i'll need to do mo search.
I've send you a PrivateMsg with my mail if you want share ideas.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [22 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use