reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
prompt2wav.cxx
Go to the documentation of this file.
1
2#include <iostream>
3#include <fstream>
4
5#include "media/samples/playback_prompt.h"
6#include "media/samples/record_prompt.h"
7
8using namespace std;
9
10void write_out(const unsigned char* data, size_t count, const char *filename)
11{
12 ofstream o;
13 o.open(filename);
14 o.write((const char *)data, count);
15 o.close();
16}
17
18int main(int argc, char* argv[])
19{
20 // 1 channel, 8kHz 16bit PCM
21 //
22 // To play it back:
23 //
24 // aplay -c 1 -f S16_LE -r 8000 /tmp/playback_prompt.raw
25 //
26 // To convert from raw to WAV:
27 //
28 // sox -r 8k -e signed -b 16 -c 1 /tmp/playback_prompt.raw /tmp/playback_prompt.wav
29
30 write_out(playback_prompt, sizeof(playback_prompt), "/tmp/playback_prompt.raw");
31 write_out(record_prompt, sizeof(record_prompt), "/tmp/record_prompt.raw");
32
33 return 0;
34}
35
36/* ====================================================================
37 *
38 * Copyright (c) 2022, Software Freedom Institute https://softwarefreedom.institute
39 * Copyright (c) 2022, Daniel Pocock https://danielpocock.com
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
43 * are met:
44 *
45 * 1. Redistributions of source code must retain the above copyright
46 * notice, this list of conditions and the following disclaimer.
47 *
48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in
50 * the documentation and/or other materials provided with the
51 * distribution.
52 *
53 * 3. Neither the name of the author(s) nor the names of any contributors
54 * may be used to endorse or promote products derived from this software
55 * without specific prior written permission.
56 *
57 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
58 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
60 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
61 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
62 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
63 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
64 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
65 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
66 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
67 * SUCH DAMAGE.
68 *
69 * ====================================================================
70 *
71 *
72 */
73
unsigned char playback_prompt[23978]
int main(int argc, char *argv[])
void write_out(const unsigned char *data, size_t count, const char *filename)
unsigned char record_prompt[43940]