~ubuntu-branches/ubuntu/maverick/speech-tools/maverick

« back to all changes in this revision

Viewing changes to wrappers/interface/EST_Wave.i

  • Committer: Bazaar Package Importer
  • Author(s): Kumar Appaiah, Kartik Mistry, Kumar Appaiah
  • Date: 2010-07-17 11:32:04 UTC
  • mfrom: (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100717113204-mnse3jo236j107q8
Tags: 1:2.0.95~beta-1
[ Kartik Mistry ]
* debian/control:
  + [Lintian] Added missing ${misc:Depends}
  + Updated Standards-Version to 3.8.4 (no changes needed)
* debian/patches/const_char.diff:
  + Added missing patch header
* Removed unused patch invalid_const_char_conversion_fixes.diff

[ Kumar Appaiah ]
* New upstream release.
* Standards Version is now 3.9.0 (No changes needed)
* Update debian/rules to specify version numbers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*************************************************************************/
 
2
/*                                                                       */
 
3
/*                Centre for Speech Technology Research                  */
 
4
/*                 (University of Edinburgh, UK) and                     */
 
5
/*                           Korin Richmond                              */
 
6
/*                         Copyright (c) 2003                            */
 
7
/*                         All Rights Reserved.                          */
 
8
/*                                                                       */
 
9
/*  Permission is hereby granted, free of charge, to use and distribute  */
 
10
/*  this software and its documentation without restriction, including   */
 
11
/*  without limitation the rights to use, copy, modify, merge, publish,  */
 
12
/*  distribute, sublicense, and/or sell copies of this work, and to      */
 
13
/*  permit persons to whom this work is furnished to do so, subject to   */
 
14
/*  the following conditions:                                            */
 
15
/*                                                                       */
 
16
/*   1. The code must retain the above copyright notice, this list of    */
 
17
/*      conditions and the following disclaimer.                         */
 
18
/*   2. Any modifications must be clearly marked as such.                */
 
19
/*   3. Original authors' names are not deleted.                         */
 
20
/*   4. The authors' names are not used to endorse or promote products   */
 
21
/*      derived from this software without specific prior written        */
 
22
/*      permission.                                                      */
 
23
/*                                                                       */
 
24
/*  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK        */
 
25
/*  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      */
 
26
/*  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT   */
 
27
/*  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE     */
 
28
/*  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    */
 
29
/*  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   */
 
30
/*  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          */
 
31
/*  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       */
 
32
/*  THIS SOFTWARE.                                                       */
 
33
/*                                                                       */
 
34
/*************************************************************************/
 
35
/*             Author :  Korin Richmond                                  */
 
36
/*               Date :  02 June 2003                                    */
 
37
/* -------------------------------------------------------------------   */
 
38
/*   EST_Wave Class interface file                                       */
 
39
/*                                                                       */
 
40
/*************************************************************************/
 
41
 
 
42
%module EST_Wave
 
43
 
 
44
%{
 
45
#include "EST_Wave.h"
 
46
#include "EST_wave_aux.h"
 
47
#include "EST_audio.h"
 
48
#include "EST_Option.h"
 
49
%}
 
50
 
 
51
%include "EST_rw_status.i"
 
52
%include "EST_typemaps.i"
 
53
 
 
54
class EST_Wave
 
55
{
 
56
protected:
 
57
  EST_SMatrix p_values;
 
58
 
 
59
  int p_sample_rate;
 
60
 
 
61
  void default_vals(int n=0, int c=1);
 
62
  void free_wave();
 
63
  void copy_data(const EST_Wave &w);
 
64
  void copy_setup(const EST_Wave &w);
 
65
 
 
66
public:
 
67
 
 
68
  // these are static in the EST_Wave class, but there's some
 
69
  // problem with segmentation fault...
 
70
  const int default_sample_rate;
 
71
  //const int default_num_channels;
 
72
 
 
73
  EST_Wave();
 
74
  EST_Wave(const EST_Wave &a);
 
75
  EST_Wave(int n, int c, int sr);
 
76
  ~EST_Wave();
 
77
    
 
78
  short a(int i, int channel = 0) const;
 
79
  short &a_safe(int i, int channel = 0);
 
80
 
 
81
  // set value
 
82
  short set_a(int i, int channel = 0, short val = 0);
 
83
 
 
84
  // return the time position in seconds of the ith sample
 
85
  float t(int i) const;
 
86
 
 
87
  int num_samples() const;
 
88
  int num_channels() const;
 
89
  int sample_rate() const;
 
90
  void set_sample_rate(const int n);
 
91
  int length() const;
 
92
 
 
93
  // return the time position of the last sample.
 
94
  float end();
 
95
 
 
96
  // Can we look N samples to the left?
 
97
  bool have_left_context(unsigned int n) const;
 
98
 
 
99
  EST_String sample_type() const;
 
100
  void set_sample_type(const EST_String t);
 
101
 
 
102
  EST_String file_type() const;
 
103
  void set_file_type(const EST_String t);
 
104
 
 
105
  EST_String name() const;
 
106
  void set_name(const EST_String n);
 
107
 
 
108
  void resize(int num_samples, int num_channels = EST_ALL, int set=1);
 
109
  void resample(int rate);
 
110
 
 
111
  // multiply all samples by factor "gain".
 
112
  void rescale( float gain,int normalize=0 );
 
113
  void rescale( const EST_Track &factor_contour );
 
114
 
 
115
  // clear waveform and set size to 0.
 
116
  void clear();
 
117
 
 
118
  void copy(const EST_Wave &from);
 
119
  void fill(short v=0, int channel=EST_ALL);
 
120
 
 
121
  void empty(int channel=EST_ALL);
 
122
 
 
123
  EST_read_status load(const EST_String filename, 
 
124
                       int offset=0, 
 
125
                       int length = 0,
 
126
                       int rate = default_sample_rate);
 
127
 
 
128
  EST_read_status load_file(const EST_String filename, 
 
129
                            const EST_String filetype, int sample_rate, 
 
130
                            const EST_String sample_type, int bo, int nc,
 
131
                            int offset = 0, int length = 0);
 
132
 
 
133
  EST_write_status save(const  EST_String filename, 
 
134
                        const EST_String EST_filetype = "");
 
135
 
 
136
  EST_write_status save_file(const EST_String filename, 
 
137
                             EST_String filetype,
 
138
                             EST_String sample_type, int bo);
 
139
 
 
140
  void integrity() const;
 
141
 
 
142
  %extend {
 
143
    void info()
 
144
      {
 
145
        wave_info( *self );
 
146
      }
 
147
  }  
 
148
  
 
149
  %extend {
 
150
    void play()
 
151
      {
 
152
        EST_Option empty;
 
153
        play_wave( *self, empty );
 
154
      }
 
155
  }
 
156
};
 
157
 
 
158
 
 
159
int wave_extract_channel(EST_Wave &single, const EST_Wave &multi, int channel);
 
160
 
 
161
void wave_combine_channels(EST_Wave &combined, const EST_Wave &multi);
 
162
 
 
163
int wave_subwave(EST_Wave &subsig,EST_Wave &sig,int offset,int length);
 
164
 
 
165
int wave_divide(EST_WaveList &wl, EST_Wave &sig, EST_Relation &keylab,
 
166
                const EST_String &ext);
 
167
 
 
168
int wave_extract(EST_Wave &part, EST_Wave &sig, EST_Relation &keylab, 
 
169
                 const EST_String &file);
 
170
 
 
171
void add_waves(EST_Wave &s, const EST_Wave &m);
 
172
 
 
173
EST_Wave difference(EST_Wave &a, EST_Wave &b);
 
174
float rms_error(EST_Wave &a, EST_Wave &b, int channel);
 
175
float abs_error(EST_Wave &a, EST_Wave &b, int channel);
 
176
float correlation(EST_Wave &a, EST_Wave &b, int channel);
 
177
 
 
178
EST_FVector rms_error(EST_Wave &a, EST_Wave &b);
 
179
EST_FVector abs_error(EST_Wave &a, EST_Wave &b);
 
180
EST_FVector correlation(EST_Wave &a, EST_Wave &b);
 
181
 
 
182
EST_Wave error(EST_Wave &ref, EST_Wave &test, int relax);
 
183
 
 
184
void absolute(EST_Wave &a);
 
185
 
 
186
void wave_info(EST_Wave &w);
 
187
void invert(EST_Wave &sig);
 
188
 
 
189
void differentiate(EST_Wave &sig);
 
190
void reverse(EST_Wave &sig);