Jorhlok

Me, my opinion, and things I do.

An Integer Only Software Synthesizer Takes its First Steps

Right, so after being dead for a few months, someone used phoenix down on me and so I made a cute little software synthesizer in plain C. The runtime uses only integers, so I’m hoping to port it to a microcontroller like the AVR in my Arduino. So far it’s done a monophonic rendition of the intro of the Super Mario Bros. overworld theme. It used a variable pulse width square wave with amplitude modulation. I just had to hard code the notes in C, which was laborious.

I’ll make a simple tracker for it once I clean up the code a bit and add some more features, like PCM and noise voices. It can do realtime audio generation if you pipe the output into /dev/dsp on a unix or unix-like system. I dumped the output into a file, imported the raw data in audacity as 8 bit unsigned integers with the appropriate sample rate. The sample rate is hard coded into the frequency table file in the source code. Luckily I made a program in C to generate those for me. I’ll go into more of the technical details later. For now, some wave files!

http://soundcloud.com/jorhlok/sets/int-synth-first-run

The very first one, firstnoise8000, is the very first thing that came out of my program. With a samplerate of 8000, it’s suitable to be piped to /dev/dsp. It sounds gritty because of the low samplerate. The next one, firstnoise 44100, is the same samplerate as a standard audio CD. Also probably most music you have in whatever mp3 player you may or may not own. It’s much clearer. I also played a bit more with some extra junk at the end. The end bit is two square waves. One is almost the A above middle C, 440 Hz, and the other is detuned down by sort of one tick.

Those I made and experimented on October the tenth and eleventh. On the twelveth, I drove over to a friend’s house to drive them to an appointment. Their parents were gone, but they finally awoke and let me in. They promptly fell into bed again. I spent just under an hour making this short bit of actual music. I incorportated both waveforms I have successfully programmed, square with variable pulse width and sawtooth. I intend to make something that’s like a sawtooth with variable pulse width, but this one I tried to make as computationally light as possible. At full volume, it does this:

“return ((c>>8)-128);”

The free running counter that describes where in the waveform a sample exists is unsigned 16 bit. The output is signed 8 bit, so I shit the most significant byte down, so it’s 0-255 and move it down so it fits in the signed integer. At a volume that is not a power of two minus one, it does this:

“return ((c>>8)-128)/(127/a);”

This is the only one so far that has division in it. I avoid it because some low power devices don’t have division as a hardware feature, so it can be slow. 8 bit AVR microcontrollers are an example of this. At powers of two, a switch case substitutes bit shifting for division. A single bit shift down is the same as dividing by two but very computationally light. This is what it does at a volume of 63:

“return ((c>>9)-64);”

Right, now to the music. It’s an excerpt from the boss music of Sonic the Hedgehog 2 for the SEGA Genesis. A game I played in my childhood and is one of my all time favorites. Wikipedia says it’s the second top selling game for the Genny.
The bass is cranked out by the sawtooth. The lead is the square wave. At the start of each note, it starts out at middle pulse width and gets one smaller each sample. That argument is an unsigned 16 bit integer, so that’s not incredibly fast. I looped it 4 times in audacity so you could get a feel for it. I also uploaded the version where it stayed as a normal square wave for comparison.

I’m not sharing the source code at the moment. It’s incredibly dirty and hacky. My next post about it will include the source code and it will have more features like noise generation and some PCM audio. I’ll also figure out how to interface it with SDL audio. A simple tracker will probably come after that. Because the voices are separate bits of code, I’m not sure how I’ll interface them with the tracker. It either needs to be compiled into the tracker or be linked dynamically, which I’ll have to learn and is also OS dependent. Or I could use a scripting language, like python. A microcontroller demo will be soon.

Advertisements

19 responses to “An Integer Only Software Synthesizer Takes its First Steps

  1. Aiya June 1, 2013 at 4:04 pm

    Streetpassed you! Nice using your comment as a URL.

  2. gratis book of ra ohne anmeldung October 26, 2013 at 2:20 pm

    I leave a response whenever I appreciate a article on a website or if I
    have something to add to the discussion. It’s caused by the fire communicated in the article I
    looked at. And after this article An Integer Only Software Synthesizer Takes its First Steps | Jorhlok.
    I was moved enough to post a leave a responsea response :-) I actually
    do have 2 questions for you if you don’t mind. Is it only
    me or do some of these responses look like they are coming from brain dead visitors?
    :-P And, if you are posting on other online social sites,
    I’d like to follow anything fresh you have to post.

    Could you make a list every one of your shared pages like your
    linkedin profile, Facebook page or twitter feed?

  3. delete google plus android June 1, 2014 at 7:21 pm

    I was curious if you ever considered changing the
    structure of your site? Its very well written; I love what youve got to
    say. But maybe you could a little more in the way of content
    so people could connect with it better. Youve got an awful lot of text for only having one or
    2 pictures. Maybe you could space it out better?

  4. Charlotte Roof Repair June 20, 2014 at 7:52 pm

    Howdy! This is my first visit to your blog! We are a group of volunteers and starting a new initiative in a community in the same niche.
    Your blog provided us beneficial information to work on. You have done a marvellous
    job!

  5. www.facebook.com June 21, 2014 at 10:30 am

    Hello Dear, are you genuinely visiting this site on a regular basis, if so then you will without doubt
    take pleasant know-how.

  6. Tampa Bay charter boats June 23, 2014 at 6:22 am

    An impressive share! I have just forwarded this onto a coworker who was conducting a little homework on this.
    And he actually ordered me breakfast simply because I stumbled
    upon it for him… lol. So allow me to reword this….
    Thanks for the meal!! But yeah, thanx for spending the time to discuss this issue here on your web site.

  7. World Of Tanks Blitz Cheats July 7, 2014 at 6:01 pm

    World of Tanks is a team-based massively multiplayer online action game dedicated to armored warfare.

    From Austin, take Highway 290 west, past Johnson City, to Stonewall Texas.
    Fish – Ville is the next social game set to take the world by storm.

  8. yes plumbing las vegas Las Vegas NV July 18, 2014 at 10:39 pm

    Plumbing Repairs That Require a Professional Plumbing Service
    Plumbing repair work can encompass many things, such as mending hot water heaters,
    or fitting new faucets in bathrooms. On the internet, there is information about how
    to do many kinds of plumbing jobs. Understandably, most people
    want to avoid hiring a plumber to carry out maintenance or repair work, which they could perform themselves.

    Nonetheless, considerable precision and expertise is needed to implement the majority of plumbing
    tasks.

    Even a basic error, like failing to seal a pipe tightly
    enough, could cause leaks that result in expensive water damage and high water
    bills. Leaks could cause mold to develop in your house as well.
    You should hire plumbing services, whenever severe problems with your
    plumbing system arise. If you don’t do this, you might
    end up making the problem even worse.

    The hot Water Stops Working

    It can be difficult to identify the cause of this problem, unless you have a leaking water
    tank. Leaks can appear anywhere in your system, due to a
    range of factors. Issues with gas heaters can involve thermocouple ignition systems and burners.

    Issues with electrical heaters can involve heating elements, bad overload switches, malfunctioning thermostats, and
    blown fuses or circuit breakers.

    The Water Pressure in Your Home is too low

    There are several things that can cause this problem. Examples include badly designed supply lines, low water
    pressures from wells or city supplies, and water line blockages (such as debris or rust).

    A reputable plumber will diagnose the cause of the problem, and tackle it effectively.

    The Sewer Line Backs up

    In all likelihood, if you encounter a sewer line stoppage, the line
    will have a plug in it that leads out to the primary sewer.
    Frequently, this is caused by tree roots. Large sewer rodding machines
    can be rented, however they might harm the sewer lines or drain. Contact a drain cleaning company or plumber.
    If they experience problems, they will do the repair work.

    Installing a new Water Heater

    Ideally, you should avoid trying to install a new heater on your own. A good plumber will transport the new heater to your
    storage area, connect it and ensure that it functions correctly.

    He or she can get rid of your old heater too.

    Severe Damage to Water Lines

    It is a time consuming process to fix damage to water lines.
    Normally, this occurs due to freezing. Hire a plumber, so that
    you don’t have to interrupt your regular schedule.

    Pipe Freezing

    If you have frozen pipes, they may have cracks in them already — in which case you need a plumber.
    Even if your pipes don’t have cracks in them, hiring a plumber still might be sensible.
    Rather than thawing frozen pipes, some plumbers just replace certain sections of them.

    Any kind of plumbing problem can represent a threat to property or health.
    Therefore, these problems need to be addressed
    straightaway. Locate some good plumbing repairs services, and contact them if you encounter any of the above situations.

  9. tiles cleaning service Las Vegas NV July 19, 2014 at 2:17 am

    There are many types of tiles available nowadays. The method of tile cleaning
    will depend more on the tile type. However there are couple of things to be followed to add the sheen and glow
    of the tiles.

    Do the regular floor cleaning
    Clean the spills as soon as they occur

    It is very crucial to clean dirt and water too as soon as they are
    split to prevent the stains. Place a doormat which helps in reduction of mud or dirt entering
    through footsteps.

    There are basically following tile floors where in one will
    use the tile and grout cleaning process, types of tiles are as
    follow –

    Ceramic
    Porcelain
    Stone

    Porcelain Tile cleaning

    Porcelain tiles maintenance is not difficult if the surface is cleaned regularly.

    The surface can be vacuum cleaned every day or just sweep it.
    The wet mopping is required once in a week. Use
    of mild floor cleaners will do for the mopping. One can make it at home by mixing vinegar
    and water.

    Ceramic Tile Cleaning

    The rule is followed here as well; remove the dirt as soon as possible.

    Vacuum clean the tiles every day or a simple broom can be
    used. Plain water or the special ceramic tile cleaners can be used for the wet mopping.

    Stone Tile Cleaning

    One need to be careful while cleaning the tiles made
    of stones as they are natural minerals. Never use harsh floor cleaners.
    Sweep or vacuum clean. After using any floor
    cleaner use a dry mop to soak any type of liquid residue.

    Grout Cleaning

    Along with the tile cleaning it is very important to regularly clean the grout, i.e.
    the lines between the tiles. Hence tile and grout cleaning goes
    simultaneously. Grout is porous in nature and attracts dirt, grease etc.
    The surface looks shabby if the grout is unclean. It can also be a cause of mildew or mould in the damp areas like bathrooms.
    It is best to have a seal (colour or clear) on the grout which will not only
    protect the surface but also acts as an anti-fungal agent.

    Many a times it gets difficult to maintain the floor due to hectic working schedules.
    Hence we come in picture and provide the tile and grout cleaning services to our clients at
    a very affordable price. Moreover the price depends on the type of the tiles, number of
    tiles and size of the tiles to be cleaned.

    Following steps are followed for the tile and grout cleaning after you
    contact us-

    Pre inspection of the tiles and floor.
    Shifting of the furniture, if any, from that space.

    Dry Sweeping of the surface
    Application of the suitable cleaning solution.
    Cleaning the surface with a soft pad.
    High pressure cleaning
    Mopping and drying the surface.

    We have our experts who carry special tools to do the tile and
    grout cleaning; the grout sealing is also done if ordered.

  10. Leroy July 19, 2014 at 5:53 am

    There are many types of tiles available nowadays.

    The method of tile cleaning will depend more on the tile type.
    However there are couple of things to be followed to
    add the sheen and glow of the tiles.

    Do the regular floor cleaning
    Clean the spills as soon as they occur

    It is very crucial to clean dirt and water too as soon as they are split
    to prevent the stains. Place a doormat which helps
    in reduction of mud or dirt entering through footsteps.

    There are basically following tile floors where in one will use the tile and grout cleaning process, types of tiles are
    as follow –

    Ceramic
    Porcelain
    Stone

    Porcelain Tile cleaning

    Porcelain tiles maintenance is not difficult if the surface is cleaned regularly.
    The surface can be vacuum cleaned every day
    or just sweep it. The wet mopping is required once
    in a week. Use of mild floor cleaners will do for the mopping.
    One can make it at home by mixing vinegar and water.

    Ceramic Tile Cleaning

    The rule is followed here as well; remove the dirt as soon as possible.
    Vacuum clean the tiles every day or a simple broom can be used.
    Plain water or the special ceramic tile cleaners can be used for the
    wet mopping.

    Stone Tile Cleaning

    One need to be careful while cleaning the tiles made of
    stones as they are natural minerals. Never use harsh floor cleaners.
    Sweep or vacuum clean. After using any floor cleaner
    use a dry mop to soak any type of liquid residue.

    Grout Cleaning

    Along with the tile cleaning it is very important to regularly clean the grout, i.e.

    the lines between the tiles. Hence tile and grout cleaning goes simultaneously.
    Grout is porous in nature and attracts dirt, grease etc. The surface looks shabby if the grout is unclean. It
    can also be a cause of mildew or mould in the damp areas like bathrooms.
    It is best to have a seal (colour or clear) on the grout which
    will not only protect the surface but also acts as an anti-fungal agent.

    Many a times it gets difficult to maintain the floor due to hectic working
    schedules. Hence we come in picture and provide the tile and grout cleaning services
    to our clients at a very affordable price. Moreover the price depends on the type of the tiles, number of
    tiles and size of the tiles to be cleaned.

    Following steps are followed for the tile and grout cleaning after you contact us-

    Pre inspection of the tiles and floor.
    Shifting of the furniture, if any, from that space.
    Dry Sweeping of the surface
    Application of the suitable cleaning solution.
    Cleaning the surface with a soft pad.
    High pressure cleaning
    Mopping and drying the surface.

    We have our experts who carry special tools to do the tile and grout cleaning; the grout sealing
    is also done if ordered.

  11. torsion spring garage door Minneapolis MN July 19, 2014 at 9:20 am

    Has your garage door begun to act up and you are worried that a mere garage door repair
    job is not going to be enough? Well, the good news is,
    you do not have to completely replace your garage door
    openers. All you have to do is to perform a few garage door repairs that are
    going to take care of your problem.

    You can perform a few repairs without the help of any professional.
    However, some repairs are more complicated and should not be attempted by the nonprofessional.
    If you do so, you might end up injuring yourself.
    Plus, you might also cause more damage to the garage gate than repair!

    Why do you need the repair?

    First, you should note what problems you are facing with your garage gate.
    Is the door simply not responding? Or is it closing and opening
    partially? Do you find that the garage opener is running, but not opening?
    You will find that the repair work for each of these cases is different.

    What work does garage gate repair involve?

    Light repair works usually involve cleaning, lubricating and tightening the
    tracks, springs and the loose parts of the system. You should first check if the power supply to the opener is intact.
    Sometimes, if the power is not reaching the opener for some reason, your garage
    door will be stuck, and you will be left wondering what went wrong!

    What kind of garage opener do you have?

    When you are planning to perform some garage door repair, you should first find out what kind of opener
    you are using. If it is a standard extension garage gate, you can easily carry out the repair works, once you are able to find
    out what is going wrong with the machine.

    However, if your garage door is making use of a torsion spring,
    you will have to call in a professional to help you with the repair works.
    The torsion spring door is under tremendous pressure, and thus, one wrong move may even turn out to be fatal for you.

    Other garage door repair works

    If you are looking for a temporary fix for your garage gate, you can disconnect the opener from the door, by pulling on the red string that you can see on the side of
    the door. This way you can operate the door
    manually. However, be careful, because if the problem lies in the
    spring of the door, it might fall suddenly on you.

    Check all the loose hardware to make sure that nothing is out of place.
    Also check the springs and see if they are hooked on to the right place.
    If, while carrying out the garage door repair you face any difficulty due to the tension in the springs, try to adjust
    them by hooking them to the next notch. This will make it easier for you to
    work.

    Finally, never forget that the best way to keep your
    garage door in good condition is by regularly carrying out maintenance work on your
    door. This will ensure that you do not have to spend buckets on repair and replacement works.

  12. binary network marketing July 19, 2014 at 1:15 pm

    LinkedIn has a great feature that connects with your existing email accounts and
    allows you to invite anyone you have interacted with
    to your network. This means that you might reach
    people you interacted with once or twice, or people that you
    haven’t spoken with in a while. This is a powerful tool, but are
    you using it effectively in your marketing?
    LinkedIn as a Data Collector
    Look at all the ways you can collect data from people.

    The easiest metric to track for most is their email addresses, so ask people and promote their use.
    Create mailers or offer contests via email registration.
    Remember, each email you collect is another potential LinkedIn profile waiting to be connected to.

    Also, you might convince someone to join LinkedIn when they receive an invite from you, which means more
    customers to interact with.
    Easy Ways to Connect on LinkedIn
    So, what are some easy ways to connect with users and
    get them to want to network with you? Many companies have started
    suing LinkedIn as a corporate blog to promote brand awareness.
    These blogs might not even have anything to do with the products being sold, but
    they might tie in with corporate culture or offer up some helpful
    knowledge or technique. This is called generating substance, and if you
    want people to see a value in your postings, you need to provide
    that substance, otherwise they simply won’t care.
    The nice thing about this is you don’t have to be a multi-faceted business guru to provide content.
    Maybe you promote an interesting link of the day, or maybe you repost a news story about something company-related (please give credit if you
    do this.). It could even be a humorous blurb or story, or even a business-appropriate joke to
    keep your network’s attention. The only constant is that the postings stay constant.
    If you start it, then maintain it to help build that brand awareness.
    Remember, people won’t actively look for you if they don’t know you exist.

    One great way that some companies have started building a loyalty network is through promoting
    their employees. Some companies will offer a spotlight on their employees, showing off the projects they have done or discussing their high points.
    This not only helps to ensure your employees feel valued,
    but it also helps to paint your company as more human,
    which is something you want when trying to get people to connect with you.

    Pitfalls and Things to Avoid With LinkedIn
     
    Most of what has been discussed here has been the positives
    of using LinkedIn for your promotions, but there are some pitfalls you may want to avoid.
    Again, not all marketing works for all niches and some can be turned off more easily than others.

    For starters, when advertising with a graphic, consider
    the context that your audience will view it in. LinkedIn is business to business networking.

    Is your picture one that would be considered safe for a business networking platform?
    Yes, attractive, nearly-naked people tend to get clicks, but are those the kind
    of ads people at major corporations are going to be
    more than likely be turned off due to lack of professionalism?
    Consider your content in your pictures before posting and make
    sure your graphics are a good match to your audience and marketing message.

    Second, watch your language. While on the surface, this could be taken as do not
    swear, on a deeper level, you have to consider what
    a company will filter for and what they will allow.
    Some words tend to trigger web filters pretty easily, so be careful about your verbiage.
    Also, look at the message your words send. Are you trying to be edgy, dynamic, endearing?
    Do your words properly convey the message you want people to see?
    Sometimes people get so wrapped up in sending
    out a strong message that they fail to consider if it is the right one.

    Third, don’t verbally tie yourself to a region or company if you can help it.
    While you may want to highlight a company on a landing
    page or maybe you are geared towards a certain region of the world, you don’t want to inadvertently
    exclude potential customers because they think your ads don’t immediately
    apply to them. Remember, you can focus your ads in terms of companies and locations ahead of time, so listing out that info in the actual ad might prove redundant.

    Fourth, don’t slack on your content. It can be easy to start with a big push,
    but the number one thing that kills an audience’s
    interest is inconsistency. Don’t slouch on your posts.

    Make sure you dedicate a certain period of time each day to providing some form of content.
    If you can’t or think you might have problems with this, hire someone to do it for you or spend a day or two generating multiple
    posts so that you can just plug and play. However
    you do it, just be sure to keep doing it. You are setting an expectation of service as accompany when you post, and
    to do so inconsistently will send a bad message abour what your company considers professional.

    Fifth, be careful on rebranding. Some smaller companies take
    the philosophy of experimentation a bit too far and keep trying to reinvent themselves every month or quarter, but the truth of it is that many
    companies form bonds over the long term with clients, and just because you announce a name change or a new logo, that
    doesn’t mean that your clientele is paying attention. To build your brand, you need
    consistency, so stick to a logo or name and try to avoid being so
    edgy that you can’t make up your mind about your name. Remember, you’re a
    business, not a rock star.
    LinkedIn Final Thoughts
     
    LinkedIn is a wonderful tool for reaching people in the business world.

  13. refrigeration and airconditioning August 30, 2014 at 11:57 am

    Hello! This is my first comment here so I just wanted to give a quick shout out and tell you I really enjoy reading through your articles.
    Can you recommend any other blogs/websites/forums that go over the same subjects?
    Thanks for your time!

  14. Myrtle Beach Fishing Guides September 3, 2014 at 8:36 pm

    Useful information. Fortunate me I discovered your web
    site by chance, and I am shocked why this coincidence did not came about earlier!

    I bookmarked it.

  15. Yanira April 14, 2015 at 10:56 am

    There are several other marine electronics that are also
    required for better communication and entertainment needs
    while you are on the sea. Zac has learned leadership in non conventional
    ways and I suspect that he will achieve his Life’s Work in an out-of-the-ordinary way.
    But what good is sailing without food that appeals to
    the palate.

  16. lip lift May 22, 2015 at 6:14 pm

    What’s up mates, its fantastic paragraph on the topic of cultureand entirely defined, keep it up all the time.

  17. turtle beach ear force p11 June 4, 2015 at 11:52 am

    Despite being significantly cheaper, the Turtle Seashore XOSeven have leather
    trim, and I had anticipated the same from this headset.

  18. Audrea June 26, 2015 at 4:51 pm

    You can definitely see your enthusiasm in the work you write.
    The sector hopes for even more passionate writers like you who are not afraid to mention how
    they believe. At all times follow your heart.

  19. offensive shirts August 11, 2015 at 11:47 am

    I pay a quick visit every day some blogs and information sites
    to read articles or reviews, but this webpage provides quality based articles.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: