Skip to content
  • About Us
  • Contact Us
  • Privacy Policy
  • Disclaimer
  • Corona Virus Stats (Covid-19)
  • Work with us
  • FB
  • LinkedIn
  • Twitter
  • Instagram.com
Tekraze

Tekraze

Dive Into Technology

  • Guides
    • Developer Guide
    • PC Guide
    • Web Guide
    • Android Guide
    • Music
    • Tutorials
  • Feed
    • Tech News
    • Shared Tech
    • Gaming Videos
    • Unboxing videos
  • Forums
    • Android Apps
    • Angular Npm Packages
    • Useful Site Links
    • Tech Queries
    • Windows OS Help
    • Web Guide and Help
    • Android Os And Rooting
    • Jhipster Discussion
    • Git & GitHub forum
    • Open Source Forum
  • Work with us
  • Toggle search form
  • Why Edtech Apps are Leading the Market Right Now
    Why Edtech Apps are Leading the Market Right Now Tech News
  • Triller App taking TikTok over AppStore
    Triller the app that is overtaking TikTok in the App Store? Tech News
  • Facebook challenges YouTube with Licensed Music
    Facebook challenges YouTube with licensed music videos Tech News
  • Global Spending on AI expected to Double in four years tekraze banner
    Global spending on AI ‘expected to double in four years’, says IDC Tech News
  • India wiidens China App ban
    India widens China app ban to Baidu and Weibo Tech News
  • Social Media Influencing Apps for mobile tekraze
    Social Media Influencing apps for mobile to try Tech News
  • What makes electrostatic headphones different from other headphones
    What makes electrostatic headphones different from other headphones? Music
  • The Best Cloud Storage Service Tekraze
    Which is The Best Cloud Storage Service of 2020 [Full Comparison] Tech News
Make Music with A Programming Language Chuck

Make Music with A Programming Language easily with Chuck

Posted on January 6, 2023January 6, 2023 By krizillox_krizi No Comments on Make Music with A Programming Language easily with Chuck

A piece of code can create beautiful music.

A person trying to make music with a programming language on a laptop
Photo by Yasin Aydın: https://www.pexels.com/photo/unrecognizable-male-dj-in-headset-working-on-desktop-computer-3796788/

Never underestimate the power of a computer code. It is as elegant as soothing scenery and as cruel as Satan from hell ( the viruses ).

Today we will introduce to you a compact and cool programming language called – ChucK. ChucK is a strongly timed programming language, which means it has its own internal clock and it works along it. ChucK has a very strong friendship with time. Everything which happens in ChucK happens with the advance in time. Each line of code can be asked to wait for a particular time period or could be made to get executed at a particular point in time. Let’s write a program in ChucK to make some music. Before that here are some features of ChucK.

  • ChucK is a programming language tailored for making a sound.
  • ChucK is designed around time.
  • ChucK has concurrency i.e. running multiple Shreds together.
  • ChucK is a High-Level Language i.e. has simple text-like code which is easy to understand.
  • ChucK is open source and freely available.

Table of Contents

  • What all do you need to make music with a programming language?
  • Now shall we begin to make music with programming !!
  •  You’ll see something like this.
  • Now You Are A Little Bit Familiar With The ChucK Interface.
  • Explaining the code for Chuck language

What all do you need to make music with a programming language?

  1. Download ChucK from => https://chuck.stanford.edu/
Make Music with A Programming Language easily with Chuck 1

2. Download the installer according to the operating system you use

3. Install it and you are done!

We are using windows OS for this tutorial so we downloaded the windows version of the installer. ChucK has its own Development Environment so don’t worry, the code will be the same for all OS’s.

Now shall we begin to make music with programming !!

So, now navigate to the directory in your file system where you installed ChucK and open the application titled ‘ miniAudicle.exe ‘.

Chuck miniaudicle.exe on explorer
Chuck Miniaudicle.exe

 You’ll see something like this.

Chuck Interface for making music with programming language
Chuck Interface

You can notice three windows appear. These are –

  1. Console – These windows display the error codes and other information.
  2. miniAudicle – You write all your code here. Save and Open files.
  3. Virtual Machine – ChucK has its own Engine. It works over this Virtual Machine instance. You’ll get to know more about it in later tutorials.

Now You Are A Little Bit Familiar With The ChucK Interface.

Now click on the miniAudicle window. Create a new file. File > New.

We’ll tell you all the functioning of the code later in this tutorial. For now, input this code in your new file.

/**
 
 1 SinOsc sine_wave => dac;
 2 
 3 440 => sine_wave.freq;
 4 0.5::second => now;
 5 
 6 880 => sine_wave.freq;
 7 0.5::second => now;
 8 
 9 660 => sine_wave.freq;
10 1::second => now;
 */

So, an important thing, ChucK works on that Virtual Machine thingy. Therefore, firstly click on the ‘ Start Virtual Machine ‘ button in the Virtual Machine window. You’ll notice a clock starts running in that window.

Make Music with A Programming Language easily with Chuck 2
Chuck Virtual machine interface

Notice the ‘ running time ‘ and the ‘ shred ‘ count. Shreds are nothing but an instance of a ChucK program. The ‘ remove last ‘ button removes the latest added Shred and the ‘ clear VM ‘ button clears all the VM’s from the list.

Now from the miniAudicle window, click on the big green plus button titled ‘ Add Shred ‘. It will add the Shred of your program into the VM and you will hear three variations of a tone for a total of 2 seconds. 0.5 second for a sine wave at 440 Hertz, 0.5 for a sine wave at 880 Hertz, and 1 second for a sine wave at 660 Hertz.

This may not be pleasing to your ear, but hey! you create sound through your program.

Explaining the code for Chuck language

Line 1 is telling ChucK to create a Sine Wave Oscillator named ‘ sine_wave ‘ with the keyword ‘  SinOsc ‘. The symbol ‘ => ‘ is called ‘ ChucKing ‘. So, we are creating an instance of the Sine Wave Oscillator named ‘ sine_wave ‘ and we are ChucKing it to ‘ dac ‘. ‘ dac ‘ is nothing but the Digital to Analog Converter in your computer system. ChucK recognizes the hardware you are using and devices the sound hardware of your computer as a ‘dac ‘, in simpler words – your speakers. And a semicolon ‘ ; ‘ to end a ChucK code statement.

Line 3 is telling ChucK to assign ‘ 440 ‘ to the parameter ‘ sine_wave.freq ‘. In ChucK assigning is not really called ‘ Assigning ‘, it is called ChucKing, so later from now we will call this statement as ChucKing the value ‘ 400 ‘ to ‘ sine_wave.freq ‘. The keyword ‘ freq ‘ is a method, predefined for the Oscillators available in ChucK. It is used to set the Frequency of the Sound Wave which ChucK produces. The period is used between ‘ sine_wave ‘ and ‘ freq ‘ as a Dot Operator. It means, ‘ freq ‘ of object ‘ sine_wave ‘.

Line 4 – As told before, ChucK is a strongly timed language and has its own internal clock and also that he works with an Advance in Time. This line of code is telling ChucK to ChucK ‘ 0.5 ‘ as data type ‘ second ‘ to ‘ now ‘. ‘ now ‘ is a special variable in ChucK. It keeps track of the current time in ChucK. We’ll talk more about ‘ now ‘ in our later tutorials. For now, know only that ‘ now ‘ only stores the current time of ChucK.

Lines 6, 7, 9, and 10 are doing the same functions as Lines 3 and 4. Just some values are different. Rest semantics are the same.

So this is what ChucK really does with that code.

And this was your very first ChucK program. We will post more tutorials about ChucK teaching you how in ChucK you can create beautiful compositions and enjoy music creation while coding.

Have a great time!

aa ley ChucK, mai aa gaya!!!

Content Protection by DMCA.com
Music, Music creation, Tutorials Tags:audio programming language, ChucK, music programming language, programming language for music, programming language for music creation, sound programming, sounds in programming language

Post navigation

Previous Post: WonderFold W2 Or W4 LUXE Comparison
Next Post: 20 popular Types of web Hosting platforms explained in detail

Related Posts

  • Introduction to Git Version Control
    Introduction to Git Version Control Developer Guide
  • BASICS OF PHOTOSHOP 5
    BASICS OF PHOTOSHOP Tutorials
  • How to add 3D option in Adobe Photoshop CS6?
    How to add 3D option in Adobe Photoshop CS6? Tutorials
  • Match Score With Spring data elastic search in Spring Boot for a Query Banner
    Get Match Score With Spring data elastic search in Spring Boot for a Query Developer Guide
  • Using apt tool infographics Linux basic tool series part 1 Banner
    Using apt tool infographics Linux basic tool series part 1 Developer Guide
  • Install Ubuntu in Windows 10
    How to Install Ubuntu in Windows 10 Tutorials

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Advertisements

Subscribe to updates

Enter your email below to subscribe





Posts by Categories

Advertisements
  • Merging Multiple PDF files online
    7 Online PDF Tools That Help You Merge Files Web Guide
  • The Skills and Equipment you’ll need to be a Kickass Developer Tekraze
    The Skills and Equipment you’ll need to be a Kickass Developer Guest posts
  • Laptop Showing Web application Development
    18 new Web Application Development Trends in 2023 Tech News
  • Cartoonize yourself with Colorcinch online photo editor app
    How to cartoonize yourself with Colorcinch Online Photo Editor App Web Guide
  • The Qualities of a Great Mobile app
    The Qualities of a Great Mobile App Developer Guide
  • Best Back End Web Development Tools For Web Developers Tekraze
    Best Back End Web Development Tools For Web Developers Guest posts
  • upgrade windows 7 tekraze
    What to Do about Your Windows 7 PC As Microsoft is Ending Support Guest posts
  • Speed up Windows using USB Drive as virtual memory with Readyboost
    Speed up Windows using a USB drive as virtual memory like a magic PC Guide

Affliate Links

Sell with Payhip

Earn with Magenet

Sell and Buy with Adsy

GainRock affiliate Program

Automatic Backlinks

Advertise with Anonymous Ads

accessily tekraze verificationIndian Blog Directory

Copyright © 2023 Tekraze.

Powered by PressBook News WordPress theme