~ubuntu-branches/ubuntu/jaunty/gramofile/jaunty

1 by Daniel Kobras
Import upstream version 1.6
1
Things that could/should be done (random order) - but not by me: I've got
2
other things to do at the moment :(
3
4
 - Find and correct all bugs
5
 - Better error handling (malloc, file ops)
6
 - Support (user interface) for cdrecord, cdda2wav/cdparanoia
7
 - More / better filters  - pops/ticks/scratches
8
                          - hiss, broadband noise
9
                          - fade in/out at track start/end (see below)
10
                          - volume normalizing to put tracks from
11
                             various sources on one CD
12
                          - dynamic-range decompression (Keith Refson's idea)
13
 - Possibility for application of frequency domain filters (probably
14
    difficult to do in streaming processing)
15
 - Remember filter/track location settings within a single invocation
16
    (Also see patch from James Tappin on the webpage)
17
 - Make .wav reading/writing 64-bit clean (i.e. don't depend on sizeof's)
18
    (temporary workaround: change every `long' into `int', see README)
19
 - Compute average/maximal signal volume/power for info-screen after
20
    recording (sum of 1G shorts in a float) (see bplaysrc/shmbuf.c,
21
    shmrec())
22
 - Show number of nearly-clipped samples also _during_ recording, for
23
    easier adjustments of sound source (idea of Juergen Lock)
24
 - Copying, moving, deleting files; creating, deleting dirs from
25
    within user interface (?)
26
 - Automatic detection which of xmixer, xmix, aumix, ???mix to use
27
    (e.g. $DISPLAY ? or $MIXER ?)
28
 - Auto screensize (not always 80x24)
29
 - X user interface
30
 - Manpage
31
 - Support for non-CD-quality and non-.wav sound files;
32
    (for mono files, also see patch from James Tappin on the webpage)
33
 - Command line options (or via a options file)
34
 - Porting to other *UXes, Windows? First only Signproc/Tracksplit
35
    (IRIX and possibly others should work already. If you try, please mail
36
    me your experiences)
37
 - For webpage: example .wavs, example graph files (track location),
38
    screenshots of (un)processed .wavs
39
40
41
Fade in/out:
42
43
Paul Martin <pm@nowster.zetnet.co.uk> sent me the following:
44
45
-----quote-----
46
[...]
47
Here's a fragment of code that does a mono fade out. It's very
48
sub-optimal, but it does work. It implements a (1-x^2) fade (x = 0 -> 1). 
49
By changing the exponent you can change the type of fade from linear (x^1)
50
to highly logarithmic.
51
[...]
52
53
#include <math.h>
54
#include <stdlib.h>
55
#include <stdio.h>
56
#include <sys/types.h>
57
#include <sys/stat.h>
58
#include <fcntl.h>
59
#include <unistd.h>
60
61
const char inname[]="input.sw";
62
const char outname[]="output.sw";
63
64
signed short buff[441000];
65
66
main () {
67
 double frac,scaler;
68
 long i,size,max;
69
 int inp,oup;
70
 signed short tmp;
71
 
72
 if ((inp=open(inname,O_RDONLY))==-1) {
73
  perror("open('input.sw')");
74
  exit(1);
75
 }
76
 size = read(inp, buff, sizeof(buff));
77
 close(inp);
78
 max = (size/2);
79
80
 for (i=0; i<max; i++) {
81
  frac=(double) i / (double) max;
82
  scaler = 1.0 - (frac)*(frac); /* this is the important bit */
83
/* scaler = 1.0 - (1.0-frac)*(1.0-frac); /* fade in */
84
85
  tmp = (signed short) ( ( (double) buff[i]) * scaler);
86
/*  printf("%d %f %d %d\n", i, scaler, buff[i], tmp ); */
87
  buff[i]=tmp;
88
 }
89
90
 oup=creat(outname,0644);
91
 write(oup,buff,size);
92
 close(oup);
93
}
94
-----end of quote-----
95
96
Idea seems to be useable. Exponent may be settable in a Parameters screen
97
(then scaler=pow(frac,log_factor)), as well as the length of fade in and
98
fade out (in samples, or e.g. 1/100 sec?). But for correct implementation,
99
a current_sample_position has to be added to param_t, that is updated
100
every sample (in advance_current_pos() ?). Otherwise, the pre-reading of
101
the buffers will make it go all wrong (note that the fade in/out must be
102
placeable anywhere in the processing chain). Also, track_start/end
103
(samples or bytes) or tracktimes[] must be global vars. 
104
105