Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Irbis

Pages: [1]
1
There is a very interesting exponent in the Museum of Optics in Saint-Peterburg, Russia. It's called Abbe's catalog and it consists of 144 optical glasses of different types and sizes. I've developed the software that visualizes music that is currently playing in the museum using 1152 RGB-LEDs.



SFML was used for audio jobs and for the touchscreen interface.

I'll write an article about it later, but you can already watch the video :


2
General / Getting Linker errors trying to install 1.6 VS2010
« on: March 04, 2011, 11:08:00 pm »
I think that you should add sfml-window-d.lib in case you're building a debug configuration.

3
Audio / Music Slicing
« on: March 03, 2011, 09:48:33 pm »
Quote from: "l0calh05t"

That will not work, as those pesky "vocal frequencies" are 90% of the important "music frequencies" as well ;) so this would reduce pretty much everything except extreme bass and extreme treble

Subtraction isn't perfect, due to - as you mentioned - compression, but also due to reverb, doubling and other stereo vocal effects, but it really is the best you can do. You could aditionally reduce the "presence" range of 2-3 kHz, but that will also affect your music quite a bit

In an ideal world you could use BSS (blind source separation) and vocal recognition to remove the vocal source. But in the real world... "that ain't happining"


Of course, nothing really works for re-creating a minus-track, so I was just trying to give some hope;)

Quote from: "devlin"
You could also pay the author to make an instrumental version.


It is also possible to find midi tracks for most popular music, sound is not very "musical", but it's suitable for karaoke if that's the case.

4
Audio / Music Slicing
« on: March 01, 2011, 12:43:35 pm »
Subtraction rarely works at least due to the compression.
You cannot remove vocals perfectly, but you can reduce them.
That can be done by using Fourier transform, reducing frequencies of the vocal range and performing inverse Fourier transform to recreate the wave back.

5
Audio / Getting samples with no delay
« on: January 16, 2011, 01:04:31 am »
Okay, I wasn't able to find how to do this using only SFML, but I've written the workaround that combines code from the SoundStream tutorial and some libsndfile code. Maybe it'll be useful for someone:

SequentialSoundStreamer.hpp
Code: [Select]

#include <SFML/Audio.hpp>
#include <sndfile.h>
#include <fftw3.h>
#include <iostream>

namespace sfe
{

class SequentialSoundStreamer : public sf::SoundStream
{
public :
    SequentialSoundStreamer(std::size_t BufferSize) :
    myBufferSize(BufferSize)  {}
    bool Open(const char * Filename);

private :
    virtual bool OnGetData(sf::SoundStream::Chunk& Data);
    std::size_t            myBufferSize;

    SNDFILE * SoundFile;
    SF_INFO SoundFileInfo;
    short * SamplesArray;
};
}


SequentialSoundStreamer.cpp
Code: [Select]

#include "SequentialSoundStreamer.hpp"

namespace sfe
{
    bool SequentialSoundStreamer::Open(const char * Filename)
    {
        SoundFileInfo.format=0;
        if (!(SoundFile = sf_open (Filename, SFM_READ, &SoundFileInfo)))
            std::cout<<"\nCan't open the file.\n";

        Initialize(SoundFileInfo.channels,SoundFileInfo.samplerate);

        SamplesArray = (short*) fftw_malloc(sizeof(short) * myBufferSize);

        return false;
    }

    bool SequentialSoundStreamer::OnGetData(sf::SoundStream::Chunk& Data)
    {
        if (! (Data.NbSamples = sf_readf_short (SoundFile, SamplesArray, myBufferSize / SoundFileInfo.channels) * SoundFileInfo.channels))
           {std::cout<<"\nCan't read the file (can be the end of it).\n"; return false;}

        Data.Samples   = SamplesArray;

        return true;
    }

}


As sound is being loaded chunk by chunk these chunks (SamplesArray) can be passed whatever they needed to.
malloc can be used instead of fftw_malloc.

6
Audio / Getting samples with no delay
« on: January 15, 2011, 07:57:56 pm »
Quote from: "Nexus"
Maybe sf::SoundStream is something for you?


Maybe I'm blind, but I wasn't able to find the solution to do this using SoundStream. Is it really possible to get samples from it? If so I'll try to read documentation about it once again and don't bother people with obvious questions;)

upd: Okay, after reading the SoundStream tutorial I can imagine how to get samples from SoundStream, but I don't see a way to get them while loading chunk by chunk, because it does the same thing - loads a file into the SoundBuffer in a memory first.

Quote from: "Nexus"

By the way:
Code: [Select]
const sf::SoundBuffer * SB;
SB.LoadFromFile("file.ogg");
I really doubt that this is your actual code. There are two compiletime errors and undefined behaviour at runtime. ;)


That's a typo, copypasted some messy code, already changed it.

7
Audio / Getting samples with no delay
« on: January 15, 2011, 07:44:28 pm »
Greetings, ladies and gentlemen.
I'm doing a project that requires a real-time spectrum visualization.
So, the algorithm looks like this:
1. Get playing offset
2. Get small amount of samples starting from that offset
3. Use FFT on those samples
4. Visualize

That's the code that I'm using for it:


Code: [Select]

sf::SoundBuffer SB;
SB.LoadFromFile("file.ogg");

const sf::Int16 * SBp;
SBp = SB.GetSamples();

sf::Sound SND;
SND.SetBuffer(SB);

SND.Play();

//Get current offset
//Fill an FFT input array with some amount of samples starting from that offset
//Call FFTW


The problem is that loading from file into the sound buffer takes some  time because it loads the whole file. I don't need the whole file at any moment, only small chunks.

Is it possible to load files chunk by chunk and get samples from those chunks without waiting for the whole file to load? As I understand sf::Music is doing the loading that way, but it doesn't allow me to get it's buffer.
Code: [Select]

Pages: [1]
anything