uC programming - where to start

edited February 2013 in Off Topic
This discussion was created from comments split from: More info about the hardware?.

Comments

  • edited February 2013
    @julian Thanks for your answer :) I see… I thought there would be lot of room on the upper right side of the board, but I took another look and you are right ;)
    Nice that you've built a simple UI! I was afraid that the navigation would be to complicated, but the voice->parameters navigation is great :)

    We can open a new thread about the stm32discovery and programming.
    So far I have great experience with objective-c (the programming language for iOS and Mac apps). I wrote some semi complex apps. - I'm pretty sure that I can learn c++ quite easily. - But avr/arm programming should be a bit different. For example I have no idea how to check a state of a potentiometer or how to display some stuff on a lcd. - I took a few looks at arduino code and it seems easy (because of the many libraries). I understand the code, but have no idea how to do all this stuff on arm microcontrollers. Again, this should probably not be too difficult.
    But I'm afraid of DSP programming. I never did anything in this direction and I know that it is somewhat complex. How did you learn it or how did you start?
    Is it maybe possible to share a small code that plays a sine wave over the stereo out on the stm32discovery? That would be awesome and would give me some indication, if I understand the stuff or if it is to complex for me. - I took a look at the shruthi-1 source code, but it is already to feature loaded and to complex (because of all the synthesis parameters), so that it is to hard to get an idea of dsp programming without any knowledge.

    Oh and are you searching for a beta tester? I'm also from Germany and I would love it to help you. I have a quite good understanding how a good UI and hardware design should work and I also know a lot about synthesis.
  • edited February 2013
    the problem with the free space in the upper right: that's the place where the mainboard with the stm32 chip and the audio codecs is sitiing below the board. I tried to keep digital signals away from the analogue part.

    regarding the uC programming:
    basic coding knowledge is a good start!
    Since you are from germany that makes everything much easier!

    check out
    http://www.mikrocontroller.net/articles/AVR-Tutorial
    http://www.mikrocontroller.net/articles/AVR-GCC-Tutorial
    which is a perfect step by step tutorial for the avr. beginning at setting up the hardware and programming tools. Thats how I learned uC coding.

    my recommendation would be to start with an AVR, even if they seem a little bit outdated, they are a good place to start to get the grip on the whole embedded programming topic. There are many good tutorials. And the datasheets are very good. The ST datasheets can be confusion sometimes, with information spread across several documents ;) And nearly everything you learn with an AVR can be used on the stm chips as well. (register names change, but the basic theory is the same) I did lots of AVR coding before and had my basic ARM code running over a weekend when i made the switch to the new hardware.

    I'd do some reeeeealy simple projects first.
    start with a blinking led. This teaches you the basic concetp of IO ports (how to access pins) and the basic setup. from there add small features step by step and learn them on your way. E.g. adding buttons, display, knobs... I'd say don't use finished libraries if you really want to learn about microcontrollers. Stuff like driving LEDs, buttons and displays isn't that hard, and if you write your driver on your own, you learn a lot. Even if you just use the code from one of the many tutorials, you will at least get an explanation how it works.

    and in the end you may be surprised how much you can get out of a small avr. they are more powerfull than you may think ;)


    DSP coding:
    This is another huuuuge topic to dive into.
    As well as uC coding, I teached myself most of the DSP stuff.
    It's a long way, can make your head hurt, but is quite rewarding if somethign works.
    Don't be afraid of the heavy math. I have a basic understanding of math, but never liked complicated formulas. Most of the time I learned the stuff by trying to understand the basic principle behind the function of a dsp module, not studying formulas ;) although they can help.

    I strongly advice against starting to learn DSP coding on an embedded platform.
    The benefits of a fast compile/run/debug cycle and a good debugger are essential, IMHO. I would start with a simple standalone application on the computer. maybe a VST.
    The process is the same as for the uC programming. Make small steps.
    Playing a sine is a good start (you don't have to care about aliasing)
    add a volume envelope. maybe add another sine as a LFO modulating the pitch.
    create a naive saw oscillator, hear the horrible aliasing it will produce,

    another good starting point is trying to make simple FX. The classic VST way to go is to start with a simple gain. just a module that can alter the volume of an incoming signal.
    maybe add an lfo and you've got an amplitude modulator...

    learn the basics of the sampling theory - nyquist frequency, aliasing...
    I'm afraid I don't know any good beginner tutorials for music dsp.
    maybe have a look over ath the KVR forum
    http://www.kvraudio.com/forum/viewforum.php?f=33
    especially the sticky topics
    http://www.kvraudio.com/forum/viewtopic.php?t=329696&sid=f2143d45887cfc9743b4f90d80e628df
    http://www.kvraudio.com/forum/viewtopic.php?t=30071&sid=f2143d45887cfc9743b4f90d80e628df

    the DSP code between PC and an embedded platform is the same. So if you learn it on the PC you can reuse your DSP algorythms on embedded platforms as well.

    cheers,
    julian




  • edited February 2013
    Hi,

    Thanks for your detailed answer! This makes me really, really happy :)

    I just ordered the book "BasicSynth", which guides you through creating your first c++ synthesizer with oscillators, filters, lfos, envs, effects etc. - Seems to be pretty good :)

    http://www.amazon.com/BasicSynth-Daniel-Mitchell/dp/0557022126

    I'm also looking through the posts of your mentioned forum. It seems like there are many valuable information. :)

    I still can't imagine, how numbers & formulas can create a sound :D

    --
    Do you have an idea which avr I should get? Should I get a development board or should I built my own thing with a breadboard? There are so many options… :)

    Thanks again!

    cheers,
    Florian
  • I don't know the book, but a little structured guidance can't be wrong. ;)

    as for how numbers create a sound. just think of it this way. soundwaves are just vibrations in the air. look at your speakers how they pulse forth and back when playing a sound. the position of the speaker is just expressed digitally by values betwenn 1.0 and -1.0.

    so in a naive way you just have to start at -1.0 and add a little bit every sample untill you reach +1.0. then you reset your value to -1.0 again and you created a basic saw wave. the amount you add every time determines how fast the wave goes from -1 to 1 (the frequency). if you multiply the resulting value by 0.5 you just reduced the volume to the half amplitude (your saw now goes from -0.5 to 0.5)
Sign In or Register to comment.