Audio Graphing in Plotly




Introduction: Audio Graphing in Plotly

About: Electrical Engineer

This project teaches you how to use MATLAB to record and transfer audio data to Plotly and graph it. You will need the MATLAB software, a microphone, and a Plotly account.

You can see my graph here.

Step 1: Code in MATLAB

Open up MATLAB.
Create a new Script by pressing ctrl+N or selecting File->New->Script
Save the Script as 'AudioGraph_Plotly.m'
Paste the following code into the Editor and save:
disp('Recording Audio...');
disp('Done Recording');

Step 2: Collect Data

Quick Edit:
You can change the amount of seconds that the program records audio for by changing the line "recordblocking(recObj,3);" where the "3" represents the time (in seconds) that audio will be recorded.

You can now run the program by either pressing F5 or clicking the green Run button.
When the program runs the console window will display "Recording Audio..." followed by "Done Recording" when the audio is no longer being recorded. After this is done, all the audio data will have been stored in a file labeled 'AudioData.dat'.

Step 3: Moving the Data Into Plotly

Open Plotly and sign in.
Your data should appear in two columns. The left column represents your X values and the right column represents your Y values. Select 'choose as x' for the left column and 'choose as y' for the right column.
On the left side of the screen choose Line Plot and click the blue button labeled "Line Plot".
Your audio data should now be compressed into a waveform that is easily distinguishable.

Now all you need is labels for the x-axis and y-axis and a title and your graph is complete.

If you make an audio graph post it in the comments so everyone can see!

Go a step further:
You can now begin to play with the data to make some pretty cool graphs. Try a bubble graph or changing colors depending on values.

Data Visualization Contest

Participated in the
Data Visualization Contest

Be the First to Share


    • Puzzles Speed Challenge

      Puzzles Speed Challenge
    • "Can't Touch This" Family Contest

      "Can't Touch This" Family Contest
    • CNC Contest 2020

      CNC Contest 2020

    2 Discussions


    6 years ago on Introduction

    Very cool! Do you have a link to the graph? We'd love to see it (sorry if we missed it).