⭐️ Star this repository! It really motivates me to make better explanations and produce more work!! ⭐️
This repository contains C programs for different tasks:
- Volume Adjustment
volume.c
: Adjusts the volume of audio samples in a file.
- Image Filtering
filter.c
: Applies various filters to BMP images.helpers.c
andhelpers.c
: Contains implementations of image filters.helpers.h
: Header file for helper functions.
The volume.c
program adjusts the volume of audio samples in a file by scaling their amplitude. This tool is useful for modifying the loudness of audio recordings.
Purpose
The volume.c
program processes an audio file to increase or decrease its volume by applying a scaling factor to each audio sample.
How it Works
- File Handling: Opens and reads the input audio file, expected to be in a specific format (e.g., WAV).
- Volume Adjustment: Applies a volume adjustment factor to each audio sample. This factor acts as a multiplier to modify the amplitude of the audio signal.
- Output: Writes the adjusted audio data to a new output file.
Key Points
- Volume Scaling: Uses a multiplier to adjust audio sample amplitude.
- File Operations: Handles reading and writing audio data, ensuring format correctness.
Example
To compile and run the program, use the following commands:
make volume
./volume input.wav output.wav 0.5
This project involves implementing image filtering techniques for BMP files. The goal is to apply different filters to images, including grayscale, sepia, reflection, and blur.
Purpose
The filter.c
program applies filters to BMP images based on user input. It reads an image file, processes it according to the chosen filter, and writes the modified image to a new file.
How it Works
- Command-line Arguments: Specifies the filter to apply (-b for blur, -g for grayscale, -r for reflection, -s for sepia) and the input and output file paths.
- File Handling: Opens the input BMP file, verifies that it is a BMP file, and reads the image data into a 2D array.
- Filter Application: Calls the appropriate function from
helpers1.c
orhelpers2.c
. - Output: Writes the processed image to the output file.
Key Points
- Command-line Interface: Provides flexibility to apply different filters.
- File Operations: Ensures correct handling of BMP file format and metadata.
Purpose
The helpers1.c
file contains implementations of specific image filters.
Functions
- Grayscale: Converts an image to grayscale by averaging the red, green, and blue values of each pixel.
- Sepia: Applies a sepia tone to an image by adjusting the red, green, and blue values to give a vintage effect.
- Reflection: Reflects the image horizontally, creating a mirror image of the original.
Key Points
- Image Manipulation: Implements basic image processing techniques.
- Filter Functions: Modular approach to applying different filters.
Purpose
The helpers2.c
file contains implementations of additional image filters.
Functions
- Blur: Applies a box blur to the image by averaging the pixel values in a defined box around each pixel.
- Additional Filters: Includes extra filtering methods not present in
helpers1.c
.
Key Points
- Advanced Filtering: Handles more complex image manipulation.
- Modularity: Separates different filtering methods into different files.
Purpose
The helpers.h
header file provides function prototypes for the helper functions defined in helpers.c
and helpers.c
.
Key Points
- Function Prototypes: Declares the functions used for filtering images.
- Consistency: Ensures that the function signatures are consistent across different files.
This project was inspired by and developed as part of the CS50x course offered by Harvard University. CS50x is an introduction to the intellectual enterprises of computer science and the art of programming.
Thank you to the CS50x team for providing such a comprehensive and engaging introduction to computer science. |