Wednesday, 15 May 2013

Algorithms of the street - Part 2: Amplitude Modulation

So, I've already shown you Frequency Modulation (FM) in pure data, it's an algorithm, or recipe for Pure Data, meaning you can use it in other contexts, change some parameters to vary your sound and if you're really lucky, reading Algorithms of the Street - Part 1: Frequency Modulation will have told you exactly what FM is.

Given that you might well have read that post by now (if not, I would recommend you do) you'll have noticed that there's some similarity between the title of that post and this one. The fact that there's only one word and one number different, perhaps?

As the name suggests, Amplitude Modulation is a lot like Frequency Modulation. Only instead of modulating (changing, in a regular way) the pitch, or frequency of our tone, it modulates the volume (amplitude).

If you've read the FM tutorial, some of this will sound quite familiar. If you're feeling confident you could always skip to the end of this one and see if you can see the difference in the patch.

Step 1: No Modulation Yet



Once again, I've used a version of the generative patch from Pure Data and BACON (Part 2) as a starting point. Clicking the toggle at the top there will start a random stream of numbers, converting to frequencies and creating a random, continuous melody. But the tone being used is fairly dull, a simple sine-wave. It's hard to listen to for a long time, and we can take a lot more control of this tone.

Step 2: Modulate the amplitude



First, notice that I added a frequency within the oscillator box, and cut the wire connecting it to our random melody generator. Secondly you'll notice that I've added another audio multitiply (*~) and a second oscillator, which is only working at one hertz, a single cycle every second.

Your ears will be telling you, at this stage, that the sound is fading in and out with a regular pattern, on the same note. This is the simplest form of AM, with an oscillator going very slowly (a Low Frequency Oscillator or LFO) and no extra control.

So what's going on here? Let's look at some 'known facts' I've mentioned in earlier blog posts:

  • Digital audio is a high-speed stream of numbers which are converted to control signals for a speaker or speakers
  • These numbers range from 1 to -1
  • An oscillator in Pd outputs this same range, 1 to -1
  • Because they're numbers, they follow the same multiplication rules as numbers:
    • If you multiply it by 1, it is unchanged
    • If you multiply it by 0, the result is 0
  • Sine waves (which are also the output of osc~), plotted on a graph, are this shape.

We're multiplying a tone (called the carrier) by a much slower tone, which is changing it in some way, and so is called the modulator. So the volume starts at 0, silent, increases, arcs through it's maximum value, then back down below zero? 

Once again, we can rely on the multiplication rules from the world of maths here. If you multiply a number by -1, the result is the same, but on the other side of zero. So what we're actually doing here is turning our sine wave upside down, then producing the same volume arc as before. Although we can't tell the difference because it's shape is unchanged, we just hear the a repeated volume arc.

So effectively, the amplitude modulation we're hearing is more this shape:


Also, because we're hearing both the up and down parts of the modulating sine wave as an increase in volume, we're hearing this pattern twice a second, instead of once. 

Step 3: Bringing it up to speed

Phew, that was easy.

Okay, so we've increased the frequency of our modulator to half that of the tone itself. We're hearing a thicker, more interesting sound. But why?

Well, as I discussed in Pure Data and BACON (Part 1), the human ear can only recognise around 30 separate sounds in each second. When sounds are more regular than that (have a higher frequency), we hear a continuous sound instead of separate events. So our modulation is now part of a complex tone, instead of making the volume lurch, you can't hear the process as it happens, only that the tone sounds different. 

So... With this algorithm in place, we can just add our melody generator back in, right?

Step 4: The Fly in the Ointment


It seems such a simple idea, we add melody to a tone generator, and we get a melody produced in that tone. 

Our ears, however, tell us that it's not at all like a clear melody. Just like this step in my Frequency Modulation tutorial, we've exposed a weakness in our modulation algorithm. The frequency of the carrier changes but the modulation frequency (literally, the frequency of our modulating oscillator) doesn't.

Unlike FM, however, there's an additional problem. Once again, the world of maths tells us that multiplication can be changed around and the result doesn't change (2 x 4 is exactly the same as 4 x 2, and so forth). Because of this, it's not at all clear in our algorithm which is the carrier and which is the modulator, they act on each other in exactly the same way.

So the rather unpleasant sound we're hearing now is two tones competing with each other to become the note you're actually hearing, and they clash. 

There is a solution, however...

Step 5: Control the depth and use a proportion


Okay, the first thing you'll probably have noticed here does nothing to the sound. I've added a couple of comments (ctrl + 5), to tell you which oscillator is the modulator, and which is the carrier. These literally do nothing at all except say something on-screen. Don't believe me? Right-click on one and check it's help patch.

More importantly, I've added another multiply below the modulator, which means it will only change it's volume from 0.5 to -0.5, having half the effect (which we call the modulation depth). Also (as a side-effect) reducing the volume of our sound by half. 

The most important thing here, however, is the multiply above the modulator. This means that whatever frequency of the carrier, the modulator will be at half of that. They are changing frequency in synchrony, so you can hear what is effectively one tone, changing it's pitch, as opposed to two warring frequencies. 

This will produce something like an organ tone, this specific ratio reminds me of the music from the classic game, columns. Happy memories.

We can vary the tone it'self by changing the modulation frequency and depth, just as we did in the FM tutorial. However, before we start playing around, there's a problem we must take care of...

The modulation depth typically just controls how much effect the modulator is having, but here it's also vastly changing the volume of the resulting tone. The best way to do this is by adding an offset to keep the modulating tone from crossing zero.

Step 6: An offset to solve the depth issue


Again, the most noticeable thing here is not what I'm trying to show you, I've changed out the numbers in the multiplies above and below the modulator. These are set to range from 0 to 1 and control the modulation frequency and depth, respectively.

Below the lower of those, however, I'v done something unusual. Two pieces of fixed arithmetic on our modulator frequency. So:

  • Adding 1 (with +~) changes the range from 0 to 2
  • Multiplying by a half changes it to 0 to 1
This means that while changing the depth will affect your volume, a depth of 0 does not mean a volume of 0. It means a volume of 0.5, and a depth of 1 means a changing volume that centres around 0.5. This also means that we no longer have the arcing waveform of earlier. The graph of our modulation volume now looks like this:

Notice how it's all above that centre point (zero). 

Step 7: Two things to control? Use a grid


The first thing you'll notice here, is that I've added a grid (to create your own make an object (ctrl + 1) and type the word 'grid' into it), I've also set the properties like so (to get to the properties dialogue, right click and select properties).

I made it big with the Height and Width fields, then set the range of both axes to 0 to 1 with a small step size. 

I've then taken the output of the grid to two sends, mod_frequency and mod_depth, and replaced the two sliders with the corresponding receives. 

Hey presto, we're generating a melody and changing the sound of an AM tone generator with a dot on a grid. 






Secret extra step: shhh, don't tell

Okay, so there's tutorials for both AM and FM synthesis here on the blog and I've stressed that these are re-usable algorithms, and once you understand them you can swap them out for oscillators in other places. The inquisitive mind is now probably thinking "does that mean I can make a synthesizer with both frequency modulation and amplitude modulation?" 

Of course you can, if you've read both posts you'll know all the parts of this, so I'll just whip up an AM/FM synth patch...


Well, there you have it, I've assumed an FM modulation depth of 0.5 and an AM depth of 1 (you don't need any objects to multiply by 1, I removed that one entirely). 

You can probably work out what each part of this is doing, so you can now have a play with the grid, as in both individual cases, when the frequency is low, you get a thick, heavy kind of sound, and when it's high it's richer, more bell-like. But this effect is compounded by two modulation frequencies. 

Near the bottom left of the grid, when both are low the sound can be heavy, and you may even hear a regular rhythm in the modulation in the bottom left square. To the top right it's more rich and complex than you will have heard so far in this series of tutorials. 

It's starting to get more complex now, and I promise I will eventually get around to blogging about hiding bits of Pure Data patch away so you can concentrate elsewhere, but for now, everything's on show. 



Well, that's it for now. I hope this all made a reasonable amount of sense and enlightened you a little about Amplitude Modulation. 

Did you find this tutorial helpful? Get stuck anywhere? Don't know what on earth I'm blathering on about? Feel free to comment here or get in touch with me direct at @MarmiteJunction

 Thanks for reading, God bless.

102 comments:

  1. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.

    big data training in chennai

    ReplyDelete
  2. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...

    Article submission sites
    Guest posting sites

    ReplyDelete
  3. The blog which you are shared is very much helpful for us to knew about the web designing. thanks for your information.
    Web Designing Institute
    Best Web Design Courses
    Web Design Training Courses
    Learn Website Design
    Best Way to Learn Web Design

    ReplyDelete
  4. Awwsome informative blog ,Very good information thanks for sharing such wonderful blog with us ,after long time came across such knowlegeble blog. keep sharing such informative blog with us.
    Airport Ground Staff Training Courses in Chennai | Airport Ground Staff Training in Chennai | Ground Staff Training in Chennai

    ReplyDelete
  5. I am obliged to you for sharing this piece of information here and updating us with your resourceful guidance. Hope this might benefit many learners. Keep sharing this gainful articles and continue updating us.
    RPA Training in Chennai
    Robotics Process Automation Training in Chennai
    RPA courses in Chennai
    Robotic Process Automation Training
    RPA course

    ReplyDelete
  6. Hi, Your post is quite great to view and easy way to grab the extra knowledge. Thank you for your share with us. I like to visit your site again for my future reference.
    Java Training in Chennai
    PHP Training in Chennai
    Core Java Training in Chennai
    Java Training center in Chennai
    PHP Training
    Best PHP training in chennai

    ReplyDelete
  7. You have provided a nice article, Thank you very much for this one. And I hope this will be useful for many people. And I am waiting for your next post keep on updating these kinds of knowledgeable things
    Selenium training in chennai
    Selenium training institute in Chennai
    iOS Course Chennai
    Digital Marketing Training in Chennai
    hp loadrunner training
    Loadrunner Training in Velachery

    ReplyDelete
  8. This information is impressive. I am inspired with your post writing style & how continuously you describe this topic. Eagerly waiting for your new blog keep doing more.
    ccna Course in Bangalor
    ccna Training in Bangalore
    Best ccna Institute in Bangalore
    ccna Institute in Bangalore
    ccna Training Institute in Bangalore

    ReplyDelete
  9. Do not pass by, go to the online casino and try your luck best casino slot Do you like to play online casino? Then come to us and win like the last day.

    ReplyDelete
  10. Когда человек задает вопрос где купить лед ленту я всегда отвечаю в ekodio, супер качество и супер цены.

    ReplyDelete
  11. تنتج أفضل شركة تنظيف في شقق الدمام مستوى رائع وقوي ومحترف مع أقوى الخدمات والخصومات على مدار العام لجميع عملائنا للتخلص من الأوساخ والتربة معنا
    شركة النجوم لخدمات التنظيف
    شركة تنظيف خزانات بالرياض
    شركة تنظيف بالرياض
    شركة تنظيف شقق بالرياض

    ReplyDelete
  12. This information really amazing thanks for share this article thank you..

    tamilrockers malayalam

    ReplyDelete
  13. السلام عليكم ورحمه الله وبركاته عملائنا الاعزاء كلنا نعرف اهميه المسابح فى حياتنا خاصه فى فصل الصيف بسبب ارتفاع درجات الحراره
    شركة الصفرات لتنظيف المسابح بالرياض
    ومن ثم يجب علينا الاعتناء بنظافه المسبح والحفاظ على حيويه المياه بداخله من اجل الحفاظ على صحتنا وصحه اطفالنا علينا ايضا ان نعرف ونتسأل ما سبب تلوث مياه المسبح
    نجد ان السابحون هم المصدر الرئيسي لتلوث مياه المسبح عادة. فهناك البعض من العادات السيئة يقوم بها زوار المسبح، الذين لا يلتزمون بقواعد النظافة العامة،
    فيتبولون في المياه أثناء السباحة دون إكتراث للأخرين. أيضاهنالك من يتجاهل تنظيف نفسه قبل السباحة، ما يؤدي إلى انتقال العرق إلى المياه.
    السيدات أيضا اللواتي لا يزلن مواد التجميل عن البشرة بشكل كامل قبل ممارسة السباحة، ينقل من خلالهن زيوت ومواد التجميل إلى المياه في المسبح
    نعتقد اننا عندما ننزل المسبح ان المياه تبدو نظيفه جدا ولكن العين المجرده لا تستطيع النظر والشعور بالبكتريا والفطريات لان حجمها يكون ظئيل جدا
    ومن ثم تقدم شركتنا افضل الطرق فى تنظيف المسابح وافضل ادوات التنظيف اتصل بشركتنا نصلكم فى الحال بأحسن الاسعار وافضل العماله المدربه فى تنظيف المسابح
    كما ان فى الأونه الاخيره نشرت الكثر من الصحف والمجلات العالميه عن الامراض التى تنجم عن عدم نظافه المسبح
    مثل احمرار العيون ومنها الأمراض الجلدية وأمراض الجهاز التنفسي وأن أكثر الأمراض شيوعاً خلال الصيف هي الدمامل، وحروق الشمس
    والالتهابات الفطرية مثل النخالية المبرقشة «عدوى فطرية في الفخذ»، وتسبب الحرارة الشديدة بتعرق الجلد، وتظهر على الجلد كحبوب مؤلمة، وحكة شديدة في جميع أنحاء الجسم،
    بقع بيضاء اللون أو داكنة على الصدر والظهر أو تقرحات وحكة بين الأصابع، التي تسمى «سعفة القدم»، التي تمثل عدوى فطرية وتنتشر في فصل الصيف وتسبب حكة في القدمين،
    وتحديداً بين الأصابع، وبقعاً متقشرة بيضاء اللون، مؤكداً أن التعرق الشديد الذي يحدث في الصيف، وخاصة بين الرياضيين، هو الذي يزيد من حدوث هذه العدوى الفطرية،
    شركة الصفرات لتنظيف المسابح بالرياض

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. You have provided a nice article, Thank you very much for this one. And I hope this will be useful for many people. And I am waiting for your next post keep on updating these kinds of knowledgeable things
    Android Training in Chennai
    Android Course in Chennai
    Android Training in Bangalore
    Android Course in Bangalore
    Android Training in Coimbatore
    Android Training in Madurai

    ReplyDelete
  16. Advanced Elements AE1007-R is both inflatable and convertible kayak designed for both solo and tandem paddling.

    Elevens Cruise Plus Foldable

    ReplyDelete
  17. Really i found this article more informative, thanks for sharing this article! Also Check here

    Download and install Vidmate App which is the best HD video downloader software available for Android. Get free latest HD movies, songs, and your favorite TV shows

    Vidmate App Download

    Vidmate apk for Android devices

    Vidmate App

    download Vidmate for Windows PC

    download Vidmate for Windows PC Free

    Vidmate Download for Windows 10

    Download Vidmate for iOS

    Download Vidmate for Blackberry

    Vidmate For IOS and Blackberry OS

    ReplyDelete
  18. Lucky Patcher Apk
    Lucky Patcher
    Lucky Patcher App
    How to Use Lucky Patcher App
    How to Use Lucky Patcher Apk


    Lucky Patcher smile could be a must-have hacking app for all the crazy gamers.
    This app helps in modifying most of the android games so the games will be enjoyed to the fullest.
    It additionally lets us modify numerous applications in many ways Lucky Patcher Download.
    Lucky Patcher smileis an incredible tool that permits you to block advertisements, take away system apps, modify system apps, bypass license verification, modify app permissions, and for a lot of.

    ReplyDelete
  19. keep up the good work. this is an Assam post. this to helpful, i have reading here all post. i am impressed. thank you. this is our digital marketing training center. This is an online certificate course
    digital marketing training in bangalore | https://www.excelr.com/digital-marketing-training-in-bangalore

    ReplyDelete
  20. We say NO to confusion and YES to simplicity! Ingramer Instagram Bot Powered By A.I. provides 4 different modules which include all popular features.

    best instagram bot

    ReplyDelete
  21. If you prefer to talk to someone in our office before submitting your property information just give us a call today at (414) 269-6643

    We Buy Houses Franklin WI

    ReplyDelete
  22. Many anime viewers watch the desired films online by using it. Also, this site provides the facilities for the players to download their favorite videos or films. The reason is that some users are very busy.

    GoGoanime

    ReplyDelete
  23. Moreover, if you think about how you can download movies from this site, then it is very easy. All the videos or films have downloading options. So, you need to tap on that option to download any movie

    Kissanime

    ReplyDelete
  24. First of all, you may want to go to the home page of Udemy and sign up for an account, which will cost you nothing. As soon as you have signed up, you can access tons of free as well as paid courses. office 365

    ReplyDelete
  25. Light weight, disposable valved particulate respirator. These respirators meet the requirements of EN149:2001 category FFP2 which protects the wearer from low-to-average toxicity solid and liquid aerosols

    respiratory protection

    ReplyDelete
  26. One of the way the product saves your money is that you won’t have to go through the trouble of buying new gloves or other safety equipment. However, since you are dealing with chemicals here, you are required to be careful, especially when you have got sensitive skin.

    RUSTZILLA Professional

    ReplyDelete
  27. Protocol for Identifying Non PV Triggers – Elad Anter



    Protocol

    ReplyDelete
  28. Eyal Nachum is a fintech guru and a director at Bruc Bond. Eyal is the architect of the software that SMEs use to do cross-border payments.

    Eyal Nachum

    ReplyDelete
  29. Als er één zaak van belang is, dan is het wel dat u op het verhuisbedrijf Den Haag kunt vertrouwen. U geeft immers de zorg over al uw spullen in handen van iemand die u niet kent. Dit geldt ook voor uw meest dierbare bezittingen. Het is dan natuurlijk wel van belang dat hier op de juiste wijze mee wordt omgesprongen.

    Verhuisbedrijf

    ReplyDelete
  30. Als u zelf uw kind wil gaan helpen, moet u natuurlijk wel weten wat redactiesommen eigenlijk zijn. Bij redactiesommen zit de som verwerkt in een verhaal. Het worden dan ook wel verhaaltjessommen genoemd. Waar deze verhaaltjes eerst nog vrij eenvoudig en kort zijn, worden de redactiesommen in groep 8 steeds ingewikkelder.

    Lees meer

    ReplyDelete
  31. Een partytent huren voor je feest heeft verschillende voordelen. Het belangrijkste voordeel is dat je feest ook kan doorgaan als het weer niet helemaal meewerkt. Door een partytent te huren heb je geen last van regen of kou. Het enige waar je rekening mee moet houden is dat er geen al te harde wind staat, want dan kan het gebruik van een partytent gevaarlijk zijn. Je kunt bij Colors Events verschillende soorten partytenten huren waarmee jouw feest of evenement gegarandeerd een succes wordt.

    Bekijk de website

    ReplyDelete
  32. Bijna alle leerlingen hebben wel eens moeite met een bepaald vak. Een klein steuntje in de rug is dan vaak genoeg om het verschil te maken in hun cijfers. Dat steuntje in de rug zijn wij. Excellent Academy beschikt over zeer kundige docenten, die de leerling helpen om net dat verschil te maken.
    bijles den haag

    ReplyDelete
  33. Webactueel schakel je in als je een maatwerk WordPress website laten maken wilt. Door een maatwerk website te ontwikkelen is het mogelijk om meer leads te genereren. Daarbij hebben we altijd oren voor de wensen en eisen die jij als ondernemer hebt als het om jouw website gaat. Bovendien gaat het om meer dan alleen een website. Ook het toepassen van de juist online marketingstrategie helpt hier in grote mate bij. Wij kunnen dit allemaal voor je verzorgen.

    Webactueel

    ReplyDelete
  34. Webactueel schakel je in als je een maatwerk WordPress website laten maken wilt. Door een maatwerk website te ontwikkelen is het mogelijk om meer leads te genereren. Daarbij hebben we altijd oren voor de wensen en eisen die jij als ondernemer hebt als het om jouw website gaat. Bovendien gaat het om meer dan alleen een website. Ook het toepassen van de juist online marketingstrategie helpt hier in grote mate bij. Wij kunnen dit allemaal voor je verzorgen.
    Website laten maken

    ReplyDelete
  35. Zonder al te veel poespas gewoon een nieuwe, strakke en frisse wandafwerking? Dan is het spuiten van latex muurverf een goede uitkomst. En ook dan moet je bij Latex Spuiten XXL zijn. Het hanteren van de speciale spuiten voor latexverf hebben wij ons in de loop der jaren eigen gemaakt. Door de spuittechniek ontstaat er een egale structuur, die een stuk strakker is dan bij het sauswerk met een traditionele verfroller. Bovendien is de klus een stuk sneller geklaard – ondanks dat we de werkzaamheden minstens zo gepassioneerd als traditioneel binnenschilderwerk uitvoeren. Latex spuiten is daarom doorgaans voordeliger dan latexen met de verfroller. Disclaimer: dit is afhankelijk per situatie en oppervlakte.

    verf spuiten


    ReplyDelete
  36. The lots of women ask, can we take protein shakes breastfeeding. They want to use protein powder shakes in breastfeeding

    questions to ask at first prenatal visit

    ReplyDelete
  37. You can find the best breastfeeding water bottle from the top 5 brands. A very fantastic bottle that you can use in lactation or pregnancy.

    green tea slim pills

    ReplyDelete
  38. Nice article. I liked very much. All the informations given by you are really helpful for my research. keep on posting your views.
    ccna course in Chennai
    ccna Training in Chennai
    ccna Training institute in Chennai
    ccna institute in Chennai
    Best CCNA Training Institute in Chennai

    ReplyDelete
  39. Your Website is very good, Your Website impressed us a lot, We have liked your website very much.
    We have also created a website of Android App that you can see it.

    http://damodapk.com/
    http://infotodaypk.com/

    ReplyDelete
  40. Your Website is very good, Your Website impressed us a lot, We have liked your website very much.
    We have also created a website of Android App that you can see it.

    http://damodapk.com/
    http://infotodaypk.com/

    ReplyDelete
  41. Digikeytech is a free online information encyclopedia, News Great knowledge base of facts, Life Pro, information Hub.

    digikeytech

    ReplyDelete
  42. 우리카지노 100%안전 검증된 카지노사이트 만 엄선하여 소개해드립니다 국내 업계1위 우리카지노계열 전통이 있는 온라인카지노 에서 안전하고 편안한 게임을 ..

    우리카지노

    ReplyDelete
  43. Prime Crack is a free site to download 100% working Cracked Software With Serial Key Activator Crack & Full Version Free Download.


    Adobe Photoshop CC Crack

    ReplyDelete
  44. We are one of the UK's Leading Suppliers and Manufacturers of ALL Face Masks. Our range includes all types of Respiratory Protection products meeting various regulations including FFP1, FFP2, FFP3, N65, N95 and N99. Our range includes Valved and Non Valved Respirators, Disposable Dust and Face Masks, Medical, Dental, Hygiene, Surgeons Protective 3 Ply Face Masks. We also stock reusable Face Masks and Respirators


    Face Masks





    ReplyDelete
  45. We review the top-rated best slippers for Sweaty Feet for men women. Sweaty slippers are designed to create easiness for … Read moreBest Slippers for ...

    bestslippersguide

    ReplyDelete