Visual Audio

Visual audio is a short fun project written in C++. The project uses SFML (Simple Fast Media Library) to do most of the low level work such as handeling the graphics and microphone driver interface.

A condenced verion of the code is below. Line one retreives the number of samples avaiable from the recorder object sc (sample count). Line two is an array of verticis that will later be populated by the microphone stream data and is set to the size of the number of samples.

The remainder of the code iterates through the each audio sample resizing the value to fit the dimentions of the window of the application. All of these resized values are placed into a the vertex array, from line two, to later be handed to the graphics and displayed as a frame.

								
	sc = recorder.sc;
	sf::VertexArray line(sf::LineStrip, sc);

	for (int i = 1; i < int(sc); i++){
	    x = int( float(float(window_width) / float(sc)) * i);
	    y = int(window_height / 2) + (*recorder.sample++ / 25 );
	    line[i].position = sf::Vector2f( x, y);
	    line[i].color = sf::Color::Red;
	}
								
							
Fun Fact: This project was done on a $300 chromebook with 16GB of solid state storage that I modified to boot Arch Linux.

The gif at the top of this page is a screen recording of the program listeing to my phone playing with a tone generator app. The gif at the bottom of this page is me saying "In a world of infinite possibilities, ask not if, but when."

Visual Audio - on Github