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 » Developers' Corner
Virtual Analog Synthesizer
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 3 [72 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: 1, 2, 3 Next
Author Message
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Mon Aug 20, 2018 7:35 am    Post subject: Virtual Analog Synthesizer
Subject description: DIY synth
Reply with quote  Mark this post and the followings unread

Hi, i like to share a DIY virtual analog synthesizer sound module based on the DSPICFJ128GP802
i give the schematic and .hex file so anyone can build a cheap synth

it has MIDI input & MIDI thru
a DIP switch to select the MIDI channel
left output & right output
volume knob

currently still working on version 1
it needs some more options then its done
it works perfect already without any problem

i dont have a professional circuit print
all parts are available in DIP format

the layout is for 9v wall adapter
you could easy change to use in eurorack by taking away the 5v regulator
and use the 5v and 12v from eurorack
it takes about 100mA from the 5 volt

so i registered in this international forum,
my goal is to make cheap synthesizers available not to sell
if any like to help me with feedback, a circuit, or eventually making kits would be great.

Let me know if this is the right place ?
And if anyone is intrested in such a simple project ?
the sound is great 16bit digital sounding character with advanced control
thanks and hi all
Back to top
View user's profile Send private message
ixtern



Joined: Jun 25, 2018
Posts: 145
Location: Poland

PostPosted: Mon Aug 20, 2018 7:45 am    Post subject: Re: Virtual Analog Synthesizer
Subject description: DIY synth
Reply with quote  Mark this post and the followings unread

VA1 wrote:
Hi, i like to share a DIY virtual analog synthesizer sound module based on the DSPICFJ128GP802
i give the schematic and .hex file so anyone can build a cheap synth
...
Let me know if this is the right place ?
And if anyone is intrested in such a simple project ?
the sound is great 16bit digital sounding character with advanced control
thanks and hi all

It may be very interesting. Please post details of your build but maybe "Microcontrollers and Programmable Logic" section of this forum would be more suitable.
Regards.
Back to top
View user's profile Send private message
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Mon Aug 20, 2018 8:00 am    Post subject: Reply with quote  Mark this post and the followings unread

Here is already the test version attatched
Back to top
View user's profile Send private message
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Mon Aug 20, 2018 8:03 am    Post subject: Re: Virtual Analog Synthesizer
Subject description: DIY synth
Reply with quote  Mark this post and the followings unread

ixtern wrote:
Please post details of your build but maybe "Microcontrollers and Programmable Logic" section of this forum would be more suitable.
Regards.


Its only about the building not programming, since i do not share any source codes
Back to top
View user's profile Send private message
ixtern



Joined: Jun 25, 2018
Posts: 145
Location: Poland

PostPosted: Mon Aug 20, 2018 1:03 pm    Post subject: Re: Virtual Analog Synthesizer
Subject description: DIY synth
Reply with quote  Mark this post and the followings unread

VA1 wrote:
ixtern wrote:
Please post details of your build but maybe "Microcontrollers and Programmable Logic" section of this forum would be more suitable.
Regards.


Its only about the building not programming, since i do not share any source codes

Thank you for sharing your work but without source code it is not so interesting. I know nothing about this family of microcontrollers but having some working source code as a starting point for education would inline me to make a step toward it.
Closed hex, without possibility to shape the code as I like is one-time-curiosity for me. But of course it is your choice and you don't have any obligations to publish your code here. It maybe simply another look how to make something in electro-music area.
Back to top
View user's profile Send private message
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Tue Aug 21, 2018 6:36 am    Post subject: Reply with quote  Mark this post and the followings unread

Are you not happy with a synthesizer without source code ?
it is a fully working synth for very cheap

if you like to start with programming this is not the correct way
if you already can program and want to learn DSP this is also not the correct way
if you already are a DSP programmer be warned for this chip : integer math only no floating point.

i made this synthesizer for my own use i am happy already, i just like to share it and have some attention to it since it sound so nice.

if it will be a bit populair i also have a phase distortion synth and a phase modulation synth coming up ( both share the same circuit with display and menu )

That i find weird if i offer something people want the source code to also start with programming to do the same as me ?

Tell me what u working on maybe i can help you
Back to top
View user's profile Send private message
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Tue Aug 21, 2018 6:57 am    Post subject: Reply with quote  Mark this post and the followings unread

You also need to hack the compiler or buy it before you can optimize for speed.
Need any help i can tell you how to legally hack.
Back to top
View user's profile Send private message
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Tue Aug 21, 2018 7:05 am    Post subject: Reply with quote  Mark this post and the followings unread

I bought
Yamaha digital synths,
Kawai digital synths,
Roland digital synths,
Clavia digital synths,

i did not ask for any source code and the price was a zero to long.
+ they throw unaccesible parameters at me only with sysex.

makes some people happy it must, i dont pay anymore
Back to top
View user's profile Send private message
ixtern



Joined: Jun 25, 2018
Posts: 145
Location: Poland

PostPosted: Tue Aug 21, 2018 3:09 pm    Post subject: Reply with quote  Mark this post and the followings unread

VA1 wrote:
Are you not happy with a synthesizer without source code ?
it is a fully working synth for very cheap

if you like to start with programming this is not the correct way
if you already can program and want to learn DSP this is also not the correct way
if you already are a DSP programmer be warned for this chip : integer math only no floating point.

i made this synthesizer for my own use i am happy already, i just like to share it and have some attention to it since it sound so nice.

if it will be a bit populair i also have a phase distortion synth and a phase modulation synth coming up ( both share the same circuit with display and menu )

That i find weird if i offer something people want the source code to also start with programming to do the same as me ?

Tell me what u working on maybe i can help you

Thanks for your offer but I don't need your help. I am querying works of others for new ideas rather, not for copying their doings. And my electronic music hardware and software is for fun only, not for money, so I can share anything I make (when it will be ready to show).

I am not interested in closed, cryptic constructions as I cannot learn anything from it, especially in digital area, when code is much more important than hardware.

Maybe someone else can use as a toy what you have published so thanks once more for your posts.
Back to top
View user's profile Send private message
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Sat Aug 25, 2018 7:44 am    Post subject: Reply with quote  Mark this post and the followings unread

You have unread private message.
Know any other sites for DIY synths ?
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: Sat Aug 25, 2018 10:13 am    Post subject: Reply with quote  Mark this post and the followings unread

I saw this thread and had fond memories of my dsPIC days. I am posting an additive flute MIDI monosynth project that uses DSPIC33FJ128GP802. This project is written in both C and assembly where the application code is in C and MIDI controller and init and driver code is in assembly. It has a lot of comments, so most of it should be self explained. I used MPLAB ver 8.87.00.00 for the compiler and assember. The sample rate is an odd value because I've set the dsPIC to run at 40 MIPS. Using that speed prevents the use of standard sample rates. The sample rate used by this synth is 62.5 kHz.

It is a wavetable and LFSR noise synth. Noise is used for the blow effect, airiness and 2 wavetables are used for sine and distorted (soft clipped) sine which provides some 2nd and 3rd harmonics.

This monosynth project demonstrates how to use the dsPIC and it's DACs to make a MIDI synthesizer using a DIY board. I built mine on stripboard. The code is provided with no warrantees or guarantees whatsoever. This was done some years ago, so any questions about it may be subject to my waning memory of it.

I'm not sure about the schematic, there is a BMP file in the zip which has the basic setup. You'll have to claw through the code to find which pins are used for MIDI and for other things. The schematic shows the clock setup, programmer connection and connection of the DAC pins via opamps to make a stereo output.

I have other more advanced projects such as a 12 voice Karplus-Strong polysynth, but techniques I use in them are going into a commercial project so I can't release those here.

My only disappointment with the dsPIC33FJ128 is the white noise that comes from the DAC. It is mostly not noticed until the synth is playing very softly, but it's always there.


ver_l.zip
 Description:
MPLAB Project for Additive Flute MIDI Monosynthesizer for dsPIC33FJ128GP802

Download
 Filename:  ver_l.zip
 Filesize:  73.61 KB
 Downloaded:  310 Time(s)


_________________
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
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Sun Aug 26, 2018 5:13 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi, thank you very much for sharing.

I notice this thing at the end of interrupt :
if ( IFS4bits.DAC1RIF == 1 ) asm( "BSET LATA, #4" );
else asm( "BCLR LATA, #4" );

That part dont even work with me,
did you really make it to slow sometime that this error showed ?

By the way : why asm ?, i just make a pin go high, its only for testing anyhow.
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: Sun Aug 26, 2018 6:32 am    Post subject: Reply with quote  Mark this post and the followings unread

Yes, being too slow became a problem with other synth designs, such as the 12 voice karplus-strong polysynth or when using higher sample rates. If that LED turns on, it means the DAC interrupt flag turned on while the CPU was still executing the ISR. Above that code are some commented delay() calls. Those calls were used to simulate N clock cycles worth of "work" to measure the CPU clock headroom available at different stages of the development.

The dsPIC33F is the first CPU I used for DSP projects. Before that, I used FPGAs. This additive flute synth was also the first synth project I did with any CPU, before that it was just hello-world projects to test and prove that driver code for different dsPIC peripherals works properly.

And why not ASM? In fact, synth designs I did after this were written entirely in ASM because it was faster than the code C compiled into. 40 MIPS may sound like a lot until you start doing polysynths.

_________________
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
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Sun Aug 26, 2018 6:48 am    Post subject: Reply with quote  Mark this post and the followings unread

Yes i found that out, i could have max 4 voices with my phase distortion synth,
with only 1 oscillator instead of 2, and the 4 voice enveloppes time shared,
very bad.

I bought a PIC32MX and external SOIC DAC, that seems more complicated to set up.

Now that i must solder small stuff, i might as well try other chips that are not available in DIP package,
i have lots to do before i get that far.

I might go for a hybrid design also with VCF + VCA on the DSPIC oscillator ( another mono synth ).

For a poly synth i think i go fully analog, it cost less milliamps.
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: Sun Aug 26, 2018 7:25 am    Post subject: Reply with quote  Mark this post and the followings unread

The advantage of something like a dsPIC is that the Flash can be sent any synth code you want it to be at the moment, so your dsPIC board can be whatever synth you've written code for. You can't do that with analog. Analog is also much larger and needs trimmer pots to ensure that all of the voices sound and behave the same. Making changes to an analog polysynth is also a lot of work to add new features (and additional voices) because for the most part anything you want to add has to be added to all of the voices you have. Patchable analog polysynths are also a murderous affair in which you wind up not being able to patch everything due to panel size constraint. In the end, the more voices and features you want, the more physical trouble it is and the more it costs. And you need some kind of microcontroller anyway to do the MIDI controller and voice assignment, so you have the current of the analog stuff added to the current drawn by the microcontroller. You will also see more current draw as you add features and voices to an analog synth. That doesn't happen in digital when you recode for efficiency to increase voice or features count. My dsPIC Karplus-Strong synth started with 4 voices. Recoding in assembly and using better algorithms and techniques increased the speed of the code enough to push it to 12 voices. The dsPIC current draw is the same for the 4 voice version as it is for the 12 voice version. I never much cared about the current draw though, I would never try to run a dsPIC (or any digital synth) on batteries and I've got quite a number of wallwarts around.

Another route is to use a more advanced CPU such as the STM32 ARM CPUs which are 32 bits instead of 16 bits. I'm currently working with an STM32H7 which runs at 400 MHz and has an FPU that does float multiplies and adds in 1 CPU clock cycle. That CPU lets me do fast DSP without being forced to use fixed point (integer based) arithmetic. For the STM32F7, I was able to get 32 voices of karplus-strong with many features including pitch bend and chorus. Unlike the C30 compiler in MPLAB, gcc will compile C code for STM32 CPUs and will include the DSP instructions (like MAC). Sadly, the C30 compiler will just put together normal instructions to do multiply and accumulate instead of using the dsPIC MAC instruction. That is another reason I started using ASM with a dsPIC.

The nice thing about the dsPIC is that it's a self contained digital synth chip because it's got built in DACs and ADCs. It will do quite a lot, however I needed a faster chip to be able to do digital filters like SVF. The STM32 CPUs require using an external CODEC to do audio, but once the driver code is written, it can be reused in other synth designs for that board. There are various development boards for sale for STM32, some have CODECs, but most have a number of devices that I don't use (such as ethernet). There are also the "nucleo" series of boards. Nucleo boards are "bare minimum" boards that have CPU, clock and some other items and the vast majority of CPU pins go out to pads onto which you can solder your own pins to connect to other devices like a CODEC.

Last edited by JovianPyx on Sun Aug 26, 2018 8:59 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Sun Aug 26, 2018 8:58 am    Post subject: Reply with quote  Mark this post and the followings unread

The biggest problem i have with analog is that i use single supply.
To get a sinewave modulation that you can add with the modulation wheel.
Since the sine wave goes up and down, i need dual supply, i havent found anything yet to make this work single supply.

For my hybrid synth i will use one DSPIC channel for the VCF modulation,
then its automaticly biased with the center voltage when the modulation is off.
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: Sun Aug 26, 2018 9:06 am    Post subject: Reply with quote  Mark this post and the followings unread

Why not use a dual supply? They aren't hard to build. I use a single AC wallwart (no center tap) and 2 halfwave rectifiers. This is a very common way to make dual voltage (or even more than dual).

I don't advise this, but you can try a virtual ground. This is where two resistors of equal size are used from the single supply + to it's ground. between the two resistors is half the single supply voltage. If you call that "ground", you now have a + and - supply. This method can be beefed up with a voltage follower opamp circuit, but it is still very limited. The virtual ground can sink or source only a very small number of milliamps before it starts to move in voltage. This movement creates an unstable ground that propogates the problem to all parts of the circuit. You can read more about this by google-ing "virtual ground". It is useful only in small noncritical circuits that use very little current. I strongly suggest a real dual supply with 2 voltage regulators such as the one I suggest above. I have many 9vac 1000mA wallwarts around that I use for this. They make +8v -8v and +5v and work like a champ. I used such a supply for my dsPIC boards with +8 and -8 for opamps and +5 for the CPU chip.

_________________
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
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Sun Aug 26, 2018 9:23 am    Post subject: Reply with quote  Mark this post and the followings unread

I use only single supply, so i have the virtual ground else it dont works.
The problem is how to make a voltage control the modulation depth.

I have those AC adapters now, only you can not buy them new anymore.
I will use those AC adapters to get a tr808 clone +15 & -15 volt.
I ordered those "new" on ebay from Germany,
then i received second hand ones, without the possibility to give bad review, only to send them return, that would cost me very much money.

For my tr909 bassdrum i used a very expensive RECOM DC/DC converter.
I am a bit scared for those if i will fry one cost almost 25 euros.
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: Sun Aug 26, 2018 9:35 am    Post subject: Reply with quote  Mark this post and the followings unread

I'm surprised you can't find AC wallwarts new in Netherlands. I live in the USA, so we have a lot available. The 9vac wallwarts I bought were from a place called All Electronics which is a salvage company. They sell a lot of new things that had been stock for companies that went out of business. Parts from them are usually quite a bit less expensive, but I can still get the wallwarts new from other companies such as Jameco, DigiKey or Mouser. I can't help with the European market though, I don't know the parts houses there.

But that kind of thing is the reason I switched from analog building to digital. Lower cost, smaller systems, more capability. At my age, my eyes are not good enough to do SMT soldering, so digital is even more important for me. At least the dsPIC33F is still available in a through-hole package.

_________________
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
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Sun Aug 26, 2018 9:52 am    Post subject: Reply with quote  Mark this post and the followings unread

That is exactly why i use this DSPIC, only its so old, 7 years at least.
I hope they will release a newer chip with DAC in DIP package.
They promised me a 32bit with audio DAC, a few years ago.

By the way have you tested my synthesizer ?
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: Sun Aug 26, 2018 10:15 am    Post subject: Reply with quote  Mark this post and the followings unread

No, I have not tested it. For one thing, my dsPIC boards are all stored away to make room for STM32 stuff. To be honest, I'd be more interested in the source code to see how you handle band limiting. I've worked with virtual analog techniques in FPGA, but I had much faster DACs for that (12 bit DAC that runs as high as 1 MHz sample rate). With such a high sample rate, I could use naive waveforms and I hear no aliasing. At 44.1 kHz that can't be done because there's so much aliasing.

I wouldn't wait for Microchip to make a 32 bit version of the dsPIC, especially in through hole. The STM32 series is SMT, but it is so much more capable with 32 bits and higher clock speeds and more builtin peripherals. I can't solder them, but there are very inexpensive Nucleo boards. I'm working with another engineer who uses Eagle to make PCB data that he sends to a board house who etches the boards. His vision is good enough to solder the SMT parts and then he sends the boards to me to connect to a Nucleo so I can write the drivers and application code. However, we're trying to produce marketable products.

At this point, for through hole DIY fun stuff, I think your best bet is still the dsPIC. Learning to use assembly language will help make things faster and smaller code-wise. As I mentioned, the C30 C compiler doesn't use the DSP instructions in the dsPIC, instead it will use several regular instructions to do what the dsPIC DSP instructions do in one clock cycle (such as the MAC instruction which is useful in filters and other things).

_________________
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
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Mon Aug 27, 2018 6:30 am    Post subject: Reply with quote  Mark this post and the followings unread

It is not really a bandlimited waveform ( i have to change the manual )
For a real bandlimited waveform i need very much ROM.

Here i have a lookuptable in ROM with a sinus,
then i have a RAM lut, and copy the first base partial
then copy the second partial at twice the speed and volume divided by 2.
then copy third at 3 times the speed and volume divided by 3.
and so on then you have a saw wave.
Ofcourse all this at half volume else it wont fit.

Normally for bandlimited you would have many wavetables,
all with a different ammount of partials,
then you can divide the nyquist rate by the frequency to get the number of partials ( harmonix ) you can use.

For now i just have 1 table you should fill yourself with the ammount you like.
I will add a table in the manual that says how many partials you can use at what note.

Because there is no ROM or RAM enough i should get external EPROM or get a BLIT ( bandlimited impulse train ) oscillator,
i need to have the BLIT for my hybrid synth.

The problem is that you can not have 2 oscillators with the method i used now, it will sound weird, the saw wave needs to be sharp.
I cant find much info about band limited impulse train.
Back to top
View user's profile Send private message
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Mon Aug 27, 2018 6:42 am    Post subject: Reply with quote  Mark this post and the followings unread

By the way i am using XC16 compiler, not C30.
I wish i can do assembly, i cant.

At least you dont have to hack the compiler if you can do ASM,
i also heard you can use all space for lookuptables if you can do ASM,
now i can not have a very big sinus LUT,
i like to trade code space for lookuptables.

You are right i should get those STM32 chips @ 400MHz, wowww,
then i can do poly synths.
I also need to get started with FPGA, i have so many things to do already.

Ok my synth aint that great, what i could do with 400MHz in floating point is incredible
Why dont DIP package exist @ 400MHz ?
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: Mon Aug 27, 2018 8:44 am    Post subject: Reply with quote  Mark this post and the followings unread

VA1 wrote:
Why dont DIP package exist @ 400MHz ?


It's all about the cost of mass production. It's more expensive to make PCBs with holes, through-hole is necessarily larger to accomodate the pin count (can be well over 100 pins). So SMT provides less cost in board production and can be oven soldered instead of solder wave machine. Through-hole packages were never designed so that hobbyists can solder them, it was just what was technically available at the time and it was coincidentally convenient to the DIY hobbyist builder to use them - but it wasn't the chip makers' intentions to make them hobby friendly. The next step after through-hole was to make chips smaller with more pins and still allow automated assembly, and now we have SMT which not only has packages with tiny leads, but also some that use the BGA (Ball Grid Array) design which allows even more pins. Larger SMT can be soldered by those who are steady handed and have good visiion. I have poor vision, so it's very hard for me, but what STM has done and I assume others is to make available boards like the Nucleo which are inexpensive presoldered boards with pads for pins that can connect to all but a very few of the CPU chip pins. With boards like Nucleo, designers (whether commercial or hobbyist) can access these new fast devices.

One thing you'd really like about the more advanced STM32 chips (such as STM32H7) is that the CPU has an internal FPU that does float type add, subtract or multiply in one clock cycle. This means all the fixed point integer nonsense is not necessary because float and fixed point are the same speed (in fact, float is actually faster if you consider the shift that is needed after a fixed point multiply). The float type also has a 23 bit mantissa giving more resolution than 16 bit fixed point as well as providing the exponent to give a much larger range of values. The gcc compiler is also capable of including DSP instructions like MAC in the output code of the C compiler. The STM32 CPUs are not specifically called DSP chips, but they still contain DSP instructions that help speed up DSP applications. I believe that even type double can be processed by the FPU at some clock expense, but is still faster than using normal instructions to do double arithmetic. These features makes it possible to write clear concise DSP code in C and have performance that is often faster than what engineers would usually write using assembly language.

As for the dsPIC - it is entirely possible to write polysynth code for a dsPIC. I've done it for several designs. Not a huge pile of voices, the best I've gotten is 12. While C isn't as efficient as writing your own assembly code, my bet is that you could probably get 4 or even 8 voices with C by being clever with algorithms. You can also write hybrid C & asm designs. This method uses C where it isn't doing DSP work and you'd write inline functions that refer to assembly language programs to do things that need the DSP instructions. Those functions would do things like filtering, interpolation and other DSP processes. Assembly language uses a different way of thinking. Tasks must be broken down into smaller chunks than with C. With C, just a statement like A=A+1; requires several instructions that load memory location A into a register, then one is added to the register and finally the register is stored back to memory location A. While the whole program could be written in assembly, it's not necessary if you use the hybrid method. It allows the clarity of C for much of the application and provides the speed of assembly for tasks that need it or can take advantage of the DSP instructions. There are also other methods that are useful in speeding C up including using the inline and static keywords to reduce function call overhead.

_________________
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
VA1



Joined: Aug 20, 2018
Posts: 98
Location: Nederland

PostPosted: Mon Aug 27, 2018 9:09 am    Post subject: Reply with quote  Mark this post and the followings unread

So if i add static inline in front of my void function() it will be faster ?
Nice to know.

ASM i would love to, you must have spended big time on,
or maybe grew up with ASM.

Its 2018 and i still have to do assembly language ?
Suppose you would buy/hack the XC16 compiler, is that not fast enough ?
Is the compiler that dumb that it cant optimize good ?
what is the problem ?, those microchip software always is sucky somehow and they keep ruining it further.

I hope STM32 has better softwares that also work without internet,
not a shop tab that crashes, i dont intend to buy anything ever exept hardware.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 3 [72 Posts]
View unread posts
View new posts in the last week
Goto page: 1, 2, 3 Next
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Developers' Corner
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