diff -Nru musescore-sftools-20180222/CMakeLists.txt musescore-sftools-20180325/CMakeLists.txt --- musescore-sftools-20180222/CMakeLists.txt 2018-03-05 00:25:10.000000000 +0000 +++ musescore-sftools-20180325/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -11,8 +11,9 @@ # the file LICENSE.GPL #============================================================================= -project(sfconvert) +project(sf3convert) CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) +include (GNUInstallDirs) include (${PROJECT_SOURCE_DIR}/build/FindQt5.cmake) include (${PROJECT_SOURCE_DIR}/build/UsePkgConfig1.cmake) # set(CMAKE_VERBOSE_MAKEFILE ON) @@ -20,18 +21,21 @@ set(QT_MIN_VERSION "5.6") set(QT_USE_QTXML TRUE) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + +# distributions might need to override these if (MINGW) - set(CMAKE_CXX_FLAGS "-g -std=c++0x") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") else (MINGW) - set(CMAKE_CXX_FLAGS "-g -std=c++0x -fPIC -fPIE") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fPIC -fPIE") endif (MINGW) -add_executable(sfconvert +add_executable(sf3convert sfconvert.cpp sfont.cpp xml.cpp ) if (MINGW) - target_link_libraries(sfconvert + target_link_libraries(sf3convert ${QT_LIBRARIES} vorbis ##vorbisfile @@ -39,7 +43,7 @@ sndfile-1 ) - install( TARGETS sfconvert RUNTIME DESTINATION . ) + install( TARGETS sf3convert RUNTIME DESTINATION . ) install_files ( . .dll ${CROSS}/bin/libgcc_s_dw2-1.dll @@ -101,11 +105,14 @@ ${VORBIS_INCDIR} ) - target_link_libraries(sfconvert + target_link_libraries(sf3convert ${QT_LIBRARIES} ${OGG_LIB} ${VORBIS_LIB} vorbisenc ${SNDFILE_LIB} ) + + install(TARGETS sf3convert RUNTIME DESTINATION bin) + install(FILES sf3convert.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc) endif (MINGW) diff -Nru musescore-sftools-20180222/debian/changelog musescore-sftools-20180325/debian/changelog --- musescore-sftools-20180222/debian/changelog 2018-03-15 00:22:48.000000000 +0000 +++ musescore-sftools-20180325/debian/changelog 2018-03-25 17:28:35.000000000 +0000 @@ -1,3 +1,11 @@ +musescore-sftools (20180325-1) unstable; urgency=high + + * Rename binary to sf3convert as requested by upstream + (the former package name existed short enough no transition is needed) + * New upstream snapshot, merges all patches + + -- Thorsten Glaser Sun, 25 Mar 2018 19:28:35 +0200 + musescore-sftools (20180222-2) unstable; urgency=low * Document likely renaming of the binary package upcoming diff -Nru musescore-sftools-20180222/debian/control musescore-sftools-20180325/debian/control --- musescore-sftools-20180222/debian/control 2018-03-15 00:18:17.000000000 +0000 +++ musescore-sftools-20180325/debian/control 2018-03-25 17:27:51.000000000 +0000 @@ -8,12 +8,12 @@ VCS-git: https://github.com/mirabilos/sftools VCS-Browser: https://github.com/mirabilos/sftools -Package: musescore-sfconvert +Package: sf3convert Architecture: any Multi-Arch: foreign Depends: ${misc:Depends}, ${shlibs:Depends} Description: MuseScore SoundFont converter - The musescore-sfconvert tool can be used to convert an SF2 SoundFont + The sf3convert tool can be used to convert an SF2 SoundFont into SF3 format, or into C code for embedding into a binary. . The SF3 SoundFont format is the same as SF2, except it uses @@ -22,5 +22,3 @@ expect the Vorbis codec to be used, which is lossy; hence, an SF3 SoundFont is considered to have a corresponding SF2 one as source, and to be compiled via this tool. - . - Note: the package will likely be renamed (upstream and in Debian). diff -Nru musescore-sftools-20180222/debian/musescore-sfconvert.1 musescore-sftools-20180325/debian/musescore-sfconvert.1 --- musescore-sftools-20180222/debian/musescore-sfconvert.1 2018-03-15 00:20:00.000000000 +0000 +++ musescore-sftools-20180325/debian/musescore-sfconvert.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -.\" Copyright © 2018 mirabilos -.\" -.\" This manual page is provided under the same terms as the tool it describes. -.Dd March 5, 2018 -.Dt MUSESCORE\-SFCONVERT 1 -.Os Debian -.Sh NAME -.Nm musescore\-sfconvert -.Nd SoundFont conversion utility -.Sh SYNOPSIS -.Nm -.Op Fl cdsxz -.Op Fl a Ar ampl -.Op Fl p Ar p -.Op Fl q Ar qual -.Ar infile -.Op Ar outfile -.Sh DESCRIPTION -The -.Nm -utility converts an SF2 format SoundFont; it can compress it -into SF3, encode as C for embedding into a binary, or as XML. -.Pp -The options are as follows: -.Bl -tag -width xxx -.It Fl a Ar ampl -Set the pre-compression amplification to -.Ar ampl -.Pq default \-1.0 -dB. -.It Fl c -Output C code. -.It Fl d -Dump presets. -.It Fl p Ar p -Append -.Ar p -to the list of presets. -.It Fl q Ar qual -Set the Vorbis quality to -.Ar qual -.Pq default 0.3 . -.It Fl s -Create a small soundfont (one instrument/preset), pan to 0. -.It Fl x -Output XML. -.It Fl z -Compress the soundfont. -.El -.Pp -The -.Fl c , -.Fl d -and -.Fl z -options are mutually exclusive. -XML output needs -.Fl z -but does not seem to compress. -.Sh CAVEATS -Raising the quality to 0.6 might be necessary to avoid artifacts; -this however increases the size of the generated SF3 by about a third -(to about fifteen percent of the SF2 size). -.Pp -There is no formal specification of the SF3 format yet. diff -Nru musescore-sftools-20180222/debian/musescore-sfconvert.lintian-overrides musescore-sftools-20180325/debian/musescore-sfconvert.lintian-overrides --- musescore-sftools-20180222/debian/musescore-sfconvert.lintian-overrides 2018-03-15 00:18:17.000000000 +0000 +++ musescore-sftools-20180325/debian/musescore-sfconvert.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -# there’s none -musescore-sfconvert: no-upstream-changelog diff -Nru musescore-sftools-20180222/debian/musescore-sfconvert.manpages musescore-sftools-20180325/debian/musescore-sfconvert.manpages --- musescore-sftools-20180222/debian/musescore-sfconvert.manpages 2018-03-15 00:18:17.000000000 +0000 +++ musescore-sftools-20180325/debian/musescore-sfconvert.manpages 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -debian/musescore-sfconvert.1 diff -Nru musescore-sftools-20180222/debian/patches/cxxflags.patch musescore-sftools-20180325/debian/patches/cxxflags.patch --- musescore-sftools-20180222/debian/patches/cxxflags.patch 2018-03-15 00:20:56.000000000 +0000 +++ musescore-sftools-20180325/debian/patches/cxxflags.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -Description: Do not override CMAKE_CXX_FLAGS from debhelper -Author: mirabilos -Forwarded: part of https://github.com/musescore/sftools/pull/18 - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -20,11 +20,7 @@ include (${PROJECT_SOURCE_DIR}/build/Use - set(QT_MIN_VERSION "5.6") - set(QT_USE_QTXML TRUE) - --if (MINGW) -- set(CMAKE_CXX_FLAGS "-g -std=c++0x") --else (MINGW) -- set(CMAKE_CXX_FLAGS "-g -std=c++0x -fPIC -fPIE") --endif (MINGW) -+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - - add_executable(sfconvert - sfconvert.cpp sfont.cpp xml.cpp diff -Nru musescore-sftools-20180222/debian/patches/install.patch musescore-sftools-20180325/debian/patches/install.patch --- musescore-sftools-20180222/debian/patches/install.patch 2018-03-15 00:20:59.000000000 +0000 +++ musescore-sftools-20180325/debian/patches/install.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -Description: Are non-Windows users not allowed to install this? -Author: mirabilos -Forwarded: part of https://github.com/musescore/sftools/pull/18 - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -104,4 +104,6 @@ else (MINGW) - vorbisenc - ${SNDFILE_LIB} - ) -+ -+ install(TARGETS sfconvert RUNTIME DESTINATION bin) - endif (MINGW) diff -Nru musescore-sftools-20180222/debian/patches/rename.patch musescore-sftools-20180325/debian/patches/rename.patch --- musescore-sftools-20180222/debian/patches/rename.patch 2018-03-15 00:21:28.000000000 +0000 +++ musescore-sftools-20180325/debian/patches/rename.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -Description: Rename to avoid file conflict with audiofile-tools - Note that upstream wishes to switch to a different name -Author: mirabilos -Forwarded: part of https://github.com/musescore/sftools/pull/18 - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -22,7 +22,7 @@ set(QT_USE_QTXML TRUE) - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - --add_executable(sfconvert -+add_executable(musescore-sfconvert - sfconvert.cpp sfont.cpp xml.cpp - ) - -@@ -97,7 +97,7 @@ else (MINGW) - ${VORBIS_INCDIR} - ) - -- target_link_libraries(sfconvert -+ target_link_libraries(musescore-sfconvert - ${QT_LIBRARIES} - ${OGG_LIB} - ${VORBIS_LIB} -@@ -105,5 +105,5 @@ else (MINGW) - ${SNDFILE_LIB} - ) - -- install(TARGETS sfconvert RUNTIME DESTINATION bin) -+ install(TARGETS musescore-sfconvert RUNTIME DESTINATION bin) - endif (MINGW) diff -Nru musescore-sftools-20180222/debian/patches/reproducible.patch musescore-sftools-20180325/debian/patches/reproducible.patch --- musescore-sftools-20180222/debian/patches/reproducible.patch 2018-03-15 00:18:21.000000000 +0000 +++ musescore-sftools-20180325/debian/patches/reproducible.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -Description: Reproducible builds, the easy way -Author: mirabilos -Forwarded: https://github.com/musescore/sftools/pull/20 - ---- a/sfont.cpp -+++ b/sfont.cpp -@@ -1199,8 +1199,7 @@ int SoundFont::writeCompressedSample(Sam - vorbis_comment_init(&vc); - vorbis_analysis_init(&vd, &vi); - vorbis_block_init(&vd, &vb); -- srand(time(NULL)); -- ogg_stream_init(&os, rand()); -+ ogg_stream_init(&os, 0); - - ogg_packet header; - ogg_packet header_comm; diff -Nru musescore-sftools-20180222/debian/patches/series musescore-sftools-20180325/debian/patches/series --- musescore-sftools-20180222/debian/patches/series 2018-03-15 00:18:17.000000000 +0000 +++ musescore-sftools-20180325/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -cxxflags.patch -install.patch -spelling.patch -rename.patch -reproducible.patch diff -Nru musescore-sftools-20180222/debian/patches/spelling.patch musescore-sftools-20180325/debian/patches/spelling.patch --- musescore-sftools-20180222/debian/patches/spelling.patch 2018-03-15 00:15:23.000000000 +0000 +++ musescore-sftools-20180325/debian/patches/spelling.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -Description: Fix spelling -Origin: lintian -Forwarded: https://github.com/musescore/sftools/pull/17 -Applied-Upstream: commit:dc7f002bbce328664dc4df63e3fc9ca517a984c4 - ---- a/sfconvert.cpp -+++ b/sfconvert.cpp -@@ -38,8 +38,8 @@ static void usage(const char* pname) - fprintf(stderr, " -z compress sf\n"); - fprintf(stderr, " -q qq ogg quality\n"); - fprintf(stderr, " -a nn amplification in dB before ogg compression\n"); -- fprintf(stderr, " -x xml ouput\n"); -- fprintf(stderr, " -c c ouput\n"); -+ fprintf(stderr, " -x xml output\n"); -+ fprintf(stderr, " -c c output\n"); - fprintf(stderr, " -p nn preset\n"); - fprintf(stderr, " -d dump presets\n"); - fprintf(stderr, " -s create small sf (one instrument/preset), pan to 0\n"); diff -Nru musescore-sftools-20180222/debian/sf3convert.lintian-overrides musescore-sftools-20180325/debian/sf3convert.lintian-overrides --- musescore-sftools-20180222/debian/sf3convert.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ musescore-sftools-20180325/debian/sf3convert.lintian-overrides 2018-03-25 17:27:51.000000000 +0000 @@ -0,0 +1,5 @@ +# there’s none +sf3convert: no-upstream-changelog + +# false positive: name of a CLI parameter +sf3convert: spelling-error-in-manpage usr/share/man/man1/sf3convert.1.gz pres press diff -Nru musescore-sftools-20180222/debian/upstream/metadata musescore-sftools-20180325/debian/upstream/metadata --- musescore-sftools-20180222/debian/upstream/metadata 2018-03-15 00:17:26.000000000 +0000 +++ musescore-sftools-20180325/debian/upstream/metadata 2018-03-25 17:27:51.000000000 +0000 @@ -3,7 +3,7 @@ "Bug-Database": "https://github.com/musescore/sftools/issues", "Bug-Submit": "https://github.com/musescore/sftools/issues/new", "Donation": "https://musescore.org/en/donate", - "Name": "sfconvert", + "Name": "sftools", "Repository": "git@github.com:musescore/sftools.git", "Repository-Browse": "https://github.com/musescore/sftools" } diff -Nru musescore-sftools-20180222/README.md musescore-sftools-20180325/README.md --- musescore-sftools-20180222/README.md 2018-03-05 00:06:25.000000000 +0000 +++ musescore-sftools-20180325/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +1,4 @@ -### sfconvert +### sf3convert Utilities for SoundFont files. @@ -23,7 +23,7 @@ This compresses the Fluid sound font from 148 MBytes to 20 MBytes. - sfconvert -z FluidR3.SF2 mops.sf3 + sf3convert -z FluidR3.SF2 mops.sf3 **The compressed sound font has the major version number 3. Its non standard and can be used only (so far) by [MuseScore](http://musescore.org).** diff -Nru musescore-sftools-20180222/sf3convert.1 musescore-sftools-20180325/sf3convert.1 --- musescore-sftools-20180222/sf3convert.1 1970-01-01 00:00:00.000000000 +0000 +++ musescore-sftools-20180325/sf3convert.1 1970-01-01 00:00:00.000000000 +0000 @@ -0,0 +1,90 @@ +.\" Copyright © 2018 mirabilos +.\" +.\" This manual page is provided under the same terms as the tool it describes. +.Dd March 5, 2018 +.Dt SF3CONVERT 1 +.Os Debian +.Sh NAME +.Nm sf3convert +.Nd SoundFont conversion utility +.Sh SYNOPSIS +.Nm +.Op Fl cdsxz +.Op Fl a Ar ampl +.Op Fl p Ar pres +.Op Fl S Ar number +.Op Fl q Ar qual +.Ar infile +.Op Ar outfile +.Sh DESCRIPTION +The +.Nm +utility converts an SF2 format SoundFont; it can compress it +into SF3, encode as C for embedding into a binary, or as XML. +.Pp +The options are as follows: +.Bl -tag -width xxx +.It Fl a Ar ampl +Set the pre-compression amplification to +.Ar ampl +.Pq default \-1.0 +dB. +.It Fl c +Output C code. +.It Fl d +Dump presets. +.It Fl p Ar pres +Append +.Ar pres +to the list of presets. +.It Fl q Ar qual +Set the Vorbis quality to +.Ar qual +.Pq default 0.3 . +.It Fl S Ar number +Use +.Ar number +as the OGG stream serial number instead of a time-based random one. +.It Fl s +Create a small soundfont (one instrument/preset), pan to 0. +.It Fl x +Output XML. +.It Fl z +Compress the soundfont. +.El +.Pp +The +.Fl c , +.Fl d +and +.Fl z +options are mutually exclusive. +XML output needs +.Fl z +but does not seem to compress. +.Sh CAVEATS +Raising the quality to 0.6 might be necessary to avoid artifacts; +this however increases the size of the generated SF3 by about a third +(to about fifteen percent of the SF2 size). +.Pp +There is no formal specification of the SF3 format yet. +Differences: +.Bl -bullet +.It +The samples' waveform data is stored using the OGG container +format with the Vorbis codec. +(Other codecs supporting the OGG container could be used, +but the current code uses OGG Vorbis.) +.It +Loop start and end are stored based on the beginning of the +corresponding sample, not based on the beginning of the +.Li smpl +chunk. +.It +24-bit mode is disabled. +.It +Sample links are removed. +.El +.Pp +Note that this list is +.Em incomplete . diff -Nru musescore-sftools-20180222/sfconvert.cpp musescore-sftools-20180325/sfconvert.cpp --- musescore-sftools-20180222/sfconvert.cpp 2018-03-05 00:06:25.000000000 +0000 +++ musescore-sftools-20180325/sfconvert.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -38,11 +38,12 @@ fprintf(stderr, " -z compress sf\n"); fprintf(stderr, " -q qq ogg quality\n"); fprintf(stderr, " -a nn amplification in dB before ogg compression\n"); - fprintf(stderr, " -x xml ouput\n"); - fprintf(stderr, " -c c ouput\n"); + fprintf(stderr, " -x xml output\n"); + fprintf(stderr, " -c c output\n"); fprintf(stderr, " -p nn preset\n"); fprintf(stderr, " -d dump presets\n"); fprintf(stderr, " -s create small sf (one instrument/preset), pan to 0\n"); + fprintf(stderr, " -S nn ogg serial number\n"); } //--------------------------------------------------------- @@ -57,6 +58,7 @@ bool compress = false; double oggQuality = 0.3; double oggAmp = -1.0; + qint64 oggSerial = std::numeric_limits::max(); QList presets; @@ -65,7 +67,7 @@ fprintf(stderr, "%s: convert sound file\n", argv[0]); int c; - while ((c = getopt(argc, argv, "xcp:dszq:a:")) != EOF) { + while ((c = getopt(argc, argv, "xcp:dS:szq:a:")) != EOF) { switch(c) { case 'x': xml = true; @@ -79,6 +81,9 @@ case 'd': dump = true; break; + case 'S': + oggSerial = atoi(optarg); + break; case 's': smallSf = true; break; @@ -137,7 +142,7 @@ if (xml) sf.writeXml(&fo); else - sf.write(&fo, oggQuality, oggAmp); + sf.write(&fo, oggQuality, oggAmp, oggSerial); fo.close(); } qDebug("Soundfont converted in: %d ms", t.elapsed()); diff -Nru musescore-sftools-20180222/sfont.cpp musescore-sftools-20180325/sfont.cpp --- musescore-sftools-20180222/sfont.cpp 2018-03-05 00:06:25.000000000 +0000 +++ musescore-sftools-20180325/sfont.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -729,11 +729,12 @@ // write //--------------------------------------------------------- -bool SoundFont::write(QFile* f, double oggQuality, double oggAmp) +bool SoundFont::write(QFile* f, double oggQuality, double oggAmp, qint64 oggSerial) { file = f; _oggQuality = oggQuality; _oggAmp = oggAmp; + _oggSerial = oggSerial; qint64 riffLenPos; qint64 listLenPos; try { @@ -1200,7 +1201,7 @@ vorbis_analysis_init(&vd, &vi); vorbis_block_init(&vd, &vb); srand(time(NULL)); - ogg_stream_init(&os, rand()); + ogg_stream_init(&os, _oggSerial == std::numeric_limits::max() ? rand() : (int)_oggSerial); ogg_packet header; ogg_packet header_comm; diff -Nru musescore-sftools-20180222/sfont.h musescore-sftools-20180325/sfont.h --- musescore-sftools-20180222/sfont.h 2018-03-05 00:06:25.000000000 +0000 +++ musescore-sftools-20180325/sfont.h 1970-01-01 00:00:00.000000000 +0000 @@ -179,6 +179,7 @@ double _oggQuality; double _oggAmp; + qint64 _oggSerial; unsigned readDword(); int readWord(); @@ -232,7 +233,7 @@ SoundFont(const QString&); ~SoundFont(); bool read(); - bool write(QFile*, double oggQuality, double oggAmp); + bool write(QFile*, double oggQuality, double oggAmp, qint64 oggSerial); bool readXml(QFile*); bool writeXml(QFile*); bool writeCode(QList);