Merge branch 'dev'
This commit is contained in:
+6
-2
@@ -1,15 +1,19 @@
|
||||
cmake_minimum_required(VERSION 3.5.2)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
# Set the project name
|
||||
project (concatenator)
|
||||
|
||||
set(Boost_USE_STATIC_LIBS OFF)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
find_package(Boost 1.60.0 COMPONENTS program_options)
|
||||
find_package(Boost 1.60.0 COMPONENTS program_options log log_setup thread date_time filesystem system)
|
||||
|
||||
if (NOT FO_BOOST_STATIC_LINK)
|
||||
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK -DBOOST_LOG_DYN_LINK)
|
||||
endif()
|
||||
|
||||
# Set build flags
|
||||
set(CMAKE_CXX_FLAGS "-g -Wall")
|
||||
set(CMAKE_CXX_FLAGS "-g -Wall ")
|
||||
# Set cmake to output executable to the bin directory
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Concatenator
|
||||
|
||||
A C++ application for generating granular synthesis driven representations of
|
||||
audio files based on audio database analysis.
|
||||
|
||||
This application is under development with the aim to explore the creative
|
||||
potential of combining short-time audio analyses with granular synthesis, to
|
||||
synthesize perceptually related representations of target audio files. Through
|
||||
use of analysed databases of varying sizes, an output can be generated that
|
||||
represents a mix of the spectral and temporal features of the original target
|
||||
sound and the corpus of source sounds.
|
||||
|
||||
To achieve this, a technique known as "concatenative synthesis" is used. This
|
||||
form of synthesis combines the ability to window and join small segments of
|
||||
sound to create a new sound (a process known as granular synthesis), with audio
|
||||
analysis techniques capable of describing a sound in order to differentiate it
|
||||
from others. By analysing small segments in a target sound for their perceptual
|
||||
characteristics (such as pitch, timbre and loudness), it is then possible to
|
||||
compare these segments to a collection of source sounds to find perceptually
|
||||
similar segments. From this, the most perceptually similar matches can be taken
|
||||
and joined using granular synthesis techniques in order to achieve the final
|
||||
result.
|
||||
|
||||
Note: This project is currently under development and is not ready for release.
|
||||
This project is based on the pysound project developed to explore concatenative
|
||||
synthesis in Python which can be found here:
|
||||
https://github.com/Pezz89/pysound
|
||||
This project's primary goal at present is to build on the performance of
|
||||
Pysound through the higher efficiency of the C++ language and to address issues
|
||||
with packaging and distribution encountered during the development of that
|
||||
project.
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/log/sinks.hpp>
|
||||
#include <boost/log/sources/severity_logger.hpp>
|
||||
#include <boost/log/sources/record_ostream.hpp>
|
||||
#include <boost/log/utility/formatting_ostream.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
class Logger {
|
||||
public:
|
||||
Logger();
|
||||
~Logger() {};
|
||||
void trace(std::string str);
|
||||
void debug(std::string str);
|
||||
void info(std::string str);
|
||||
void warning(std::string str);
|
||||
void error(std::string str);
|
||||
void fatal(std::string str);
|
||||
|
||||
private:
|
||||
|
||||
static void log_formatter(boost::log::record_view const& rec, boost::log::formatting_ostream& strm);
|
||||
|
||||
// Define types for logging backends
|
||||
typedef boost::log::sinks::asynchronous_sink<boost::log::sinks::text_ostream_backend> console_backend;
|
||||
typedef boost::log::sinks::asynchronous_sink<boost::log::sinks::text_file_backend> file_backend;
|
||||
|
||||
// Define a sink for console output and for log file output
|
||||
boost::shared_ptr<console_backend> console_sink;
|
||||
boost::shared_ptr<file_backend> file_sink;
|
||||
|
||||
//Define a logger
|
||||
boost::log::sources::severity_logger< boost::log::trivial::severity_level > lg;
|
||||
};
|
||||
@@ -1,13 +1,15 @@
|
||||
#include "argument_parser.h"
|
||||
#include "ArgumentParser.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ArgumentParser::ArgumentParser() : desc("Allowed options") {
|
||||
positionalOptions.add("input_db", 1);
|
||||
// Add positional arguments to specify source, target and output database locations.
|
||||
positionalOptions.add("source_db", 1);
|
||||
positionalOptions.add("target_db", 1);
|
||||
positionalOptions.add("output_db", 1);
|
||||
|
||||
|
||||
// Add optional arguments to allow control over application settings from the command line.
|
||||
desc.add_options()
|
||||
("help,h", "produce help message")
|
||||
("compression", po::value<int>(), "set compression level")
|
||||
@@ -0,0 +1,12 @@
|
||||
#include <sndfile.hh>
|
||||
|
||||
class AudioFile {
|
||||
public:
|
||||
private:
|
||||
SndfileHandle file;
|
||||
};
|
||||
|
||||
class AnalysedAudioFile : public AudioFile {
|
||||
public:
|
||||
private:
|
||||
};
|
||||
@@ -1,13 +1,15 @@
|
||||
#include <iostream>
|
||||
#include "argument_parser.h"
|
||||
#include "Logger.h"
|
||||
#include "ArgumentParser.h"
|
||||
#include "AudioDatabase.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Logger log = Logger();
|
||||
|
||||
// Declare the supported options.
|
||||
ArgumentParser argparse = ArgumentParser();
|
||||
argparse.parseargs(argc, argv);
|
||||
cout << "Hello world!" << endl;
|
||||
log.error("My pretty little error!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
#include <boost/log/common.hpp>
|
||||
#include <boost/smart_ptr/make_shared_object.hpp>
|
||||
#include <boost/log/sinks.hpp>
|
||||
#include <boost/log/sources/severity_logger.hpp>
|
||||
#include <boost/log/utility/setup/common_attributes.hpp>
|
||||
#include <boost/log/expressions.hpp>
|
||||
#include <boost/log/utility/setup/file.hpp>
|
||||
#include <boost/log/expressions.hpp>
|
||||
#include <boost/log/support/date_time.hpp>
|
||||
#include <boost/core/null_deleter.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <ostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
namespace logging = boost::log;
|
||||
namespace src = boost::log::sources;
|
||||
namespace expr = boost::log::expressions;
|
||||
namespace keywords = boost::log::keywords;
|
||||
|
||||
//BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", int)
|
||||
|
||||
Logger::Logger() {
|
||||
|
||||
boost::log::register_simple_formatter_factory< boost::log::trivial::severity_level, char >("Severity");
|
||||
Logger::console_sink = boost::make_shared<console_backend>();
|
||||
|
||||
Logger::file_sink =
|
||||
boost::make_shared<file_backend>(
|
||||
keywords::file_name = "concatenator_log_%N.log",
|
||||
keywords::rotation_size = 5 * 1024 * 1024
|
||||
);
|
||||
|
||||
|
||||
Logger::file_sink->set_formatter(
|
||||
expr::stream <<
|
||||
"[" <<
|
||||
expr::format_date_time< boost::posix_time::ptime >("TimeStamp", "%Y-%m-%d %H:%M:%S") <<
|
||||
"] [" <<
|
||||
logging::trivial::severity <<
|
||||
"] --- " <<
|
||||
expr::smessage
|
||||
);
|
||||
|
||||
Logger::console_sink->set_formatter(
|
||||
expr::stream <<
|
||||
"[" <<
|
||||
expr::format_date_time< boost::posix_time::ptime >("TimeStamp", "%Y-%m-%d %H:%M:%S") <<
|
||||
"] [" <<
|
||||
logging::trivial::severity <<
|
||||
"] --- " <<
|
||||
expr::smessage
|
||||
);
|
||||
|
||||
boost::shared_ptr<std::ostream> stdout_stream{&std::clog, boost::null_deleter{}};
|
||||
Logger::console_sink->locked_backend()->add_stream(stdout_stream);
|
||||
|
||||
Logger::console_sink->locked_backend()->auto_flush(true);
|
||||
Logger::file_sink->locked_backend()->auto_flush(true);
|
||||
|
||||
//Logger::sink->set_filter(severity > 0);
|
||||
|
||||
logging::core::get()->add_sink(Logger::file_sink);
|
||||
logging::core::get()->add_sink(Logger::console_sink);
|
||||
|
||||
logging::add_common_attributes();
|
||||
|
||||
};
|
||||
|
||||
void Logger::trace(std::string str) {
|
||||
BOOST_LOG_SEV(lg, logging::trivial::trace) << str;
|
||||
}
|
||||
|
||||
void Logger::debug(std::string str) {
|
||||
BOOST_LOG_SEV(lg, logging::trivial::debug) << str;
|
||||
}
|
||||
|
||||
void Logger::info(std::string str) {
|
||||
BOOST_LOG_SEV(lg, logging::trivial::info) << str;
|
||||
}
|
||||
|
||||
void Logger::warning(std::string str) {
|
||||
BOOST_LOG_SEV(lg, logging::trivial::warning) << str;
|
||||
}
|
||||
|
||||
void Logger::error(std::string str) {
|
||||
BOOST_LOG_SEV(lg, logging::trivial::error) << str;
|
||||
}
|
||||
|
||||
void Logger::fatal(std::string str) {
|
||||
BOOST_LOG_SEV(lg, logging::trivial::fatal) << str;
|
||||
}
|
||||
Reference in New Issue
Block a user