Skip to content

Commit b6c02cf

Browse files
author
Rayerdyne
committed
Update README.md s
1 parent b8558f3 commit b6c02cf

File tree

3 files changed

+131
-17
lines changed

3 files changed

+131
-17
lines changed

README.md

+44-17
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,81 @@
11
# Project
22
## INFO0062 - Object-Oriented Programming
33

4+
This project is the extention of the programming project I had to make as part of the Object-Oriented Programming course, during the academic year 2019-2020.
45

5-
Directory containing required classes for the project and the bonus:
66

7-
`./src` (Demo.java)
8-
9-
`./src/be/uliege/straet/oop/filters`
7+
Directories containing classes:
108

11-
Additional stuff:
9+
`./src` (Demo.java)
1210

13-
`./src/be/uliege/straet/oop/additionalfilters`
11+
`./src/be/uliege/straet/oop/filters`
1412

1513
`./src/be/uliege/straet/oop/loader`
1614

15+
`./src/be/uliege/straet/oop/gui`
16+
1717
--------------------
1818
## Project structure
1919

2020
I organized my code in three packages, prefixed by `be.uliege.straet.oop`:
2121
- `filters`
22-
- `additionalfilters`
2322
- `loader`
23+
- `gui`
24+
25+
`filters` contains what is related to filters (O-:).
2426

25-
The first one contains what is related to filters (O-:), the two other are described here after. The example program implementing the echo filter is `./src/ApplyEcho.java`
27+
`loader` contains the stuff to read-write a `CompositeFilter` in a xml-like file.
28+
29+
`gui` contains the classes related to the graphical user interface.
2630

2731
Also, here is for convenience ready to copy-paste commands to compile each of the package, and the `src` directory content (... ok that one is not that useful):
2832

2933
```
3034
javac -d bin -cp audio.jar src/be/uliege/straet/oop/filters/*.java
31-
javac -d bin -cp audio.jar:bin src/be/uliege/straet/oop/additionalfilters/*.java
3235
javac -d bin -cp audio.jar:bin src/be/uliege/straet/oop/loader/*.java
36+
javac -d bin -cp audio.jar:bin src/be/uliege/straet/oop/gui/*.java
3337
javac -d bin -cp audio.jar:bin src/*.java
3438
```
3539

36-
As you can see, the first package has to be built first. The `loader` package also requires the `additionalfilters` package to be built.
40+
As you can see, the first package has to be built first. The `loader` package also requires the `filters` package to be built, and the `gui` package needs both.
3741

3842
----------------------
39-
### Additionnal basic blocks
40-
The course *SYST-0002 - Signaux et systèmes* greatly motivated me to implement simple versions of an integrator block (`IntegratorFilter`) a differentiator (surprisingly, `DifferentiatorFilter`) and a `ConvolutionFilter`. The integration is done by the trapeze method, and differentiation by the simplest form (dividing the difference between to consecutive element by the step.)
43+
# `filter` package
44+
45+
This package contains following classes: `AdditionFilter`, `AllPassFilter`, `CompositeFilter`, `ConvolutionFilter`, `DelayFilter`, `DifferentiatorFilter`, `FeedbackableFilter`, `GainFilter`, `IntegratorFilter`, `ReverberatorFilter`, `WFilter`, `Generator`, `NoiseGenerator`, `SineGenerator`, `SquareCenteredGenerator`, `SquareUpGenerator`, `Block`, `BlockException`, `ReadDouble`, `WriteDouble`
46+
47+
This set of classes is responsible for the numerical computation of the filtered output. The `WFilter` interface ("Writeable Filter") describes any type of filter, i.e. any class that implements it is a filter.
4148

42-
I also made some sound generators (`SineGenerator`, `SquareUpGenerator`, `SquareCenteredGenerator` and `NoiseGenerator`) that implements the abstract class `Generator`.
49+
All filters are post-fixed by `Filter` (...). Of course, the `CompositeFilter` class here, that will be built on other filters, is particularly interesting...
50+
51+
The `Generator` abstract class defines a specific kind of filter, a filter that takes no inputs but outputs some function of time. Its sub-classes will be post-fixed by `Generator` (...).
4352

4453
----------------------
45-
### File loading feature
54+
# `loader` package
55+
56+
This package contains following classes: `LoaderException`, `Loader`, `NodeData`, `ValueMapper`, `WriterException`, `Writer`
4657

47-
I also added a class (`Loader`) that is designed to read a file and build a `CompositeFilter` based on it, then apply it to the input.
58+
This set of class is responsible for the reading and writing of any given `CompositeFilter` to a parsable xml file.
4859

49-
As this is of course not part of the project, the only reason why I putted this is *why not ?*.
60+
Static method `Loader.load(String fileName, HashMap<String, Double> parameters, boolean verbose)` is used to load the file at `fileName`, given a eventual parameter set, verbosely or not. It will return the `CompositeFilter` represented in that file.
61+
62+
Static method `Writer.writeFilter(CompositeFilter cf, String fileName)` is used to write the `CompositeFilter` to the file at `fileName`.
63+
64+
----------------------
65+
# `gui` package
66+
67+
This package contains following classes: `AudioSequence2`, `ComputationException`, `Computer`, `Coord`, `DAdditionFilter`, `DCompositeFilter`, `DConvolutionFilter`, `DDelayFilter`, `DGainFilter`, `DInputFilter`, `DOutputFilter`, `DraggableFilter`, `Draggable`, `DVariableDeclaration`, `FixedBall`, `FMenuBar`, `FreeBall`, `Locatable`, `NothingFilter`, `Procedure`, `RetardatorFocusGiver`, `Updater`, `WindowException`, `Window`, `Wire`, `WorkSpace`, `WorkSpaceXML`
68+
69+
This set of class is responsible for the graphical user interface (GUI) of the program, and for the reading and writing of the positions of the filters in files in order to be able to re-open edited filters later.
70+
71+
The coordination is made by the `WorkSpace` class, that extends `JPanel` (and implements `KeyListener`) so that it could be integrated in some other applications (if you want so).
72+
73+
The full description of the GUI and its abilities can be found in [the GUI tutorial](/src/be/uliege/straet/oop/gui/README.md).
74+
75+
--------------------
76+
## "Unrelated" stuff
5077

51-
Files follows a xml-like convention, and should match a specific pattern. More specific details and examples are availible in sub-folder `./src/be/uliege/straet/oop/loader`.
78+
Eeeeeh, actually, for [another program](https://github.com/Rayerdyne/FG), I were interested in drawing some arbitrary shapes, but I needed to provide all of its edges, what was exhausting to do by hand. So I just re-used what I did here to do this much more conveniently. The class corresponding to this little "hack" all have some explicit name about this...
5279

5380
François Straet
5481

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# GUI
2+
3+
Here is a not exhaustive (idk, I'm not sure it will be but I'll try) manual of my program - its GUI.
4+
5+
<p align="center">
6+
<img src="Screenshot_uptodate.png" />
7+
</p>
8+
9+
### The workspace
10+
This is the zone in white. This zone will contain the actual filter representation, that is, symbols representing other filters and connections between them.
11+
12+
### The tool bar
13+
This is the light gray zone, just above the workspace. There you will find buttons to add some filter to the workspace.
14+
15+
### The menu bar
16+
This is the uppermost zone of the window, with four menus: **File**, **View**, **Run**, and **Add**. There you will find all the utilities in order to manipulate the workspace and to use the represented filter.
17+
18+
## 1- Manipulating filters
19+
| Action | How to |
20+
|--------|--------|
21+
| Add filter | Click the corresponding button in the tool bar, or the corresponding menu item in **Add** menu. Click on the workspace to place it |
22+
| Drag filter | Click the filter, hold the button down when dragging, then release it when placed |
23+
| Rotate filter | Press '`r`' key when dragging the filter |
24+
| Delete filter | Press '`d`' key when dragging the filter |
25+
| Edit filter | Press '`e`' key when dragging the filter. Note that editing the filter properties depends on the filter's type |
26+
| Connect filters | Click the `Connection` button in the tool bar, or press '`space`' to begin the drawing of a connection |
27+
28+
## 2- Connecting filters
29+
Of course, to construct the filter, you will need to connect the sub-filters between them. To do so, click the `Connection` button in the tool bar, or simply press '`space`' to begin the drawing of a new connection.
30+
31+
Then, all the inputs/outputs that are ok to be connected will be filled. Note that, which respect to the filters, an input is green and an output is blue. You can select any availible input/output by clicking it.
32+
33+
When the first end of the wire is set, you can either directly connect it to another input/output (but of the other type, as connecting two inputs is impossible), or click in "the void" in the workspace. This will add a "checkpoint" in the wire. You can add as many checkpoints as you want.
34+
35+
The drawing of the connection is finished once you have selected the second end of the wire.
36+
37+
When the wire is drawn, you can still move the checkpoints by dragging them, as for the filters.
38+
39+
To delete a wire, you have press '`d`' key when dragging one of its checkpoints. This means it's impossible to delete a wire that have no checkpoint without deleting an adjacent filter.
40+
41+
## 3- Special filters
42+
43+
- Input/output filters
44+
45+
These filter represents an input or an output of the filter. This can be a *wav* or a *csv* file. (in *csv* files, the k-th value is the value of the k/2 sample, in left channel if k is even, right channel otherwise).
46+
47+
When editing them, you will have to select a file (it should exist if you select an input).
48+
49+
- Parameters declaration
50+
51+
These are not filters, but declaration of some variables. When editing a declaration, you will have to set the parameter's name (e.g. `frequency`) and it's definition (e.g. `440`).
52+
53+
The parameter's definition, as well as all filter's parameters that are numerical values, should be valid. It is able to parse simple combination of sums and products, that is, for example, `3 * 6 + 8` is correct, but not `3 * 6 - 7`, what can be replaced by `3 * 6 + -7`, as we can parse negative values =). We can also include parameters in the definitions: `2 * frequency + 2`, one single definition may contain more than one parameter.
54+
55+
- Convolution filter
56+
57+
As the convolution require a vector as variable, you'll have to specify it when editing (...). To do so, when editing such a filter, you will have to enter all the values, separated by a '`,`'.
58+
59+
Also, as this vector might be quite large, it is also possible to specify a *csv* file that contains this vector. This is done by answering "Yes" when it asks after pressing '`e`' for editing.
60+
61+
[More on convolutions](https://en.wikipedia.org/wiki/Convolution), [[Fr]](https://fr.wikipedia.org/wiki/Produit_de_convolution)
62+
63+
- Composite filter
64+
65+
This filter import another filter that has **one** input and **one** output in the filter. Thus, editing requires you to select another xml file that represents a valid filter.
66+
67+
The limitation to filters with one input and one input is only because I didn't implemented mechaninsm to handle this, I plan to do this for future versions.
68+
69+
## 4- Actions
70+
I.e. all the action you can perform on the workspace.
71+
72+
| Action | Menu | What it does |
73+
|--------|--------|--------------|
74+
| Save | File | Save current workspace, save as if not saved before. |
75+
Save as | File | Save the current workspace in a new xml file. |
76+
| Open | File | Open an existing filter in the workspace. The xml file should be valid and specifiy filters positions. |
77+
| Export standalone filter | File | Export the filter currently represented by the workspace as a standalone filter. I.e., the composite filters in it are included and there is no need to re-read the file describing them. |
78+
| Quit | File | Quit the program. Shortcut: `Ctrl`+`Q`. |
79+
| Zoom in | View | Zooms in in the workspace. |
80+
| Zoom out | View | Zooms out in the workspace. |
81+
| Play result | Run | If the filter in the workspace has only one output, build the filter and play that single output. If it already has been lauched and paused, resume. |
82+
| Pause | Run | Pauses the playing of the computed output. |
83+
| End | Run | Ends the playing of the computed output. |
84+
| Build filter | Run | Constructs the composite filter represented by the workspace. It will thus detect if something goes wrong. |
85+
| Build output file | Run | Apply the composite filter to its specified inputs and outputs (with input and output filters). |
86+
| Apply to voice | Run | If the filter has one input and one output, get a sample of sound from the microphone and apply the represented filter to that sample. |
87+
| smurf filter | Add | Starts the placing (creates and drag until mouse click) of a smurf filter. |
16.3 KB
Loading

0 commit comments

Comments
 (0)