Question

In: Computer Science

The fidelity of an audio clip is defined by a number of parameters, including the number...

The fidelity of an audio clip is defined by a number of parameters, including the number of channels (1 or 2), the resolution (8, 16 or 24 bits per sample), and the sampling rate (22050, 44100, or 88200 samples per second).

(a) Write a definition for an audioClip class that contains:

  1. [02 points] fields for storing the channels, resolution and sampleRate with appropriate visibility;
  2. [03 points] setter and getter methods for manipulating these fields, such that the setters methods ensure that channels can only have values 1 or 2, resolution can only have values 8, 16 or 24, and sampleRate can only have values 22050, 44100 or 88200;
  3. [03 points] a constructor that initializes new objects to have the lowest quality, where channels is set to 1, resolution is set to 8, and sampleRate is set to 22050.

(b) [04 points] Write a new method called isStudioQuality that will return true or false, depending upon whether the audio clip stored has the maximum possible quality (i.e., two channels, 24-bit resolution, and a sample rate of 88200 samples per second).

(c) [03 points] Write a new method called dataSize that accepts the duration that an audio clip lasts in seconds (as an integer), and returns the number of bytes that this audio clip would occupy on disk or in memory. The formula for calculating number of bytes, ?, where is ? duration (in seconds), ? is channels, ? is resolution (in bits), and ? is sample rate, is: ? = ? × ? × (?/ 8) × ?

C#

Solutions

Expert Solution

(a).

class audioClip

{

private: int channels;

int resolution;

int sampleRate;

public: audioClip()

{

channels = 1;

resolution = 8;

sampleRate = 22050;

}

int getChannels()

{

return channels;

}

bool setChannels(int newChannels)

{

if(newChannels==1 || newChannels==2)

{

channels = newChannels;

return true;

}

return false;

}

int getResolution()

{

return resolution;

}

bool setResolution(int newResolution)

{

if(newResolution==8 || newResolution==16 || newResolution==24)

{

resolution = newResolution;

return true;

}

return false;

}

int getSampleRate()

{

return sampleRate;

}

bool setSampleRate(int newSampleRate)

{

if(newSampleRate==22050 || newSampleRate==44100 || newSampleRate==88200)

{

resolution = newSampleRate;

return true;

}

return false;

}

};

(b)

public: bool isStudioQuality()

{

if(channels==2 && resolution==24 && sampleRate==88200)

return true;

return false;

}

(c)

public:

int dataSize(int duration)

{

return duration*channels*sampleRate*(resolution/8);

}


Related Solutions

Every Normal model is defined by its parameters, the mean and the standard deviation. For each...
Every Normal model is defined by its parameters, the mean and the standard deviation. For each model described here, find the missing parameter. As always, start by drawing a picture. μ=20, 45% above 30, σ= ? μ=88, 2% below 50, σ= ? σ=5, 80% below 100, μ=? σ=15.6, 10% above 17.2, μ=?
Which TCP/IP parameters must be defined for a host to be able to communicate with hosts...
Which TCP/IP parameters must be defined for a host to be able to communicate with hosts on a remote network? Hint: There are three. Please answer in 10m as IT'S URGENT!!! WILL DEFINITELY BE UPVOTED!
______ can be defined as maintaining critical parameters in the internal environment within tolerable ranges. Irritability...
______ can be defined as maintaining critical parameters in the internal environment within tolerable ranges. Irritability b. Evolution c. Homeostasis d. Metabolism e. Catabolism The _____ is a membrane-bound network that processes proteins and lipids. peroxisome endoplasmic reticulum chloroplasts ribosomes lysosomes Mitochondria are membrane-bound organelles in the cytoplasm in which: proteins are deaminated. proteins are synthesized. proteins are packaged for export. energy-rich molecules are broken down, using oxygen, to provide energy for cell activities. proteins are united with carbohydrates to...
QUESTION 1 Tick the option which correctly describes the units of parameters defined in an operation...
QUESTION 1 Tick the option which correctly describes the units of parameters defined in an operation sheet? a. Cutting Speed (ft/min), Spindle Speed (rev/min), Feed (in/rev), Depth of Cut(in) b. Cutting Speed (in/min), Spindle Speed (rev/sec), Feed (mm/rev), Depth of Cut(in) c. Cutting Speed (ft/min), Spindle Speed (rev/min), Feed (in/rev), Depth of Cut(mm) d. Cutting Speed (ft/sec), Spindle Speed (rev/min), Feed (mm/rev), Depth of Cut(mm) 10 points    QUESTION 2 What steps are necessary for Process Planning of a job...
Suppose the number of cars in a household has a binomial distribution with parameters n =...
Suppose the number of cars in a household has a binomial distribution with parameters n = 20, and p = 55 %. Find the probability of a household having (a) 10 or 13 cars (b) 11 or fewer cars (c) 16 or more cars (d) fewer than 13 cars (e) more than 11 cars
Suppose the number of children in a household has a binomial distribution with parameters n =...
Suppose the number of children in a household has a binomial distribution with parameters n = 16, and p = 80 %. Find the probability of a household having: (a) 6 or 15 children (b) 13 or fewer children (c) 10 or more children (d) fewer than 15 children (e) more than 13 children
- Design and implement a function with no input parameters. The function keeps receiving a number...
- Design and implement a function with no input parameters. The function keeps receiving a number from input (user) and adds the numbers together. The application keeps doing it until the user enter 0. Then the application will stop and print the total sum and average of the numbers the user had entered.
Suppose the number of radios in a household has a binomial distribution with parameters ?=21 and...
Suppose the number of radios in a household has a binomial distribution with parameters ?=21 and ?=35%. Find the probability of a household having: (a) 7 or 17 radios (b) 15 or fewer radios (c) 13 or more radios (d) fewer than 17 radios (e) more than 15 radios
Suppose the number of cars in a household has a binomial distribution with parameters n =...
Suppose the number of cars in a household has a binomial distribution with parameters n = 9, and p = 25 %. Find the probability of a household having: (a) 0 or 2 cars (b) 0 or fewer cars (c) 4 or more cars (d) fewer than 2 cars
Suppose the number of TV's in a household has a binomial distribution with parameters n =...
Suppose the number of TV's in a household has a binomial distribution with parameters n = 17, and p = 80 %. Find the probability of a household having: A. 12 or 14 TV's B. 12 or fewer TV's C. 15 or more TV's D. Fewer than 14 TV's C. more than 1 Tv's
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT