OpenCores
URL https://opencores.org/ocsvn/s6soc/s6soc/trunk

Subversion Repositories s6soc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /s6soc
    from Rev 37 to Rev 38
    Reverse comparison

Rev 37 → Rev 38

/trunk/sw/host/buildsamples.cpp
4,8 → 4,23
//
// Project: CMod S6 System on a Chip, ZipCPU demonstration project
//
// Purpose:
// Purpose: This program converts an 8kHz, 16t, mono- sound data file into
// samples that can be read and understood by the C compiler and
// hence included in a S6SoC project as the ``doorbell'' audio sound.
//
// To use this, first convert your sound file to 8kHz, 16t, raw mono
// format. The sox utility works well for this purpose.
//
// Then, run this program wih the single argument being the name of that
// sound file. The standard output will be the resulting C-code
// representing/recreating that sound file. Pipe this into a file for
// inclusion in your program. You can then reference both the number of
// samples from that file, as well as the number of words those samples
// are stored in, as well as what those samples are.
//
// The samples themselves can then be placed in a flash partition, and
// read like any memory from within your program.
//
// Creator: Dan Gisselquist, Ph.D.
// Gisselquist Technology, LLC
//
49,6 → 64,19
short sbuf[SLEN];
int nread = 0, nr;
 
if (argc != 1) {
fprintf(stderr,
"Usage:\tbuildsamples samplefile\n"
"\n"
"\twhere 'samplefile' is a sound data file consisting of 16-bit samples\n"
"\tthat have been sampled at 8kHz. The sample file should have no\n"
"\theader, and should only reference a mono (not stereo) output.\n"
"\n"
"\tThe result is a C program fragment that can be redirected to a file for\n"
"\tlater inclusion in your project.\n");
exit(EXIT_SUCCESS);
}
 
fp = fopen(argv[1], "rb");
if (!fp) {
fprintf(stderr, "Could not open %s for reading\n", argv[1]);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.