Giter Site home page Giter Site logo

ap-assignments's Introduction

AP Assignments

Here is my assignments for course Audio Programming. Now I'm working on AS3.

AS3 TODO:

  • Oscillator customization
  • ADSR customization
  • Harmonic series
  • Noise generator and percentage
  • LFO1
  • Layout enchancement
  • String "encoding" using harmonic
  • Preset saving

ap-assignments's People

Contributors

nestflow avatar

Watchers

 avatar

ap-assignments's Issues

First Issue!

Hello!

I've decided the best way to provide bespoke feedback is via GitHub's issues. this should

  • Allow a platform for further discussion
  • keep a record of discussion next to the project they are about
  • prepare you for further software development projects in the future.

As part of the first Issue I'd recommend having a read over GitHub's Markdown Guide. If you're proud of a project, show it off by right a nicely formatted and informative README. It is the first thing someone visiting your repository will see.

Check memory allocation before deletion

If you want to make this more robust

https://github.com/SpinEve/AP-Assignments/blob/26e6c20d2c2d181b57451f263c39fb0a7a82d15e/Assignment2/Source/DelayLine.h#L63

start off by always initialising the samples pointer to nullptr

e.g.
https://github.com/SpinEve/AP-Assignments/blob/26e6c20d2c2d181b57451f263c39fb0a7a82d15e/Assignment2/Source/DelayLine.h#L15

becomes

 float* samples = nullptr;  // Store delayed samples

Then try adding a test to see if samples has actually had any memory allocated to it.

~DelayLine() 
{
    if(samples)
        delete[] samples;
}

Or, better yet, use smart pointers (std::make_unique)

Separate .cpp / .h files

At this stage It would a wise idea to split your current .h files into separate .cpp / .h files.

If you add the files into your project with Projucer then you won't need to worry about configuring build phases.

Bulk Issue Testing

Testing GitHub API

This is an automatically generated issue using the GitHub API, feel free to close it.

If in the future I see a majority of repositories making the same mistake, I will likely use this rather than manually writing an issue in each repository

Documentation comments

You're missing out on some free help in the way you style your comments.

For class members have /// above the member rather than //. That way the comment will appear in the quick help / autocomplete.

Class Layout Styling

I'd recommend giving a little more breathing room in your styling. This isn't JavaScript so have everything very condensed and minimised doesn't add any benefit

Rather than

class Modulation {
 private:
  Oscillator* carrier;  // Carrier signal

 public:
  Modulation(float _sr, float _carrFreq) {
    carrier = new SinOsc(_sr, _carrFreq);
  }
  Modulation(Oscillator* _carrier) { carrier = _carrier; }
  float output() { return carrier->loop(); }
  // For phase modulation with shifted output
  float output(float shift) { return carrier->loopwithShift(shift); }
  virtual float loop(float signal) { return output(); }
  ~Modulation() { delete carrier; }
};

/**
 * Amplitude modulation
 * Output = carrier(t) * (1 + signal(t))
 */
class AM : public Modulation {
 public:
  AM(float _sr = 48000.f, float _carrFreq = 440.f)
      : Modulation(_sr, _carrFreq) {}
  AM(Oscillator* _carrier) : Modulation(_carrier) {}
  float loop(float signal) override { return output() * (1 + signal); }
};

/**
 * Phase modulation
 * Output = carrier(t + signal(t))
 */
class PM : public Modulation {
 public:
  PM(float _sr = 48000.f, float _carrFreq = 440.f)
      : Modulation(_sr, _carrFreq) {}
  PM(Oscillator* _carrier) : Modulation(_carrier) {}
  float loop(float signal) override { return output(signal); }
};

how about

class Modulation 
{

private:
  Oscillator* carrier;  // Carrier signal

public:
  
  Modulation(float _sr, float _carrFreq)
  {
    carrier = new SinOsc(_sr, _carrFreq);
  }
  
  Modulation(Oscillator* _carrier)
  {
    carrier = _carrier;
  }
  
  float output()
  {
    return carrier->loop();
  }
  // For phase modulation with shifted output
  
  float output(float shift)
  {
    return carrier->loopwithShift(shift);
  }
  
  virtual float loop(float signal)
  {
    return output();
  }
  
  ~Modulation()
  {
    delete carrier;
  }
};

/**
 * Amplitude modulation
 * Output = carrier(t) * (1 + signal(t))
 */
class AM : public Modulation
{
public:

  AM(float _sr = 48000.f, float _carrFreq = 440.f) : Modulation(_sr, _carrFreq) {}

  AM(Oscillator* _carrier) : Modulation(_carrier) {}

  float loop(float signal) override
  {
    return output() * (1 + signal);
  }
};

/**
 * Phase modulation
 * Output = carrier(t + signal(t))
 */
class PM : public Modulation
{
public:
  PM(float _sr = 48000.f, float _carrFreq = 440.f) : Modulation(_sr, _carrFreq) {}

  PM(Oscillator* _carrier) : Modulation(_carrier) {}

  float loop(float signal) override
  {
    return output(signal);
  }
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.