move to new cspot

This commit is contained in:
philippe44
2023-03-25 16:48:41 -07:00
parent c712b78931
commit 008c36facf
2983 changed files with 465270 additions and 13569 deletions

View File

@@ -0,0 +1,14 @@
project(bell_example)
cmake_minimum_required(VERSION 3.18)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/bell)
file(GLOB SOURCES "*.cpp")
include_directories(".")
add_executable(bell_example ${SOURCES})
target_link_libraries(bell_example bell ${CMAKE_DL_LIBS} ${THINGS_TO_LINK})
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)

View File

@@ -0,0 +1,70 @@
#include <memory.h>
#include <atomic>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <memory>
#include <vector>
#include "AudioCodecs.h"
#include "AudioContainers.h"
#include "BellHTTPServer.h"
#include "BellTar.h"
#include "BellTask.h"
#include "CentralAudioBuffer.h"
#include "Compressor.h"
#include "DecoderGlobals.h"
#include "EncodedAudioStream.h"
#include "HTTPClient.h"
#include "PortAudioSink.h"
#define DEBUG_LEVEL 4
#include "X509Bundle.h"
#include "mbedtls/debug.h"
#include <BellDSP.h>
#include <BellLogger.h>
std::shared_ptr<bell::CentralAudioBuffer> audioBuffer;
std::atomic<bool> isPaused = false;
class AudioPlayer : bell::Task {
public:
std::unique_ptr<PortAudioSink> audioSink;
std::unique_ptr<bell::BellDSP> dsp;
AudioPlayer() : bell::Task("player", 1024, 0, 0) {
this->audioSink = std::make_unique<PortAudioSink>();
this->audioSink->setParams(44100, 2, 16);
this->dsp = std::make_unique<bell::BellDSP>(audioBuffer);
startTask();
}
void runTask() override {
while (true) {
if (audioBuffer->hasAtLeast(64) || isPaused) {
auto chunk = audioBuffer->readChunk();
if (chunk != nullptr && chunk->pcmSize > 0) {
this->dsp->process(chunk->pcmData, chunk->pcmSize, 2, 44100,
bell::BitWidth::BW_16);
this->audioSink->feedPCMFrames(chunk->pcmData, chunk->pcmSize);
}
}
}
}
};
int main() {
bell::setDefaultLogger();
std::fstream file("system.tar", std::ios::in | std::ios::binary);
if (!file.is_open()) {
std::cout << "file not open" << std::endl;
return 1;
}
BellTar::reader reader(file);
reader.extract_all_files("./dupa2");
return 0;
}

View File

@@ -0,0 +1,13 @@
import matplotlib.pyplot as plt
from scipy import signal
from scipy.io import wavfile
sample_rate, samples = wavfile.read('out.wav')
print(sample_rate)
frequencies, times, spectrogram = signal.spectrogram(samples, sample_rate)
plt.pcolormesh(times, frequencies, spectrogram)
plt.imshow(spectrogram)
plt.ylabel('Frequency [Hz]')
plt.xlabel('Time [sec]')
plt.show()